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

cheroot.server.Server() does not correctly parse the request_uri and set the query string. #38

bertjwregeer opened this Issue Jul 11, 2017 · 0 comments


None yet
2 participants

bertjwregeer commented Jul 11, 2017

  • I'm submitting a bug report

  • What is the current behavior?

Unfortunately the code is broken and doesn't correctly set self.qs.


Lines 709 to 724 in 60ec5b6

scheme, authority, path = self.parse_request_uri(uri)
if path is None:
self.simple_response('400 Bad Request',
'Invalid path in Request-URI.')
return False
if NUMBER_SIGN in path:
self.simple_response('400 Bad Request',
'Illegal #fragment in Request-URI.')
return False
if scheme:
self.scheme = scheme
qs = EMPTY
if QUESTION_MARK in path:
path, qs = path.split(QUESTION_MARK, 1)

Does not currently correct parse the reques_uri and set self.qs.

Anyone using cheroot with CherryPy will not have environ['QUERY_STRING'] set correctly, which was fun to debug.

  • What is the expected behavior?

To parse the request_uri correctly and set self.qs so that it may be set in the WSGI environ.

  • What is the motivation / use case for changing the behavior?

urlparse will not return the query string in the path, so it needs to be appended again, or returned from parse_request_uri, then the check on line

if QUESTION_MARK in path:
will no longer be necessary.

  • Please tell us about your environment:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment