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-13028] URLSession does not call willPerformHTTPRedirection #3980

Closed
swift-ci opened this issue Jun 16, 2020 · 1 comment
Closed

[SR-13028] URLSession does not call willPerformHTTPRedirection #3980

swift-ci opened this issue Jun 16, 2020 · 1 comment

Comments

@swift-ci
Copy link
Contributor

Previous ID SR-13028
Radar None
Original Reporter agisboye (JIRA User)
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Environment

macOS:
Swift 5.2.4 (Xcode 11.5)

Linux:
Swift 5.2.4 docker image

Additional Detail from JIRA
Votes 0
Component/s Foundation
Labels Bug
Assignee None
Priority Medium

md5: 722661d520eea8c76e9fd65692e87838

Issue Description:

When the swift-corelibs-foundation version of URLSession encounters a redirect, it does not call the appropriate delegate method:

urlSession(_ session: URLSession, task: URLSessionTask, willPerformHTTPRedirection response: HTTPURLResponse, newRequest request: URLRequest, completionHandler: @escaping (URLRequest?) -> Void)

This only occurs when using a completionHandler-based task. If the task is created without a completionHandler, the delegate method is called.
On Darwin platforms, however, the delegate method is called in both cases.

Steps to reproduce:

I've included a simple Node.js HTTP server to demonstrate the issue.

Use URLSession to request a URL:
http://localhost:8989/first

The server will redirect from /first to /second.

Expected result:

The `willPerformHTTPRedirection` delegate method is called when URLSession performs a completionHandler-based task that results in a redirect.

Actual result:

Darwin:
The delegate method is called.

Linux:
The delegate method is not called.

@spevans
Copy link
Collaborator

spevans commented Jan 17, 2021

#2974

@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
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

2 participants