Skip to content

std.net.curl: fix maxRedirects() interpretation of uint.max#11021

Open
foutaise wants to merge 1 commit into
dlang:masterfrom
foutaise:master
Open

std.net.curl: fix maxRedirects() interpretation of uint.max#11021
foutaise wants to merge 1 commit into
dlang:masterfrom
foutaise:master

Conversation

@foutaise
Copy link
Copy Markdown

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.

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.
@foutaise foutaise requested a review from CyberShadow as a code owner May 24, 2026 10:54
@dlang-bot
Copy link
Copy Markdown
Contributor

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 verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the coverage diff by visiting the details link of the codecov check)
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

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 references

Your 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 locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "master + phobos#11021"

@CyberShadow
Copy link
Copy Markdown
Member

As this would be a breaking change, I think improving the documentation is the correct action here.

@foutaise
Copy link
Copy Markdown
Author

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?

Set max allowed redirections using the location header.
uint.max to disable redirections.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants