summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/httplib.py10
-rw-r--r--Modules/socketmodule.c11
2 files changed, 11 insertions, 10 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)
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index b3571a5..9b6300c 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -2165,17 +2165,14 @@ static PyObject *SSL_SSLread(SSLObject *self, PyObject *args)
res = SSL_get_error(self->ssl, count);
switch (res) {
- case 0: /* Good return value! */
+ case SSL_ERROR_NONE:
+ assert(count > 0);
break;
- case 6:
- PyErr_SetString(SSLErrorObject, "EOF");
- Py_DECREF(buf);
- return NULL;
+ case SSL_ERROR_ZERO_RETURN: /* normal EOF */
+ assert(count == 0);
break;
- case 5:
default:
return PyErr_SetFromErrno(SSLErrorObject);
- break;
}
fflush(stderr);