RESOLVED FIXED 186030
Set Origin header value to null rather than omitting it
https://bugs.webkit.org/show_bug.cgi?id=186030
Summary Set Origin header value to null rather than omitting it
Anne van Kesteren
Reported 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.
Attachments
Patch (5.17 KB, patch)
2019-01-18 11:29 PST, Rob Buis
no flags
Patch (9.47 KB, patch)
2019-01-19 08:32 PST, Rob Buis
no flags
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
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
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
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
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
Patch (9.56 KB, patch)
2019-01-19 12:01 PST, Rob Buis
no flags
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
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
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
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
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
Patch (11.74 KB, patch)
2019-01-20 08:13 PST, Rob Buis
no flags
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
Patch (11.74 KB, patch)
2019-01-20 12:59 PST, Rob Buis
no flags
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
Patch (13.71 KB, patch)
2019-09-01 03:37 PDT, Rob Buis
no flags
Patch (13.69 KB, patch)
2019-09-01 04:48 PDT, Rob Buis
no flags
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
Patch (13.68 KB, patch)
2019-09-22 04:56 PDT, Rob Buis
no flags
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
Patch (13.67 KB, patch)
2019-12-18 05:34 PST, Rob Buis
no flags
Patch (15.05 KB, patch)
2019-12-30 11:45 PST, Rob Buis
no flags
Patch (12.35 KB, patch)
2019-12-31 03:15 PST, Rob Buis
no flags
Patch (11.55 KB, patch)
2019-12-31 05:18 PST, Rob Buis
no flags
Patch (10.99 KB, patch)
2020-03-13 01:13 PDT, Rob Buis
no flags
Patch (12.15 KB, patch)
2020-03-13 02:57 PDT, Rob Buis
no flags
Patch (7.77 KB, patch)
2020-03-13 09:45 PDT, Rob Buis
no flags
Patch (7.83 KB, patch)
2020-03-13 10:51 PDT, Rob Buis
no flags
Patch (7.90 KB, patch)
2020-03-13 23:48 PDT, Rob Buis
no flags
Radar WebKit Bug Importer
Comment 1 2018-05-31 12:11:54 PDT
Brent Fulgham
Comment 2 2019-01-03 10:15:01 PST
We should recheck these results now that Bug 182644 has been merged.
youenn fablet
Comment 3 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.
Rob Buis
Comment 4 2019-01-18 11:29:33 PST
Rob Buis
Comment 5 2019-01-19 08:32:04 PST
EWS Watchlist
Comment 6 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
EWS Watchlist
Comment 7 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
EWS Watchlist
Comment 8 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
EWS Watchlist
Comment 9 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
EWS Watchlist
Comment 10 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
EWS Watchlist
Comment 11 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
EWS Watchlist
Comment 12 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
EWS Watchlist
Comment 13 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
EWS Watchlist
Comment 14 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
EWS Watchlist
Comment 15 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
Rob Buis
Comment 16 2019-01-19 12:01:55 PST
EWS Watchlist
Comment 17 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
EWS Watchlist
Comment 18 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
EWS Watchlist
Comment 19 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
EWS Watchlist
Comment 20 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
EWS Watchlist
Comment 21 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
EWS Watchlist
Comment 22 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
EWS Watchlist
Comment 23 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
EWS Watchlist
Comment 24 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
EWS Watchlist
Comment 25 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
EWS Watchlist
Comment 26 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
Rob Buis
Comment 27 2019-01-20 08:13:23 PST
EWS Watchlist
Comment 28 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
EWS Watchlist
Comment 29 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
Rob Buis
Comment 30 2019-01-20 12:59:09 PST
EWS Watchlist
Comment 31 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
EWS Watchlist
Comment 32 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
Frédéric Wang (:fredw)
Comment 33 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.
Rob Buis
Comment 34 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?
Basuke Suzuki
Comment 35 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
Rob Buis
Comment 36 2019-09-01 03:37:11 PDT
Rob Buis
Comment 37 2019-09-01 04:48:12 PDT
EWS Watchlist
Comment 38 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
EWS Watchlist
Comment 39 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
Rob Buis
Comment 40 2019-09-22 04:56:23 PDT
EWS Watchlist
Comment 41 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
EWS Watchlist
Comment 42 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
Rob Buis
Comment 43 2019-12-18 05:34:14 PST
Rob Buis
Comment 44 2019-12-30 11:45:38 PST
Rob Buis
Comment 45 2019-12-31 03:15:39 PST
Rob Buis
Comment 46 2019-12-31 05:18:29 PST
youenn fablet
Comment 47 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.
Rob Buis
Comment 48 2020-03-12 04:14:31 PDT
*** Bug 201127 has been marked as a duplicate of this bug. ***
Rob Buis
Comment 49 2020-03-13 01:13:17 PDT
Rob Buis
Comment 50 2020-03-13 02:57:01 PDT
youenn fablet
Comment 51 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.
Rob Buis
Comment 52 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.
Rob Buis
Comment 53 2020-03-13 09:45:35 PDT
youenn fablet
Comment 54 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.
Rob Buis
Comment 55 2020-03-13 10:51:41 PDT
WebKit Commit Bot
Comment 56 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
WebKit Commit Bot
Comment 57 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
Rob Buis
Comment 58 2020-03-13 23:48:51 PDT
WebKit Commit Bot
Comment 59 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>
WebKit Commit Bot
Comment 60 2020-03-14 03:22:59 PDT
All reviewed patches have been landed. Closing bug.
Darin Adler
Comment 61 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.
Note You need to log in before you can comment on or make changes to this bug.