-
Notifications
You must be signed in to change notification settings - Fork 557
ref(wsgi): Update _werkzeug vendor to newer version #4793
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
ref(wsgi): Update _werkzeug vendor to newer version #4793
Conversation
host = host[:-3] | ||
elif scheme in {"https", "wss"} and host.endswith(":443"): | ||
host = host[:-4] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 Here werkzeug have a condition for trusted hosts: https://github.com/pallets/werkzeug/blob/3.1.3/src/werkzeug/sansio/utils.py#L98
Why we don't use it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume because we're only using the get_host
function to reconstruct the request URL and not any actual functionality.
host = f"[{host}]" | ||
|
||
if server[1] is not None: | ||
host = f"{host}:{server[1]}" # noqa: E231 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎗️ I had to define this because of:
E231 missing whitespace after ':'
75b9810
to
dab33fb
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4793 +/- ##
==========================================
- Coverage 84.47% 83.41% -1.07%
==========================================
Files 158 158
Lines 16506 16512 +6
Branches 2865 2864 -1
==========================================
- Hits 13944 13773 -171
- Misses 1712 1889 +177
Partials 850 850
|
ba2c350
to
6238c21
Compare
return None | ||
|
||
try: | ||
port = int(environ.get("SERVER_PORT", None)) # type: ignore[arg-type] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This # type
was introduced in main branch not in 3.1.3
Thanks for the PR @mgaligniana -- I think the |
6238c21
to
b4ee7ae
Compare
( | ||
environ.get("HTTP_HOST") | ||
if not use_x_forwarded_for | ||
else environ.get("HTTP_X_FORWARDED_HOST") | ||
), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎗️ The previous condition was: if use_x_forwarded_for and "HTTP_X_FORWARDED_HOST" in environ:
But if we have use_x_forwarded_for
in True
doesn't mean HTTP_X_FORWARDED_HOST
will be present?
Ok, Seer 🎉 liked! But codecov not, should I add new tests for the new vendor? Edited: I think yes because Anton said:
But do you think I should copy-paste the test from werkzeug to get_host for example? |
Fixes GH-3516