summaryrefslogtreecommitdiffstats
path: root/Lib/httplib.py
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2001-02-01 23:35:20 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2001-02-01 23:35:20 (GMT)
commit42dd01add5cc53dc5a5eab46b04b44c8ef6c969f (patch)
tree3df3f376a6246daf649d5cb078a145f29efe409f /Lib/httplib.py
parent0072d5aa33eb84cb17e63d4dee255e1d1262f52e (diff)
downloadcpython-42dd01add5cc53dc5a5eab46b04b44c8ef6c969f.zip
cpython-42dd01add5cc53dc5a5eab46b04b44c8ef6c969f.tar.gz
cpython-42dd01add5cc53dc5a5eab46b04b44c8ef6c969f.tar.bz2
An ssl-wrapped socket now returns '' on EOF, just like a regular
socket -- as suggested by Clarence Gardner. Fix httplib to comply with the new ssl-socket interface.
Diffstat (limited to 'Lib/httplib.py')
-rw-r--r--Lib/httplib.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/Lib/httplib.py b/Lib/httplib.py
index 4750685..6c3b5e0 100644
--- a/Lib/httplib.py
+++ b/Lib/httplib.py
@@ -575,13 +575,16 @@ class FakeSocket:
if mode != 'r' and mode != 'rb':
raise UnimplementedFileMode()
- msgbuf = ""
+ msgbuf = []
while 1:
try:
- msgbuf = msgbuf + self.__ssl.read()
+ buf = self.__ssl.read()
except socket.sslerror, msg:
break
- return StringIO(msgbuf)
+ if buf == '':
+ break
+ msgbuf.append(buf)
+ return StringIO("".join(msgbuf))
def send(self, stuff, flags = 0):
return self.__ssl.write(stuff)
@@ -809,6 +812,7 @@ def test():
if hasattr(socket, 'ssl'):
host = 'sourceforge.net'
+ selector = '/projects/python'
hs = HTTPS()
hs.connect(host)
hs.putrequest('GET', selector)