summaryrefslogtreecommitdiff
path: root/Lib/http/client.py
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2017-02-09 16:09:03 +0100
committerNick Coghlan <ncoghlan@gmail.com>2017-02-09 16:09:03 +0100
commit2a1d833d5da7fa7a01a2eef183b0a208ed019427 (patch)
tree8da3ebb695ae55c69d0a58691403fb13d96a9476 /Lib/http/client.py
parentc6180bb73c8c7c7f9d8ea9816487b710597b6fc1 (diff)
parentbbd3587a29510bd5a318e0a19fc8570c0cd3b622 (diff)
downloadcpython-2a1d833d5da7fa7a01a2eef183b0a208ed019427.tar.gz
Merge issue #26355 fix from 3.6
Diffstat (limited to 'Lib/http/client.py')
-rw-r--r--Lib/http/client.py10
1 files changed, 1 insertions, 9 deletions
diff --git a/Lib/http/client.py b/Lib/http/client.py
index a8e59b9561..0234199dfa 100644
--- a/Lib/http/client.py
+++ b/Lib/http/client.py
@@ -72,7 +72,6 @@ import email.parser
import email.message
import http
import io
-import os
import re
import socket
import collections
@@ -642,14 +641,7 @@ class HTTPResponse(io.BufferedIOBase):
return self._read1_chunked(n)
if self.length is not None and (n < 0 or n > self.length):
n = self.length
- try:
- result = self.fp.read1(n)
- except ValueError:
- if n >= 0:
- raise
- # some implementations, like BufferedReader, don't support -1
- # Read an arbitrarily selected largeish chunk.
- result = self.fp.read1(16*1024)
+ result = self.fp.read1(n)
if not result and n:
self._close_conn()
elif self.length is not None: