Skip to content

Ensure curl headers are not overwritten but merged in special case. #915

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

Closed
wants to merge 2 commits into from

Conversation

swizzlr
Copy link
Contributor

@swizzlr swizzlr commented Mar 9, 2017

#637 introduced a subtle bug – easyHandle.set(customHeaders: [String]) is a straight overwrite, not a merge. This can induce all kinds of headache inducing complexity into an app. Furthermore, it also prevented the curlHeadersToRemove/Set functionality from working, leading to undesirable Expect header assignment.

This PR resolves the issue by merging in a Content-Type header in the special case.

I know it's late in the day but this is really the sort of thing we could do with in 3.1 release.

@parkera
Copy link
Contributor

parkera commented Mar 9, 2017

Do we have the change in the master branch yet?

@swizzlr
Copy link
Contributor Author

swizzlr commented Mar 9, 2017

Oh bloody hell, I never remember which way round this is meant to be. I'll land it in the morning.

Concept wise, this ok?

@parkera
Copy link
Contributor

parkera commented Mar 10, 2017

Seems reasonable; cc @mamabusi

@pushkarnk
Copy link
Member

This was a good find. The fix looks good too.

@swizzlr Once you have a PR on the master, we can merge both.

@swizzlr swizzlr mentioned this pull request Mar 10, 2017
@swizzlr
Copy link
Contributor Author

swizzlr commented Mar 10, 2017

@pushkarnk @parkera there you go!

@alblue
Copy link
Contributor

alblue commented Mar 10, 2017

@swift-ci please test

1 similar comment
@swizzlr
Copy link
Contributor Author

swizzlr commented Mar 13, 2017

@swift-ci please test

@swizzlr
Copy link
Contributor Author

swizzlr commented Mar 13, 2017

:(

Copy link
Contributor

@alblue alblue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a conflict marker in this change.

XCTAssert(task.isEqual(task.copy()))
}
<<<<<<< HEAD
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks bad.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bollocks

@swizzlr
Copy link
Contributor Author

swizzlr commented Mar 14, 2017

@alblue fixed!

@pushkarnk
Copy link
Member

The related PR on the master was merged. Once we are done with the code review here, we can merge this.

@pushkarnk
Copy link
Member

pushkarnk commented Mar 14, 2017

I see the tests for test_taskCancel and test_taskTimeout in the patch. I don't think we have cherry-picked #689 and #911 on 3.1. Can you please take a look @swizzlr ? May be we should just cherry-pick the commit related to #915 here ? Thanks :)

@alblue
Copy link
Contributor

alblue commented Mar 14, 2017 via email

@pushkarnk
Copy link
Member

Any updates on this one?

@swizzlr
Copy link
Contributor Author

swizzlr commented Apr 12, 2017

@pushkarnk sorted

@pushkarnk
Copy link
Member

Thanks @swizzlr

However, I still see some unrelated code in TestNSURLSession in the patch viz. the tests:

+            ("test_cancelTask", test_cancelTask),
+            ("test_taskTimeout", test_taskTimeout),

These are related to #911 and #689 which haven't been cherry picked to 3.1 yet. I can see that these come from the commit that added the test case, but I'm not sure how I could help with that.

@ianpartridge
Copy link
Contributor

@swizzlr @pushkarnk I think this is still important, yeah?

@pushkarnk
Copy link
Member

The related commit was cherry-picked to 3.1 as a part of #970

I am closing this PR. Thanks!

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.

5 participants