Bug 186030 - Set Origin header value to null rather than omitting it
Summary: Set Origin header value to null rather than omitting it
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Rob Buis
URL:
Keywords: InRadar
: 201127 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-05-28 02:13 PDT by Anne van Kesteren
Modified: 2020-03-15 13:25 PDT (History)
15 users (show)

See Also:


Attachments
Patch (5.17 KB, patch)
2019-01-18 11:29 PST, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (9.47 KB, patch)
2019-01-19 08:32 PST, Rob Buis
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews102 for mac-highsierra (2.96 MB, application/zip)
2019-01-19 09:45 PST, EWS Watchlist
no flags Details
Archive of layout-test-results from ews107 for mac-highsierra-wk2 (2.97 MB, application/zip)
2019-01-19 09:56 PST, EWS Watchlist
no flags Details
Archive of layout-test-results from ews200 for win-future (12.82 MB, application/zip)
2019-01-19 10:18 PST, EWS Watchlist
no flags Details
Archive of layout-test-results from ews117 for mac-highsierra (2.52 MB, application/zip)
2019-01-19 10:28 PST, EWS Watchlist
no flags Details
Archive of layout-test-results from ews123 for ios-simulator-wk2 (2.82 MB, application/zip)
2019-01-19 10:42 PST, EWS Watchlist
no flags Details
Patch (9.56 KB, patch)
2019-01-19 12:01 PST, Rob Buis
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews102 for mac-highsierra (2.42 MB, application/zip)
2019-01-19 13:11 PST, EWS Watchlist
no flags Details
Archive of layout-test-results from ews107 for mac-highsierra-wk2 (2.55 MB, application/zip)
2019-01-19 13:23 PST, EWS Watchlist
no flags Details
Archive of layout-test-results from ews112 for mac-highsierra (1.98 MB, application/zip)
2019-01-19 13:52 PST, EWS Watchlist
no flags Details
Archive of layout-test-results from ews204 for win-future (12.82 MB, application/zip)
2019-01-19 13:56 PST, EWS Watchlist
no flags Details
Archive of layout-test-results from ews123 for ios-simulator-wk2 (2.42 MB, application/zip)
2019-01-19 14:06 PST, EWS Watchlist
no flags Details
Patch (11.74 KB, patch)
2019-01-20 08:13 PST, Rob Buis
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews200 for win-future (12.83 MB, application/zip)
2019-01-20 10:54 PST, EWS Watchlist
no flags Details
Patch (11.74 KB, patch)
2019-01-20 12:59 PST, Rob Buis
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews202 for win-future (12.86 MB, application/zip)
2019-01-20 14:55 PST, EWS Watchlist
no flags Details
Patch (13.71 KB, patch)
2019-09-01 03:37 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (13.69 KB, patch)
2019-09-01 04:48 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews215 for win-future (13.55 MB, application/zip)
2019-09-01 06:27 PDT, EWS Watchlist
no flags Details
Patch (13.68 KB, patch)
2019-09-22 04:56 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews210 for win-future (13.77 MB, application/zip)
2019-09-22 06:57 PDT, EWS Watchlist
no flags Details
Patch (13.67 KB, patch)
2019-12-18 05:34 PST, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (15.05 KB, patch)
2019-12-30 11:45 PST, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (12.35 KB, patch)
2019-12-31 03:15 PST, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (11.55 KB, patch)
2019-12-31 05:18 PST, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (10.99 KB, patch)
2020-03-13 01:13 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (12.15 KB, patch)
2020-03-13 02:57 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (7.77 KB, patch)
2020-03-13 09:45 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (7.83 KB, patch)
2020-03-13 10:51 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (7.90 KB, patch)
2020-03-13 23:48 PDT, Rob Buis
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Anne van Kesteren 2018-05-28 02:13:43 PDT
Safari seems to omit the Origin header after a certain type of cross-origin redirect. It should instead be set to null. Test: https://github.com/w3c/web-platform-tests/pull/11164.

Specification change: https://github.com/whatwg/fetch/pull/594.
Comment 1 Radar WebKit Bug Importer 2018-05-31 12:11:54 PDT
<rdar://problem/40694782>
Comment 2 Brent Fulgham 2019-01-03 10:15:01 PST
We should recheck these results now that Bug 182644 has been merged.
Comment 3 youenn fablet 2019-01-03 17:18:33 PST
Running the test, we indeed set correctly the Origin header in the case of no-cors POST for the initial request in FrameLoader::addHTTPOriginIfNeeded.

But we are not doing anything for redirections.
We might need to update SubresourceLoader::checkRedirectionCrossOriginAccessControl and  NetworkLoadChecker::continueCheckingRequest.
Comment 4 Rob Buis 2019-01-18 11:29:33 PST
Created attachment 359515 [details]
Patch
Comment 5 Rob Buis 2019-01-19 08:32:04 PST
Created attachment 359611 [details]
Patch
Comment 6 EWS Watchlist 2019-01-19 09:45:23 PST
Comment on attachment 359611 [details]
Patch

Attachment 359611 [details] did not pass mac-ews (mac):
Output: https://webkit-queues.webkit.org/results/10811324

New failing tests:
http/tests/security/contentSecurityPolicy/form-action-src-redirect-allowed.html
http/tests/navigation/post-308-response.html
http/tests/security/cors-post-redirect-307-pson.html
http/tests/security/cors-post-redirect-308.html
http/tests/security/contentSecurityPolicy/form-action-src-redirect-allowed2.html
http/tests/security/cors-post-redirect-307.html
http/tests/loading/redirect-methods.html
http/tests/navigation/post-307-response.html
Comment 7 EWS Watchlist 2019-01-19 09:45:25 PST
Created attachment 359613 [details]
Archive of layout-test-results from ews102 for mac-highsierra

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews102  Port: mac-highsierra  Platform: Mac OS X 10.13.6
Comment 8 EWS Watchlist 2019-01-19 09:56:38 PST
Comment on attachment 359611 [details]
Patch

Attachment 359611 [details] did not pass mac-wk2-ews (mac-wk2):
Output: https://webkit-queues.webkit.org/results/10811343

New failing tests:
http/tests/security/contentSecurityPolicy/form-action-src-redirect-allowed.html
http/tests/navigation/post-308-response.html
http/tests/security/cors-post-redirect-307-pson.html
http/tests/security/cors-post-redirect-308.html
http/tests/security/contentSecurityPolicy/form-action-src-redirect-allowed2.html
http/tests/security/cors-post-redirect-307.html
http/tests/navigation/post-307-response.html
Comment 9 EWS Watchlist 2019-01-19 09:56:40 PST
Created attachment 359614 [details]
Archive of layout-test-results from ews107 for mac-highsierra-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews107  Port: mac-highsierra-wk2  Platform: Mac OS X 10.13.6
Comment 10 EWS Watchlist 2019-01-19 10:18:45 PST
Comment on attachment 359611 [details]
Patch

Attachment 359611 [details] did not pass win-ews (win):
Output: https://webkit-queues.webkit.org/results/10811485

New failing tests:
http/tests/security/contentSecurityPolicy/form-action-src-redirect-allowed.html
http/tests/security/cors-post-redirect-307-pson.html
http/tests/security/contentSecurityPolicy/form-action-src-redirect-allowed2.html
http/tests/security/cors-post-redirect-307.html
http/tests/loading/redirect-methods.html
http/tests/navigation/post-307-response.html
Comment 11 EWS Watchlist 2019-01-19 10:18:56 PST
Created attachment 359615 [details]
Archive of layout-test-results from ews200 for win-future

The attached test failures were seen while running run-webkit-tests on the win-ews.
Bot: ews200  Port: win-future  Platform: CYGWIN_NT-6.1-2.9.0-0.318-5-3-x86_64-64bit
Comment 12 EWS Watchlist 2019-01-19 10:28:38 PST
Comment on attachment 359611 [details]
Patch

Attachment 359611 [details] did not pass mac-debug-ews (mac):
Output: https://webkit-queues.webkit.org/results/10811468

New failing tests:
http/tests/security/contentSecurityPolicy/form-action-src-redirect-allowed.html
http/tests/navigation/post-308-response.html
http/tests/security/cors-post-redirect-307-pson.html
http/tests/security/cors-post-redirect-308.html
http/tests/security/contentSecurityPolicy/form-action-src-redirect-allowed2.html
http/tests/security/cors-post-redirect-307.html
http/tests/loading/redirect-methods.html
http/tests/navigation/post-307-response.html
Comment 13 EWS Watchlist 2019-01-19 10:28:40 PST
Created attachment 359616 [details]
Archive of layout-test-results from ews117 for mac-highsierra

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews117  Port: mac-highsierra  Platform: Mac OS X 10.13.6
Comment 14 EWS Watchlist 2019-01-19 10:42:41 PST
Comment on attachment 359611 [details]
Patch

Attachment 359611 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: https://webkit-queues.webkit.org/results/10811476

New failing tests:
http/tests/security/contentSecurityPolicy/form-action-src-redirect-allowed.html
http/tests/navigation/post-308-response.html
http/tests/security/cors-post-redirect-307-pson.html
http/tests/security/cors-post-redirect-308.html
http/tests/security/contentSecurityPolicy/form-action-src-redirect-allowed2.html
http/tests/security/cors-post-redirect-307.html
http/tests/navigation/post-307-response.html
Comment 15 EWS Watchlist 2019-01-19 10:42:44 PST
Created attachment 359617 [details]
Archive of layout-test-results from ews123 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews123  Port: ios-simulator-wk2  Platform: Mac OS X 10.13.6
Comment 16 Rob Buis 2019-01-19 12:01:55 PST
Created attachment 359618 [details]
Patch
Comment 17 EWS Watchlist 2019-01-19 13:11:02 PST
Comment on attachment 359618 [details]
Patch

Attachment 359618 [details] did not pass mac-ews (mac):
Output: https://webkit-queues.webkit.org/results/10812467

New failing tests:
http/tests/security/cors-post-redirect-307-pson.html
http/tests/security/cors-post-redirect-308.html
http/tests/security/cors-post-redirect-307.html
Comment 18 EWS Watchlist 2019-01-19 13:11:04 PST
Created attachment 359619 [details]
Archive of layout-test-results from ews102 for mac-highsierra

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews102  Port: mac-highsierra  Platform: Mac OS X 10.13.6
Comment 19 EWS Watchlist 2019-01-19 13:23:26 PST
Comment on attachment 359618 [details]
Patch

Attachment 359618 [details] did not pass mac-wk2-ews (mac-wk2):
Output: https://webkit-queues.webkit.org/results/10812482

New failing tests:
http/tests/security/cors-post-redirect-307-pson.html
http/tests/security/cors-post-redirect-308.html
http/tests/security/cors-post-redirect-307.html
Comment 20 EWS Watchlist 2019-01-19 13:23:28 PST
Created attachment 359620 [details]
Archive of layout-test-results from ews107 for mac-highsierra-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews107  Port: mac-highsierra-wk2  Platform: Mac OS X 10.13.6
Comment 21 EWS Watchlist 2019-01-19 13:52:20 PST
Comment on attachment 359618 [details]
Patch

Attachment 359618 [details] did not pass mac-debug-ews (mac):
Output: https://webkit-queues.webkit.org/results/10812523

New failing tests:
http/tests/security/cors-post-redirect-307-pson.html
http/tests/security/cors-post-redirect-308.html
http/tests/security/cors-post-redirect-307.html
Comment 22 EWS Watchlist 2019-01-19 13:52:22 PST
Created attachment 359621 [details]
Archive of layout-test-results from ews112 for mac-highsierra

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews112  Port: mac-highsierra  Platform: Mac OS X 10.13.6
Comment 23 EWS Watchlist 2019-01-19 13:55:50 PST
Comment on attachment 359618 [details]
Patch

Attachment 359618 [details] did not pass win-ews (win):
Output: https://webkit-queues.webkit.org/results/10812592

New failing tests:
http/tests/security/cors-post-redirect-307-pson.html
http/tests/security/cors-post-redirect-307.html
Comment 24 EWS Watchlist 2019-01-19 13:56:02 PST
Created attachment 359622 [details]
Archive of layout-test-results from ews204 for win-future

The attached test failures were seen while running run-webkit-tests on the win-ews.
Bot: ews204  Port: win-future  Platform: CYGWIN_NT-6.1-2.10.0-0.325-5-3-x86_64-64bit
Comment 25 EWS Watchlist 2019-01-19 14:06:41 PST
Comment on attachment 359618 [details]
Patch

Attachment 359618 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: https://webkit-queues.webkit.org/results/10812540

New failing tests:
http/tests/security/cors-post-redirect-307-pson.html
http/tests/security/cors-post-redirect-308.html
http/tests/security/cors-post-redirect-307.html
Comment 26 EWS Watchlist 2019-01-19 14:06:43 PST
Created attachment 359624 [details]
Archive of layout-test-results from ews123 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews123  Port: ios-simulator-wk2  Platform: Mac OS X 10.13.6
Comment 27 Rob Buis 2019-01-20 08:13:23 PST
Created attachment 359638 [details]
Patch
Comment 28 EWS Watchlist 2019-01-20 10:54:28 PST
Comment on attachment 359638 [details]
Patch

Attachment 359638 [details] did not pass win-ews (win):
Output: https://webkit-queues.webkit.org/results/10820274

New failing tests:
http/tests/security/cors-post-redirect-308.html
Comment 29 EWS Watchlist 2019-01-20 10:54:40 PST
Created attachment 359640 [details]
Archive of layout-test-results from ews200 for win-future

The attached test failures were seen while running run-webkit-tests on the win-ews.
Bot: ews200  Port: win-future  Platform: CYGWIN_NT-6.1-2.9.0-0.318-5-3-x86_64-64bit
Comment 30 Rob Buis 2019-01-20 12:59:09 PST
Created attachment 359642 [details]
Patch
Comment 31 EWS Watchlist 2019-01-20 14:55:39 PST
Comment on attachment 359642 [details]
Patch

Attachment 359642 [details] did not pass win-ews (win):
Output: https://webkit-queues.webkit.org/results/10821936

New failing tests:
http/tests/security/cors-post-redirect-308.html
Comment 32 EWS Watchlist 2019-01-20 14:55:51 PST
Created attachment 359654 [details]
Archive of layout-test-results from ews202 for win-future

The attached test failures were seen while running run-webkit-tests on the win-ews.
Bot: ews202  Port: win-future  Platform: CYGWIN_NT-6.1-2.10.0-0.325-5-3-x86_64-64bit
Comment 33 Frédéric Wang (:fredw) 2019-01-21 06:54:49 PST
Comment on attachment 359642 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=359642&action=review

LGTM but do you know why the Windows tests are failing? I wonder if a similar change should be done in windows-specific code.

> LayoutTests/imported/w3c/ChangeLog:8
> +        Update improved test result.

This is also chaning expectations in http/tests/security to match the new behavior.
Comment 34 Rob Buis 2019-01-23 13:03:11 PST
(In reply to Frédéric Wang (:fredw) from comment #33)
> Comment on attachment 359642 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=359642&action=review
> 
> LGTM but do you know why the Windows tests are failing? I wonder if a
> similar change should be done in windows-specific code.

I don't know unfortunately. I assume curl is used here, so I got the sources and did a quick grep for 307 and 308, and could not find any specific code handling that. Basuke would you have an idea how 307 and 308 behavior could be different here?
Comment 35 Basuke Suzuki 2019-01-24 23:53:06 PST
(In reply to Rob Buis from comment #34)
> (In reply to Frédéric Wang (:fredw) from comment #33)
> > Comment on attachment 359642 [details]
> > Patch
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=359642&action=review
> > 
> > LGTM but do you know why the Windows tests are failing? I wonder if a
> > similar change should be done in windows-specific code.
> 
> I don't know unfortunately. I assume curl is used here, so I got the sources
> and did a quick grep for 307 and 308, and could not find any specific code
> handling that. Basuke would you have an idea how 307 and 308 behavior could
> be different here?

The failure is on `apple-win`, not `WinCairo`. They uses apple's CFNetwork.

> The attached test failures were seen while running run-webkit-tests on the win-ews.
> Bot: ews202  Port: win-future  Platform: CYGWIN_NT-6.1-2.10.0-0.325-5-3-x86_64-64bit
Comment 36 Rob Buis 2019-09-01 03:37:11 PDT
Created attachment 377817 [details]
Patch
Comment 37 Rob Buis 2019-09-01 04:48:12 PDT
Created attachment 377819 [details]
Patch
Comment 38 EWS Watchlist 2019-09-01 06:27:16 PDT
Comment on attachment 377819 [details]
Patch

Attachment 377819 [details] did not pass win-ews (win):
Output: https://webkit-queues.webkit.org/results/12989075

New failing tests:
http/tests/security/cors-post-redirect-308.html
Comment 39 EWS Watchlist 2019-09-01 06:27:19 PDT
Created attachment 377821 [details]
Archive of layout-test-results from ews215 for win-future

The attached test failures were seen while running run-webkit-tests on the win-ews.
Bot: ews215  Port: win-future  Platform: CYGWIN_NT-10.0-17763-3.0.5-338.x86_64-x86_64-64bit
Comment 40 Rob Buis 2019-09-22 04:56:23 PDT
Created attachment 379342 [details]
Patch
Comment 41 EWS Watchlist 2019-09-22 06:57:21 PDT
Comment on attachment 379342 [details]
Patch

Attachment 379342 [details] did not pass win-ews (win):
Output: https://webkit-queues.webkit.org/results/13058589

New failing tests:
http/tests/security/cors-post-redirect-308.html
Comment 42 EWS Watchlist 2019-09-22 06:57:24 PDT
Created attachment 379345 [details]
Archive of layout-test-results from ews210 for win-future

The attached test failures were seen while running run-webkit-tests on the win-ews.
Bot: ews210  Port: win-future  Platform: CYGWIN_NT-10.0-17763-3.0.5-338.x86_64-x86_64-64bit
Comment 43 Rob Buis 2019-12-18 05:34:14 PST
Created attachment 385964 [details]
Patch
Comment 44 Rob Buis 2019-12-30 11:45:38 PST
Created attachment 386542 [details]
Patch
Comment 45 Rob Buis 2019-12-31 03:15:39 PST
Created attachment 386552 [details]
Patch
Comment 46 Rob Buis 2019-12-31 05:18:29 PST
Created attachment 386557 [details]
Patch
Comment 47 youenn fablet 2020-01-03 01:23:48 PST
Comment on attachment 386557 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=386557&action=review

> Source/WebCore/loader/SubresourceLoader.cpp:612
> +        request.setHTTPOrigin(m_origin->toString());

The description of the bug is just about adding a null header value but this method is setting the origin header even though m_origin is not changed.
Is it expected? Are we covering that case?
Also, the method name is appendOriginIfNeeded. appendOriginHeaderIfNeeded would be better.
Even with that change, the name could be improved since we are actually setting/overriding the origin header.

> Source/WebCore/loader/SubresourceLoader.cpp:649
> +    appendOriginIfNeeded(newRequest, redirectResponse.tainting() == ResourceResponse::Tainting::Cors, redirectingToNewOrigin && crossOriginFlag);

Step 10 is only about setting the tainted origin flag, not setting the origin header.
We are now changing the logic when we set m_origin to a unique origin which might be good.
I am wondering whether we should use FrameLoader::addHTTPOriginIfNeeded.
Comment 48 Rob Buis 2020-03-12 04:14:31 PDT
*** Bug 201127 has been marked as a duplicate of this bug. ***
Comment 49 Rob Buis 2020-03-13 01:13:17 PDT
Created attachment 393465 [details]
Patch
Comment 50 Rob Buis 2020-03-13 02:57:01 PDT
Created attachment 393469 [details]
Patch
Comment 51 youenn fablet 2020-03-13 05:52:53 PDT
Comment on attachment 393469 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=393469&action=review

> Source/WebCore/loader/SubresourceLoader.cpp:660
> +        newRequest.setHasTaintedOrigin(true);

Do we need has tainted origin at all (except to get closer to fetch spec)?
If we are setting m_origin to be unique in the next line, the call below to FrameLoader::addHTTPOriginIfNeeded should end up setting "null" value to the origin header.
Comment 52 Rob Buis 2020-03-13 06:05:41 PDT
Comment on attachment 393469 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=393469&action=review

>> Source/WebCore/loader/SubresourceLoader.cpp:660
>> +        newRequest.setHasTaintedOrigin(true);
> 
> Do we need has tainted origin at all (except to get closer to fetch spec)?
> If we are setting m_origin to be unique in the next line, the call below to FrameLoader::addHTTPOriginIfNeeded should end up setting "null" value to the origin header.

No, it is not absolutely needed, and I did it mostly to follow the spec indeed. In the spec it makes sense since the redirect sets things up for a new main fetch, but I think we do not do such explicit fetch calls in WebKit. Also I added the addHTTPOriginIfNeeded call since the Cors specific block already sets the Origin header. So I would be fine with removing the explicit tainted origin flag code.
Comment 53 Rob Buis 2020-03-13 09:45:35 PDT
Created attachment 393492 [details]
Patch
Comment 54 youenn fablet 2020-03-13 10:43:26 PDT
Comment on attachment 393492 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=393492&action=review

> Source/WebCore/loader/FrameLoader.cpp:3005
> +    // FIXME: take referrer-policy into account.

Maybe file a bug or provide a pointer to the spec so that it is clear what should be done here.
Comment 55 Rob Buis 2020-03-13 10:51:41 PDT
Created attachment 393505 [details]
Patch
Comment 56 WebKit Commit Bot 2020-03-13 12:50:38 PDT
Comment on attachment 393505 [details]
Patch

Rejecting attachment 393505 [details] from commit-queue.

Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', '--status-host=webkit-queues.webkit.org', '--bot-id=webkit-cq-03', 'validate-changelog', '--check-oops', '--non-interactive', 393505, '--port=mac']" exit_code: 1 cwd: /Volumes/Data/EWS/WebKit

ChangeLog entry in LayoutTests/ChangeLog contains OOPS!.

Full output: https://webkit-queues.webkit.org/results/13340870
Comment 57 WebKit Commit Bot 2020-03-13 13:32:04 PDT
Comment on attachment 393505 [details]
Patch

Rejecting attachment 393505 [details] from commit-queue.

Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', '--status-host=webkit-queues.webkit.org', '--bot-id=webkit-cq-02', 'validate-changelog', '--check-oops', '--non-interactive', 393505, '--port=mac']" exit_code: 1 cwd: /Volumes/Data/EWS/WebKit

ChangeLog entry in LayoutTests/ChangeLog contains OOPS!.

Full output: https://webkit-queues.webkit.org/results/13340918
Comment 58 Rob Buis 2020-03-13 23:48:51 PDT
Created attachment 393580 [details]
Patch
Comment 59 WebKit Commit Bot 2020-03-14 03:22:56 PDT
Comment on attachment 393580 [details]
Patch

Clearing flags on attachment: 393580

Committed r258465: <https://trac.webkit.org/changeset/258465>
Comment 60 WebKit Commit Bot 2020-03-14 03:22:59 PDT
All reviewed patches have been landed.  Closing bug.
Comment 61 Darin Adler 2020-03-15 13:25:16 PDT
Comment on attachment 393580 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=393580&action=review

I really appreciate all the work you are doing on this.

> Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegate.cpp:141
> -    if (httpMessage && CFHTTPMessageGetResponseStatusCode(httpMessage) == 307) {
> +    if (httpMessage && (CFHTTPMessageGetResponseStatusCode(httpMessage) == 307 || CFHTTPMessageGetResponseStatusCode(httpMessage) == 308)) {

A little messy that this calls CFHTTPMessageGetResponseStatusCode twice. Makes the code both hard to read since the line is so long and one additional function call to another framework. I have an idea how to make this prettier. I’d write this helper function:

    static Optional<CFIndex> statusCode(CFURLResponseRef response)
    {
        auto message = CFURLResponseGetHTTPResponse(response);
        if (!message)
            return WTF::nullopt;
        return CFHTTPMessageGetResponseStatusCode(httpMessage);
    }

Then we can just write:

    auto code = statusCode(redirectResponse);
    if (code == 307 || code == 308) {
        ...

Or we can be less pedantic and write this without adding a function:

    auto message = CFURLResponseGetHTTPResponse(response);
    auto code = message ? CFHTTPMessageGetResponseStatusCode(httpMessage) : 0;
    if (code == 307 || code == 308) {
        ...

I can’t look at code like this without wishing we’d crunched it a bit to make it easier to read.