diff options
Diffstat (limited to 'Lib/httplib.py')
| -rw-r--r-- | Lib/httplib.py | 8 | 
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/httplib.py b/Lib/httplib.py index c7d8e781df..bb4b59e701 100644 --- a/Lib/httplib.py +++ b/Lib/httplib.py @@ -546,7 +546,13 @@ class HTTPResponse:                  i = line.find(';')                  if i >= 0:                      line = line[:i] # strip chunk-extensions -                chunk_left = int(line, 16) +                try: +                    chunk_left = int(line, 16) +                except ValueError: +                    # close the connection as protocol synchronisation is +                    # probably lost +                    self.close() +                    raise IncompleteRead(value)                  if chunk_left == 0:                      break              if amt is None:  | 
