Skip to content

requests: Add support for relative redirect URLs.#1128

Merged
dpgeorge merged 1 commit into
micropython:masterfrom
dpgeorge:requests-support-relative-redirect
Jul 7, 2026
Merged

requests: Add support for relative redirect URLs.#1128
dpgeorge merged 1 commit into
micropython:masterfrom
dpgeorge:requests-support-relative-redirect

Conversation

@dpgeorge

Copy link
Copy Markdown
Member

Summary

A redirection URL in the "Location:" header may be relative and start with a "/". Handle such cases.

Testing

Added a unit test that runs under CI.

Also tested the case in #1127 and it now works.

Generative AI

Not used.

@o-murphy

Copy link
Copy Markdown

@dpgeorge
Does it resolves both /../ and /./ subpaths?

@dpgeorge

Copy link
Copy Markdown
Member Author

Does it resolves both /../ and /./ subpaths?

Yes.

It's not actually about the path, it's about the server responding with a redirect that normalises the path, and that redirect is relative instead of starting with https://.

A redirection URL in the "Location:" header may be relative and start with
a "/".  Handle such cases.

Signed-off-by: Damien George <damien@micropython.org>
@dpgeorge dpgeorge force-pushed the requests-support-relative-redirect branch from 9fd4522 to 8b7a02e Compare July 7, 2026 02:09
@dpgeorge dpgeorge merged commit 8b7a02e into micropython:master Jul 7, 2026
5 checks passed
@dpgeorge dpgeorge deleted the requests-support-relative-redirect branch July 7, 2026 02:15
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.

2 participants