You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Summary:
When using a custom NSURLProtocol subclass to intercept HTTP requests, NSURLSession sometimes ignores 302 redirects and instead returns the 302 response or no response whatsoever. No error is returned.
If the NSURLSessionTaskDelegate artificially introduces a delay in URLSession: task: willPerformHTTPRedirection: ..., the bug is no longer reproducible.
Steps to Reproduce:
Run the unit tests in the attached sample project. On average, the redirection without delay fails 1-2 times per test run. The redirection with a delay introduced by usleep(500) has not yet failed.
If you do not observe any test failures on the first run, please try once or twice more. If you observe the delayed tests failing, please try increasing the usleep parameter.
Expected Results:
NSURLSession should always follow 302 redirects and return the contents of the final URL, or else it should return an error.
Actual Results:
Randomly, the 302 is not followed and instead the body of the original response is returned. No error is returned.
Version/Build:
macOS 10.13.4 (17E199)
The issue has been known and reproducible since August 2016 as seen in this OHHTTPStubs bug report: AliSoftware/OHHTTPStubs#230
Description
Area:
Foundation
Summary:
When using a custom NSURLProtocol subclass to intercept HTTP requests, NSURLSession sometimes ignores 302 redirects and instead returns the 302 response or no response whatsoever. No error is returned.
If the NSURLSessionTaskDelegate artificially introduces a delay in URLSession: task: willPerformHTTPRedirection: ..., the bug is no longer reproducible.
Steps to Reproduce:
Run the unit tests in the attached sample project. On average, the redirection without delay fails 1-2 times per test run. The redirection with a delay introduced by usleep(500) has not yet failed.
If you do not observe any test failures on the first run, please try once or twice more. If you observe the delayed tests failing, please try increasing the usleep parameter.
Expected Results:
NSURLSession should always follow 302 redirects and return the contents of the final URL, or else it should return an error.
Actual Results:
Randomly, the 302 is not followed and instead the body of the original response is returned. No error is returned.
Version/Build:
macOS 10.13.4 (17E199)
The issue has been known and reproducible since August 2016 as seen in this OHHTTPStubs bug report:
AliSoftware/OHHTTPStubs#230
Product Version: 10.13.4
Created: 2018-04-12T20:17:57.172350
Originated: 2018-04-12T00:00:00
Open Radar Link: http://www.openradar.me/39391319
The text was updated successfully, but these errors were encountered: