-
-
Notifications
You must be signed in to change notification settings - Fork 62
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
Breaking change from 0.9.10 to 0.9.11 due to #240 (presumably) #250
Comments
Thanks for filing such a detailed reproduction of the issue! I'll take a look as soon as I can. You're right that this is almost certainly a regression from #240. |
Found the issue -- calling Again, thanks for bringing this to my attention quickly. I will push a patch release tonight with the fix. |
Awesome, thanks so much for the quick fix! ---- On Wed, 11 Nov 2020 14:20:44 +1300 [email protected] wrote ----
Found the issue -- calling redirect_policy on an individual request builder works, but the configuration wasn't reaching the redirect interceptor when being called on the client builder. I've added a test for this to ensure this mistake isn't made again in the future. Fix is in #251.
Again, thanks for bringing this to my attention quickly. I will push a patch release tonight with the fix.
—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or unsubscribe.
|
Erm. I'm sorry to report that it doesn't seem to have been fixed:
Same test code. |
Hmm, I added a test case to ensure that it was fixed. Perhaps the test case isn't quite the same as your example. I will take another look. |
OK, it looks like I did fix a bug in #251 that was affecting this, but there is also a separate bug at work here. The key is that the first 302 response includes a non-zero response body. In my test it did not. If the first response that returns a redirect location returns a body, it looks like that I will fix this by having Isahc parse the |
Previously we were relying on curl to resolve the redirect location with `CURLINFO_REDIRECT_URL`, but this value is only populated once the response body stream has been consumed and the handle is complete. This means that redirects were working properly if the response containing the redirect had an empty body, but not if a nonempty body is included. Since we don't really want to wait for the response body to be consumed before we decide whether we should redirect or not, change the redirect interceptor to derive the redirect location ourselves. Since the algorithm is nontrivial, pull in the `url` crate to do this resolution. Also add a test for following redirects when response bodies are present to catch this bug. Fixes #250.
Previously we were relying on curl to resolve the redirect location with `CURLINFO_REDIRECT_URL`, but this value is only populated once the response body stream has been consumed and the handle is complete. This means that redirects were working properly if the response containing the redirect had an empty body, but not if a nonempty body is included. Since we don't really want to wait for the response body to be consumed before we decide whether we should redirect or not, change the redirect interceptor to derive the redirect location ourselves. Since the algorithm is nontrivial, pull in the `url` crate to do this resolution. Also add a test for following redirects when response bodies are present to catch this bug. Fixes #250.
#240 rewrote the redirect implementation away from curl. I noticed that this broke redirects in my use case.
Test code:
The URL issues a 302 redirect.
Output with isahc 0.9.10
Output with isahc 0.9.11
The text was updated successfully, but these errors were encountered: