Fix wsgi invalid request uri#4551
Conversation
99e5faf to
a1ca22a
Compare
|
Hi @emdneto, seems that these changes are now breaking some Falcon tests. Should I do something like |
I would fix the Falcon tests instead, since the target is no longer used to parse the path and query. Because of that, Also, please fix precommit by running |
…Dragos2003/opentelemetry-python-contrib into fix-wsgi-invalid-request-uri
|
Thanks for the PR! Just a heads-up: we no longer update Please add the appropriate changelog fragment for this change instead of editing |
48f6b40 to
6f6c160
Compare
tammy-baylis-swi
left a comment
There was a problem hiding this comment.
Lgtm and adheres to PEP 333.
| } | ||
| expected_new = { | ||
| URL_PATH: "/3/library/urllib.parse.html", | ||
| URL_PATH: "/", |
There was a problem hiding this comment.
Last comment: i believe here you'll have to set PATH_INFO to get the correct path instead
There was a problem hiding this comment.
Hi,
I hope I added this correctly. I am on holidays and added this quickly on my phone ..
I can look at this once I am back. Thank you
Add PATH_INFO to the environment for CONNECT request.
Description
Fixes #4447
WSGI Instrumentation currently parses
RAW_URI/REQUEST_URIto deriveurl.path&url.query.Malformed request URIs can causeurllib.parse.urlparseto raise aValueError, which breaks instrumentation and may result in a 500 response.This change avoids parsing the raw request URI and instead derives
url.pathandurl.querydirectly from the WSGI environ (PATH_INFO and QUERY_STRING).Type of change
How Has This Been Tested?
Ran tests:
uv run python -m pytest instrumentation/opentelemetry-instrumentation-wsgi/tests
All tests pass.
Does This PR Require a Core Repo Change?
Checklist: