[issue5714] CGIHTTPServer._url_collapse_path_split should live elsewhere
Mark Lawrence added the comment: 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 :-( -- nosy: +BreamoreBoy versions: +Python 3.5 -Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5714 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5714] CGIHTTPServer._url_collapse_path_split should live elsewhere
Changes by Terry J. Reedy tjre...@udel.edu: -- versions: +Python 3.3 -Python 2.7, Python 3.1 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5714 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5714] CGIHTTPServer._url_collapse_path_split should live elsewhere
Senthil orsent...@gmail.com added the comment: Yes, the parsing best be done in urlparse. As this function claims to do step 6 of RFC2396, I am surprised why it cannot be done by using existing urlparse functions itself.(Because, the tests for RFC2396 compliance covers those cases too). -- nosy: +orsenthil ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5714 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5714] CGIHTTPServer._url_collapse_path_split should live elsewhere
Leonid Vasilev vsleo...@gmail.com added the comment: I'd Wrote a patch for this. Perhaps some unittests are needed. -- keywords: +patch nosy: +chin Added file: http://bugs.python.org/file13644/issue5714_withdoc.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5714 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5714] CGIHTTPServer._url_collapse_path_split should live elsewhere
R. David Murray rdmur...@bitdance.com added the comment: Yes, unit tests are always needed for any change. Gregory, why is a function that does two things (collapse and split) a good candidate for a public API? It results in a pretty awkward name :) I'm not saying it's necessarily a bad idea, just looking for motivation. -- components: +Library (Lib) nosy: +r.david.murray stage: - test needed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5714 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5714] CGIHTTPServer._url_collapse_path_split should live elsewhere
Leonid Vasilev vsleo...@gmail.com added the comment: 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'. I think CGIHTTPServer._url_collapse_path_split is just a customized version of latter, and should be rewritten using 'urlparse.urlsplit'. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5714 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5714] CGIHTTPServer._url_collapse_path_split should live elsewhere
Gregory P. Smith g...@krypto.org added the comment: urlparse.urljoin and urlparse.urlsplit do not do what is required for this function. urljoin does not collapse paths. urlsplit has nothing to do with paths. I agree r.david.murray that it is odd that it does two functions at once (the collapse and the split). I wrote it specifically for its current use case when checking paths to cgi scripts. The unittests for it describe the exact behavior it needs to implement. Trying to implement a separate collapse function is approximately the same amount of code because the edge cases such as '/a/b/' and '/a/b/c/..' which both need to result in it returning ('/a/b', '') instead of ('/a', 'b') are why it made sense to keep as a single function for its current use. Unittests for the function already exist in Lib/test/test_httpservers.py to describe its full behavior. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5714 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5714] CGIHTTPServer._url_collapse_path_split should live elsewhere
New submission from Gregory P. Smith g...@krypto.org: CGIHTTPServer._url_collapse_path_split should probably live in a more general library and become a documented API. Perhaps in urlparse? -- keywords: easy messages: 85679 nosy: gregory.p.smith priority: normal severity: normal status: open title: CGIHTTPServer._url_collapse_path_split should live elsewhere type: feature request versions: Python 2.7, Python 3.1 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5714 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com