Repository navigation
Set RAW_URI in the WSGI environ - #928
Open
blarghmatey wants to merge 1 commit into
Open
blarghmatey wants to merge 1 commit into
blarghmatey wants to merge 1 commit into
Conversation
PATH_INFO is percent-decoded, so the request target as sent was not available anywhere in the environ. gunicorn exposes it as RAW_URI, and opentelemetry-instrumentation-wsgi reads it before falling back to wsgiref.util.request_uri(), which raises on Django apps once a path holds a codepoint above U+00FF. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017Uj5u2SZz2LzrTff5TaM6y
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Close #927
Adds
RAW_URIto the WSGI environ: the request's path and query as sent, still percent-encoded, decoded as latin-1 the same wayQUERY_STRINGalready is. I used the gunicorn key rather thanREQUEST_URIbecauseopentelemetry-instrumentation-wsgichecksRAW_URIfirst.One difference from gunicorn: gunicorn puts the whole request-line target in
RAW_URI, so an absolute-formGET http://host/pathor a#fragmentcomes through verbatim. Here it'spath_and_query(), so those give/path. For the middleware that reads it, that's the part they want.test_raw_uricovers a percent-encoded non-ASCII path with an encoded%2F:PATH_INFOis decoded,RAW_URIkeeps the escapes. It fails without the change incallbacks.rs.🤖 Generated with Claude Code
https://claude.ai/code/session_017Uj5u2SZz2LzrTff5TaM6y