classification
Title: httplib _read_chunked TypeError ||| i = line.find(";")
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.0
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: georg.brandl, orivej
Priority: normal Keywords: easy

Created on 2008-01-25 00:03 by orivej, last changed 2008-01-26 09:46 by georg.brandl. This issue is now closed.

Messages (3)
msg61659 - (view) Author: Orivej Desh (orivej) * Date: 2008-01-25 00:03
(With current python3-svn)
While trying to response.read() got this:

---
  File "/usr/lib/python3.0/httplib.py", line 533, in read
    return self._read_chunked(amt)
  File "/usr/lib/python3.0/httplib.py", line 573, in _read_chunked
    i = line.find(";")
TypeError: expected an object with the buffer interface
---

To debug I did this:
---
 line = self.fp.readline()
+print(' ***', line)
 i = line.find(b";")
---
and got "*** b'2e6d\r\n'" followed by those TypeError exception.
I did this:
---
    def _read_chunked(self, amt):
        assert self.chunked != _UNKNOWN
        chunk_left = self.chunk_left
-       value = ""
+       value = b""

            if chunk_left is None:
                line = self.fp.readline()
-               i = line.find(";")
+               i = line.find(b";")
---
And it seems to work.
msg61660 - (view) Author: Orivej Desh (orivej) * Date: 2008-01-25 00:05
Sorry, while debugging there was no 'b':
---
 line = self.fp.readline()
+print(' ***', line)
 i = line.find(";")
---
msg61703 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2008-01-26 09:46
Fixed in r60315. Thanks!
History
Date User Action Args
2008-01-26 09:46:16georg.brandlsetstatus: open -> closed
resolution: fixed
messages: + msg61703
nosy: + georg.brandl
2008-01-25 11:12:37christian.heimessetpriority: normal
keywords: + easy
type: behavior
2008-01-25 00:05:42orivejsetmessages: + msg61660
2008-01-25 00:03:27orivejcreate