diff options
author | Guido van Rossum <guido@python.org> | 1995-06-22 18:48:48 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1995-06-22 18:48:48 (GMT) |
commit | 4cdcef7e2974f27751d3ce7591b09fa8ee5a09b7 (patch) | |
tree | 161f53fde30d848446c7e3e51c9f71639b0b5bcf | |
parent | 2d95706f689876c930f3fc130df7da273569d52d (diff) | |
download | cpython-4cdcef7e2974f27751d3ce7591b09fa8ee5a09b7.zip cpython-4cdcef7e2974f27751d3ce7591b09fa8ee5a09b7.tar.gz cpython-4cdcef7e2974f27751d3ce7591b09fa8ee5a09b7.tar.bz2 |
discard endrequest(); minor stuff; rfc822 no seek flag
-rw-r--r-- | Lib/httplib.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/Lib/httplib.py b/Lib/httplib.py index 362b38d..1bb6bf2 100644 --- a/Lib/httplib.py +++ b/Lib/httplib.py @@ -12,6 +12,7 @@ # >>> h.putreqest('GET', '/index.html') # >>> h.putheader('Accept', 'text/html') # >>> h.putheader('Accept', 'text/plain') +# >>> h.endheaders() # >>> errcode, errmsg, headers = h.getreply() # >>> if errcode == 200: # ... f = h.getfile() @@ -67,6 +68,7 @@ class HTTP: self.sock.send(str) def putrequest(self, request, selector): + if not selector: selector = '/' str = '%s %s %s\r\n' % (request, selector, HTTP_VERSION) self.send(str) @@ -77,13 +79,9 @@ class HTTP: def endheaders(self): self.send('\r\n') - def endrequest(self): - if self.debuglevel > 0: print 'shutdown: 1' - self.sock.shutdown(1) - def getreply(self): - self.endrequest() self.file = self.sock.makefile('r') + self.sock = None line = self.file.readline() if self.debuglevel > 0: print 'reply:', `line` if replyprog.match(line) < 0: @@ -92,7 +90,7 @@ class HTTP: errcode, errmsg = replyprog.group(1, 2) errcode = string.atoi(errcode) errmsg = string.strip(errmsg) - self.headers = rfc822.Message(self.file) + self.headers = rfc822.Message(self.file, 0) return errcode, errmsg, self.headers def getfile(self): |