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
http.server._url_collapse_path should live elsewhere #49964
Comments
CGIHTTPServer._url_collapse_path_split should probably live in a more |
I'd Wrote a patch for this. Perhaps some unittests are needed. |
Yes, unit tests are always needed for any change. Gregory, why is a function that does two things (collapse and split) a I'm not saying it's necessarily a bad idea, just looking for motivation. |
Actually urlparse.urljoin implements RFC 2396 Is it true that 'CGIHTTPServer._url_collapse_path_split' is just a
inverted 'urlparse.urljoin' ?
"""
>>> urlparse.urljoin('http://a/b/c/','g')
'http://a/b/c/g'
>>> urlparse.url_collapse_path_split('http://a/b/c/g')
('/http:/a/b/c', 'g')
>>> urlparse.urlsplit('http://a/b/c/g')
SplitResult(scheme='http', netloc='a', path='/b/c/g', query='', fragment='')
""" And there is existing function 'urlparse.urlsplit'. |
urlparse.urljoin and urlparse.urlsplit do not do what is required for I agree r.david.murray that it is odd that it does two functions at once The unittests for it describe the exact behavior it needs to implement. Unittests for the function already exist in Lib/test/test_httpservers.py |
Yes, the parsing best be done in urlparse. As this function claims to do step 6 of RFC2396, I am surprised why it |
I've tried investigating this but I've got lost so I'll have to pass the buck. I've got confused because of the code moving around in Python 2 and the library changes going to Python 3 :-( |
Some ideas for this sort of function (or perhaps a few related functions):
Also, see the SimpleHTTPRequestHandler.translate_path() method, and bpo-14567. There seems to be a lot of redundancy. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: