[issue23328] urllib2 fails for proxy credentials that contain a '/' character

2015-03-06 Thread Demian Brecht
Changes by Demian Brecht : -- nosy: +demian.brecht ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail

[issue23328] urllib2 fails for proxy credentials that contain a '/' character

2015-02-09 Thread Martin Panter
Martin Panter added the comment: This should demonstrate that Curl does parse literal slashes in the username and password fields: $ http_proxy=http://user/name:pass/word@localhost:22 curl -v http://example.net/ * Trying ::1... * Connected to localhost (::1) port 22 (#0) * Proxy auth using Ba

[issue23328] urllib2 fails for proxy credentials that contain a '/' character

2015-02-09 Thread Senthil Kumaran
Senthil Kumaran added the comment: In the initial report, I thought, it was mentioned that curl reads the same http_proxy variable properly. It will be good to have a correct curl test case to ascertain that. But, at all the places, where @ character is allowed in urls (netrc, git configs,

[issue23328] urllib2 fails for proxy credentials that contain a '/' character

2015-02-09 Thread Martin Panter
Martin Panter added the comment: To comply with the RFC on URLs, whoever is setting the environment variable _should_ do the encoding, and then Python will _decode_ it. But I suspect this case is more about how Python should handle an environment variable that hasn’t been encoded correctly. -

[issue23328] urllib2 fails for proxy credentials that contain a '/' character

2015-02-09 Thread Andy Reitz
Andy Reitz added the comment: Sure, but the question is who should do the encoding -- the user, or python? I think it would be better for python to read the password from the environment variable, and encode it before using it. I think this is what users expect. -- ___

[issue23328] urllib2 fails for proxy credentials that contain a '/' character

2015-02-09 Thread Panagiotis Issaris
Panagiotis Issaris added the comment: RFC3986 seems to state that a '/' character should be encoded: """... reserved= gen-delims / sub-delims gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@" sub-delims = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "="

[issue23328] urllib2 fails for proxy credentials that contain a '/' character

2015-02-08 Thread Martin Panter
Martin Panter added the comment: The relevant code looks like it is _parse_proxy() at Lib/urllib/request.py:693. It has custom code to search for a slash (/), so it wouldn’t be hard to make it search after the last at (@) symbol. (I previously assumed it would use urlsplit() or similar, which

[issue23328] urllib2 fails for proxy credentials that contain a '/' character

2015-02-08 Thread Andy Reitz
Andy Reitz added the comment: The proxy credentials are supplied by our sysadmin. My understanding is that the http_proxy env variable doesn't require URI encoding. In addition, the same credentials work fine with curl. -- ___ Python tracker

[issue23328] urllib2 fails for proxy credentials that contain a '/' character

2015-02-08 Thread Martin Panter
Martin Panter added the comment: Related: Issue 18140. The slash character is meant to be a reserved character in URLs, so why hasn’t it been encoded? Where does the environment variable come from? -- nosy: +vadmium ___ Python tracker

[issue23328] urllib2 fails for proxy credentials that contain a '/' character

2015-01-27 Thread Senthil Kumaran
Senthil Kumaran added the comment: Yup, can confirm that this is problem. As Andy recognized, there is parsing error that fails on '/' character in the password. The environ based proxies are used by urllib rather than urllib2. (The test case if relies on environ proxy, should use urllib.urlop

[issue23328] urllib2 fails for proxy credentials that contain a '/' character

2015-01-26 Thread Andy Reitz
Andy Reitz added the comment: Sorry, went a bit too quickly -- here is the sample code that I meant to use: import os, urllib2 os.environ['http_proxy'] = "http://someuser:a/b@10.11.12.13:1234"; f = urllib2.urlopen('http://www.python.org') data = f.read() print data And the stack trace

[issue23328] urllib2 fails for proxy credentials that contain a '/' character

2015-01-26 Thread Andy Reitz
New submission from Andy Reitz: On Python 2.7.9, if I set an https_proxy environment variable, where the password contains a '/' character, urllib2 fails. Given this test code: import os, urllib os.environ['http_proxy'] = "http://someuser:a/b@10.11.12.13:1234"; f = urllib.urlopen('http://