std.net.curl: fix maxRedirects() interpretation of uint.max#11021
std.net.curl: fix maxRedirects() interpretation of uint.max#11021foutaise wants to merge 1 commit into
Conversation
maxRedirects(uint maxRedirs) specify in its documentation string that uint.max can be used for infinite redirection. But in the code, when a uint.max value is used, redirects are disabled, by setting CurlOption.followlocation to 0. This PR switch off redirection if maxRedirs is equal to 0, and allow redirections up to maxRedirs otherwise.
|
Thanks for your pull request and interest in making D better, @foutaise! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please see CONTRIBUTING.md for more information. If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment. Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub run digger -- build "master + phobos#11021" |
|
As this would be a breaking change, I think improving the documentation is the correct action here. |
I'm afraid you're right. Something like this? |
maxRedirects(uint maxRedirs) specify in its documentation string that uint.max can be used for infinite redirection.
But in the code, when a uint.max value is used, redirects are disabled, by setting CurlOption.followlocation to 0.
This PR switch off redirection if maxRedirs is equal to 0, and allow redirections up to maxRedirs otherwise.