-
-
Notifications
You must be signed in to change notification settings - Fork 90
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
WIP: Bypass URI as path only if absolute for OPTIONS #74
Conversation
Fix cherrypy/cherrypy#1662
@bertjwregeer @josephtate @jaraco Could you please share your opinion regarding RFC compliance? |
Codecov Report
@@ Coverage Diff @@
## master #74 +/- ##
==========================================
- Coverage 76.87% 76.35% -0.52%
==========================================
Files 24 24
Lines 3770 3769 -1
==========================================
- Hits 2898 2878 -20
- Misses 872 891 +19 |
That change looks fine to me from a RFC perspective. |
@bertjwregeer thanks. |
Here's what I think:
|
I'm okay with this change. Will be good to stabilize the behavior reported in the ticket. |
Actually, I'm not okay with it now:) But haven't had time to put a new patch together |
This comment has been minimized.
This comment has been minimized.
I would be sad to see this issue/PR fall off the radar since it's caused us to pin CherryPy to an older version in our downstream project (https://github.com/girder/girder/). Seeing as how the related issue has broken long lived expectations of CherryPy's handling of OPTIONS requests, is it possible to get this patched in the meantime? |
@danlamanna I need to re-do this patch in order to have it merged. I just didn't have time for this. I wish there were more maintainers who could help. |
This comment has been minimized.
This comment has been minimized.
Stale bot... go away. This is still an issue. |
Now bot won't close it with actual |
@jaraco should we think of deferring HTTP parsing to https://github.com/python-hyper/h11? |
Hi, today I encountered this issue also using cherrypy and just trying to use query params... |
@fviard You're going to end up using a version of cheroot that is not RFC compliant, so you might have some user agents that misbehave and/or introduce yourself to various vulnerabilities. |
cheroot/server.py
Outdated
if self.method == b'OPTIONS': | ||
# TODO: cover this branch with tests | ||
path = ( | ||
uri | ||
# https://tools.ietf.org/html/rfc7230#section-5.3.4 | ||
if self.proxy_mode or uri == ASTERISK | ||
if (self.proxy_mode and uri_is_absolute_form) | ||
or uri == ASTERISK |
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'm pretty sure this line can be eliminated as urllib.parse.urlsplit('*').path == '*'
anyway.
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.
Removed in dc9592b.
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.
@jaraco where did you see urllib.parse.urlsplit('*').path == '*'
?
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.
Because I don't see any code checking for ASTERISK
now.
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 think that this change is wrong. And the problem with this PR was this hack: https://github.com/cherrypy/cherrypy/blob/535605c/cherrypy/_cpwsgi_server.py#L31
It was temporary until this PR's figured out (cherrypy/cherrypy@c87bc9f). We should revert it to proxy_mode=False
now and see if it's ok.
FTR I recall there have been some corner cases there in conjunction with CherryPy. |
I'm not sure whether it's right from the RFC point of view, but this allows to put path w/o query-string into PATH_INFO in case of origin-form.
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Bug fix (possibly)
What is the related issue number (starting with
#
)cherrypy/cherrypy#1662
What is the current behavior? (You can also link to an open issue here)
PATH_INFO in WSGI env is assigned URI as is if proxy is enabled.
What is the new behavior (if this is a feature change)?
PATH_INFO is assigned to path part if URI is not absolute.
This change is