Skip to content

Various Cookie fixes #1700

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 24, 2018
Merged

Various Cookie fixes #1700

merged 1 commit into from
Sep 24, 2018

Conversation

maksimorlovich
Copy link
Contributor

  • Add support for additional Set-Cookie formats that web servers can return
  • Properly handle HTTP header parsing to extract values since values can contain colons
  • Make sure to set cookies on redirect requests
  • Use setValue instead of addValue when applying cookies to requests otherwise,
    Cookie header might contain: cookie1=value1,cookie1=value1; cookie2=value2
  • New unit tests for cookie formats and redirect with Set-Cookie

- Add support for additional Set-Cookie formats that web servers can return
- Properly handle HTTP header parsing to extract values since values can contain colons
- Make sure to set cookies on redirect requests
- Use setValue instead of addValue when applying cookies to requests otherwise,
  Cookie header might contain: cookie1=value1,cookie1=value1; cookie2=value2
- New unit tests for cookie formats and redirect with Set-Cookie
@maksimorlovich
Copy link
Contributor Author

@mamabusi, @ianpartridge, @spevans, please kindly review this change. Thank you! :)

@spevans
Copy link
Contributor

spevans commented Sep 20, 2018

@swift-ci test

@maksimorlovich
Copy link
Contributor Author

@swift-ci, could this please be retested? Looks like the build failed in files not touched by my commit... Thanks!

@spevans
Copy link
Contributor

spevans commented Sep 20, 2018

@swift-ci test

@maksimorlovich
Copy link
Contributor Author

@spevans, looks like this is not a new failure, older PR #1697, and newer PR #1701 fail the same way on macOS.

@parkera
Copy link
Contributor

parkera commented Sep 20, 2018

Glad to see we're actually testing on macOS now. We can merge this if others approve and address those separately.

@maksimorlovich
Copy link
Contributor Author

@mamabusi, @ianpartridge, could I please get a review? Thanks!

@ianpartridge
Copy link
Contributor

This all looks sensible to me, but I can't comment on compatibility with Darwin. Does Foundation on Darwin support the extra Set-Cookie formats, for example?

@maksimorlovich
Copy link
Contributor Author

@ianpartridge, yes, I checked against swift 4.2 release on Darwin and indeed it does support these four cookie formats. Thanks!

@mamabusi
Copy link
Contributor

LGTM.
Thanks @maksimorlovich

@ianpartridge
Copy link
Contributor

@swift-ci please test and merge

@swift-ci swift-ci merged commit 771f525 into swiftlang:master Sep 24, 2018
@maksimorlovich
Copy link
Contributor Author

Thanks @mamabusi and @ianpartridge!

@ianpartridge, I would like to get this into the next 4.2.x release. Is swift-4.2-branch the correct one for the 4.2.x release? Thanks!

@ianpartridge
Copy link
Contributor

Yes I think so - @parkera can confirm that that branch is still accepting fixes.

@jrose-apple
Copy link
Contributor

It looks like this broke Ubuntu 14.04; please fix that first! https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-14_04/5915/

@maksimorlovich
Copy link
Contributor Author

@jrose-apple, the compiler error appears to be unrelated to my changes:
clang: error: no such file or directory: 'tools/SourceKit/tools/sourcekitd/bin/InProc/CMakeFiles/sourcekitdInProc.dir/sourcekitdInProc.cpp.o'

Looks like a setup issue? I'm surprised Ubuntu 16.04 builds just fine.

@jrose-apple
Copy link
Contributor

No, that's an unrelated error we haven't tracked down, but not a fatal one. Here's the actual error:

04:09:27 Test Case 'TestHTTPCookie.test_cookieExpiresDateFormats' started at 2018-09-25 09:09:20.681
04:09:27 TestFoundation/TestHTTPCookie.swift:190: error: TestHTTPCookie.test_cookieExpiresDateFormats : XCTAssertEqual failed: ("Optional(0020-01-01 12:30:00 +0000)") is not equal to ("Optional(2020-01-01 12:30:00 +0000)") - 
04:09:27 Test Case 'TestHTTPCookie.test_cookieExpiresDateFormats' failed (0.006 seconds)
04:09:27 Test Suite 'TestHTTPCookie' failed at 2018-09-25 09:09:20.687
04:09:27 	 Executed 8 tests, with 1 failure (0 unexpected) in 0.02 (0.02) seconds

@ianpartridge
Copy link
Contributor

@jrose-apple do we need to revert this PR while we figure out the 14.04 test failure?

@spevans
Copy link
Contributor

spevans commented Sep 26, 2018

Given the use of dates in the tests, it could be ICU on 14.04 causing problems. The usual fix is to disable the tests

@maksimorlovich
Copy link
Contributor Author

@jrose-apple, sorry I didn't catch this error. I will have a fix shortly. Thanks for your help in identifying the failure!

@maksimorlovich
Copy link
Contributor Author

@jrose-apple, here's the fix for Ubuntu 14.04: #1707 Thanks! Can swift-ci test on Ubuntu 14.04 please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants