REOPENED Bug 219257
[GTK] Allow WebKitTestServer to run non-loopback addresses for API tests
https://bugs.webkit.org/show_bug.cgi?id=219257
Summary [GTK] Allow WebKitTestServer to run non-loopback addresses for API tests
Frédéric Wang (:fredw)
Reported 2020-11-23 06:31:35 PST
This is needed to test WEBKIT_INSECURE_CONTENT_RUN and WEBKIT_INSECURE_CONTENT_DISPLAYED APIs if localhost & loopback IP addresses are no longer mixed content. Unfortunately, that does not seem possible until bug 219198 is fixed. Meanwhile, let's try to move from "127.0.0.1" to "localhost" as Michael suggested elsewhere.
Attachments
Tentative patch (untested) (4.76 KB, patch)
2020-11-23 06:36 PST, Frédéric Wang (:fredw)
mcatanzaro: review+
Patch (reverted) (6.77 KB, patch)
2020-11-24 05:58 PST, Frédéric Wang (:fredw)
no flags
Patch (5.25 KB, patch)
2021-02-24 07:44 PST, Frédéric Wang (:fredw)
no flags
Frédéric Wang (:fredw)
Comment 1 2020-11-23 06:36:28 PST
Created attachment 414801 [details] Tentative patch (untested)
Frédéric Wang (:fredw)
Comment 2 2020-11-23 07:31:20 PST
Comment on attachment 414801 [details] Tentative patch (untested) It looks like the API tests pass after this change, so I'm asking review now. Will update the changelog later, but basically this is doing Michael's suggestion in bug 218623 comment 15, so that the test won't be broken when we stop treating loopback IP address as mixed content.
Michael Catanzaro
Comment 3 2020-11-23 08:08:16 PST
Comment on attachment 414801 [details] Tentative patch (untested) View in context: https://bugs.webkit.org/attachment.cgi?id=414801&action=review > Tools/TestWebKitAPI/glib/WebKitGLib/WebKitTestServer.h:35 > + ServerNonLocalHost = 1 << 3, If you call it ServerNonLoopback instead, this would be a lot less weird. Because passing ServerNonLocalHost to cause the server to use localhost is weird. ;)
Michael Catanzaro
Comment 4 2020-11-23 08:12:00 PST
Comment on attachment 414801 [details] Tentative patch (untested) View in context: https://bugs.webkit.org/attachment.cgi?id=414801&action=review LGTM. I see TestSSL now needs two HTTP servers instead of one, but that's fine. I bet Carlos Garcia will want to review this before it lands. > Tools/TestWebKitAPI/glib/WebKitGLib/WebKitTestServer.h:38 > - WebKitTestServer(ServerOptions = ServerHTTP); > + WebKitTestServer(uint8_t options = ServerHTTP); I don't like this... why are you removing its nice type?
Frédéric Wang (:fredw)
Comment 5 2020-11-23 09:15:27 PST
(In reply to Michael Catanzaro from comment #3) > Comment on attachment 414801 [details] > Tentative patch (untested) > > View in context: > https://bugs.webkit.org/attachment.cgi?id=414801&action=review > > > Tools/TestWebKitAPI/glib/WebKitGLib/WebKitTestServer.h:35 > > + ServerNonLocalHost = 1 << 3, > > If you call it ServerNonLoopback instead, this would be a lot less weird. > Because passing ServerNonLocalHost to cause the server to use localhost is > weird. ;) Right, but ultimately I want to call it ServerNonLocalHost as we want to stop treating localhost as mixed content too. I'm fine keeping this name for now... but maybe people would add new tests assuming it's just not loopback. (In reply to Michael Catanzaro from comment #4) > Comment on attachment 414801 [details] > Tentative patch (untested) > > View in context: > https://bugs.webkit.org/attachment.cgi?id=414801&action=review > > LGTM. I see TestSSL now needs two HTTP servers instead of one, but that's > fine. Actually three (2 HTTPS and HTTP). I can also change the tests to always use the new version HTTPS version, but not sure that really makes a difference. > I bet Carlos Garcia will want to review this before it lands. > > > Tools/TestWebKitAPI/glib/WebKitGLib/WebKitTestServer.h:38 > > - WebKitTestServer(ServerOptions = ServerHTTP); > > + WebKitTestServer(uint8_t options = ServerHTTP); > > I don't like this... why are you removing its nice type? ServerOptions is currently an enum of bit flags, so it can't accept a combination ServerHttps | ServerNonLoopback.
Michael Catanzaro
Comment 6 2020-11-23 10:31:43 PST
(In reply to Frédéric Wang (:fredw) from comment #5) > ServerOptions is currently an enum of bit flags, so it can't accept a > combination ServerHttps | ServerNonLoopback. Try: static_cast<ServerOptions>(ServerHttps | ServerNonLoopback)
Michael Catanzaro
Comment 7 2020-11-23 10:32:21 PST
Or better: try std::bitset!
Frédéric Wang (:fredw)
Comment 8 2020-11-24 05:58:55 PST
Created attachment 414835 [details] Patch (reverted)
Frédéric Wang (:fredw)
Comment 9 2020-11-24 06:01:15 PST
(In reply to Michael Catanzaro from comment #3) > If you call it ServerNonLoopback instead, this would be a lot less weird. > Because passing ServerNonLocalHost to cause the server to use localhost is > weird. ;) Done (In reply to Michael Catanzaro from comment #4) > LGTM. I see TestSSL now needs two HTTP servers instead of one, but that's > fine. Merged to use only one HTTPS server, let's see if that does not break any test... (In reply to Michael Catanzaro from comment #7) > Or better: try std::bitset! Done.
EWS
Comment 10 2020-11-26 16:41:21 PST
Committed r270170: <https://trac.webkit.org/changeset/270170> All reviewed patches have been landed. Closing bug and clearing flags on attachment 414835 [details].
WebKit Commit Bot
Comment 11 2021-01-25 07:06:48 PST
Re-opened since this is blocked by bug 220922
Radar WebKit Bug Importer
Comment 12 2021-01-25 07:07:06 PST
Frédéric Wang (:fredw)
Comment 13 2021-02-22 14:08:12 PST
(In reply to Frédéric Wang (:fredw) from comment #9) > (In reply to Michael Catanzaro from comment #7) > > Or better: try std::bitset! > > Done. This change was problematic, std::bitset's constructor takes a bit mask but its setter/getter relies on the bit's position instead. I've extracted this change to bug 222273.
Frédéric Wang (:fredw)
Comment 14 2021-02-24 07:44:18 PST
Created attachment 421409 [details] Patch I tried a bit to rebase, but was not able to make the certificate stuff work. Probably some special config is needed for the domain name...
Frédéric Wang (:fredw)
Comment 15 2021-12-10 02:10:58 PST
Removing myself from assignee since I'm not working on this anymore.
Note You need to log in before you can comment on or make changes to this bug.