Skip to content
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

[SR-12300] URLSession.dataTask doesn't follow redirects with lowercased location #3267

Closed
TellowKrinkle opened this issue Feb 29, 2020 · 2 comments
Assignees

Comments

@TellowKrinkle
Copy link

Previous ID SR-12300
Radar rdar://problem/59976651
Original Reporter @TellowKrinkle
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Foundation
Labels Bug
Assignee @spevans
Priority Medium

md5: 7cc67aef6373bd171e5f79a397b8d348

relates to:

  • SR-3252 URLSession dataTask doesn't follow redirects

Issue Description:

HTTP headers are supposed to be case insensitive

In Open Source Foundation, if the HTTP server responds with a 302 and the location field has "location" (and not "Location"), the redirect won't be followed

Note that macOS Foundation solves this by normalizing the header fields dictionary:

let resp = HTTPURLResponse(url: URL(string: "http://localhost")!, statusCode: 300, httpVersion: nil, headerFields: ["location": "http://google.com"])!
print(resp.allHeaderFields)

On macOS this prints:

[AnyHashable("Location"): http://google.com]

On Linux this prints:

[AnyHashable("location"): "http://google.com"]
@hborla
Copy link
Member

hborla commented Mar 3, 2020

@swift-ci create

@spevans
Copy link
Collaborator

spevans commented Mar 15, 2020

#2728

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 5, 2022
valyano added a commit to adaptyteam/AdaptySDK-iOS that referenced this issue Dec 8, 2023
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants