[issue11898] Sending binary data with a POST request in httplib can cause Unicode exceptions

2011-07-04 Thread Éric Araujo
Changes by Éric Araujo : -- Removed message: http://bugs.python.org/msg134878 ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue11898] Sending binary data with a POST request in httplib can cause Unicode exceptions

2011-06-25 Thread Senthil Kumaran
Senthil Kumaran added the comment: Hi Sorin, On Sat, Jun 25, 2011 at 07:54:24PM +, sorin wrote: > type(message_body) is str ... even if I tried to manually force > Python for use bytes. It seams that in 2.7 bytes are alias to str. > Due to this the code will fail to run only on 2.7 because i

[issue11898] Sending binary data with a POST request in httplib can cause Unicode exceptions

2011-06-25 Thread sorin
sorin added the comment: I have to add some details here. First, this bug has nothing to do with the URL, it does reproduce for normal urls. Still the problem with the line: "msg += message_body" is quite complex when combined with Python 2.7: type(msg) is unicode type(message_body) is str

[issue11898] Sending binary data with a POST request in httplib can cause Unicode exceptions

2011-06-24 Thread Terry J. Reedy
Terry J. Reedy added the comment: Soren, this is an issue that claimed a bug, not a bug. The resolution is that the claim appears false because the problem arose from using unicode rather than bytes url. The error message may be confusing, but the error class cannot be changed. Senthil says t

[issue11898] Sending binary data with a POST request in httplib can cause Unicode exceptions

2011-06-24 Thread sorin
sorin added the comment: Added as bug http://bugs.python.org/issue12398 -- ___ Python tracker ___ ___ Python-bugs-list mailing list U

[issue11898] Sending binary data with a POST request in httplib can cause Unicode exceptions

2011-06-24 Thread Senthil Kumaran
Senthil Kumaran added the comment: Sorin, can you please open another report with more details and how some condition in httplib breaks PyAMF. We will see through that it is fixed. Commenting on an invalid closed issue is confusing. -- ___ Python t

[issue11898] Sending binary data with a POST request in httplib can cause Unicode exceptions

2011-06-24 Thread sorin
sorin added the comment: There is another problem that makes the problem even more critical. OS X 10.7 does include Python 2.7.1 as the *default* interpreter. So we'll need both a fix for the future and an workaround. BTW, the hack with sys.setdefaultencoding cannot be used if you really send

[issue11898] Sending binary data with a POST request in httplib can cause Unicode exceptions

2011-06-24 Thread sorin
sorin added the comment: Can we get more info regarding resolution of this bug. Due to this bug httplib cannot be used anymore to send binary data. This bug breaks other modules, one example being PyAMF (that does communicate only using binary data). -- nosy: +sorin _

[issue11898] Sending binary data with a POST request in httplib can cause Unicode exceptions

2011-06-10 Thread Terry J. Reedy
Terry J. Reedy added the comment: should *not* be reopened. Sorry for omission of 'not'. -- ___ Python tracker ___ ___ Python-bugs-li

[issue11898] Sending binary data with a POST request in httplib can cause Unicode exceptions

2011-06-10 Thread Terry J. Reedy
Terry J. Reedy added the comment: Ion, as you perhaps noticed, posting a message 'subscribes' you (puts you on the nosy list). One can also add oneself as nosy with the little button under it without saying anything. This should be reopened because we do not change error classes in bugfix re

[issue11898] Sending binary data with a POST request in httplib can cause Unicode exceptions

2011-06-10 Thread Ion Scerbatiuc
Ion Scerbatiuc added the comment: Hello again, After some digging I found that the "real" problem was because the provided URL was a unicode string and the concatenation was failing. Maybe this is not a big deal, but I think we should least do a proper assertion for the provided URL or some

[issue11898] Sending binary data with a POST request in httplib can cause Unicode exceptions

2011-06-10 Thread Ion Scerbatiuc
Ion Scerbatiuc added the comment: Hello, I would like to subscribe to the issue. The problem seems to indeed exist in Python 2.7. What I'm doing is to proxy HTTP requests (using Django) and the PUT / POST requests are working fine on Python 2.6 but are failing on 2.7 with the error already

[issue11898] Sending binary data with a POST request in httplib can cause Unicode exceptions

2011-05-15 Thread Senthil Kumaran
Senthil Kumaran added the comment: The bug was about sending Binary "data" via httplib. In the example you wrote, you are sending a unicode "url" and experiencing a failure for certain examples. In the 2.7, the urls should be str type, we don't have function to deal with unicode url separately

[issue11898] Sending binary data with a POST request in httplib can cause Unicode exceptions

2011-05-15 Thread Jiri Horky
Jiri Horky added the comment: I have the same problem as the original submitter. The reason it previously worked for you was probably because you didn't utilize a "right" unicode string in the urllib2.request. The following code will raise the exception (I enclose the data file for completene

[issue11898] Sending binary data with a POST request in httplib can cause Unicode exceptions

2011-05-06 Thread Senthil Kumaran
Senthil Kumaran added the comment: Hello Bernhard, I tried to a POST of JPEG file, through urllib2 (which internally uses httplib) and goes through the code that you pointed out and I don't face any problem. I am able to POST binaries using httplib. I am also surprised at UnicodeDecodeError

[issue11898] Sending binary data with a POST request in httplib can cause Unicode exceptions

2011-04-30 Thread Éric Araujo
Éric Araujo added the comment: > Not sure how to get it into verbose mode See http://diveintopython.org/http_web_services/debugging.html -- nosy: +eric.araujo ___ Python tracker __

[issue11898] Sending binary data with a POST request in httplib can cause Unicode exceptions

2011-04-29 Thread Bernhard Rosenkraenzer
Bernhard Rosenkraenzer added the comment: Not sure how to get it into verbose mode (I presume you don't mean "python -v"), but normal mode (22 tests) works fine: Python 2.7.1 (r271:86832, Apr 22 2011, 13:40:40) [GCC 4.6.0] on linux2 Type "help", "copyright", "credits" or "license" for more in

[issue11898] Sending binary data with a POST request in httplib can cause Unicode exceptions

2011-04-29 Thread Terry J. Reedy
Terry J. Reedy added the comment: Did you run the httplib test with your patch? Interactively >>> from test.test_httplib import test_main as f; f() (verbose mode, over 40 tests) In 3.x, the patch would be to http/client.py, line 802 in 3.2 release if isinstance(message_body, str) # becomes if i

[issue11898] Sending binary data with a POST request in httplib can cause Unicode exceptions

2011-04-21 Thread Santoso Wijaya
Changes by Santoso Wijaya : -- nosy: +santa4nt ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pyth

[issue11898] Sending binary data with a POST request in httplib can cause Unicode exceptions

2011-04-21 Thread Ezio Melotti
Changes by Ezio Melotti : -- nosy: +ezio.melotti, orsenthil ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: htt

[issue11898] Sending binary data with a POST request in httplib can cause Unicode exceptions

2011-04-21 Thread Bernhard Rosenkraenzer
New submission from Bernhard Rosenkraenzer : Sending e.g. a JPEG file with a httplib POST request (e.g. through mechanize) can result in an error like this: File "/usr/lib64/python2.7/httplib.py", line 947, in request self._send_request(method, url, body, headers) File "/usr/lib64/pytho