summaryrefslogtreecommitdiffstats
path: root/Lib/httplib.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1995-08-07 20:13:02 (GMT)
committerGuido van Rossum <guido@python.org>1995-08-07 20:13:02 (GMT)
commit65ab98c42788057488cd923f7cc0b0c6373c05e3 (patch)
tree020067e594b9e59f3d804e8086e0f738505344e0 /Lib/httplib.py
parente7808778d6200ad94fdcae1e797262f5a78048ee (diff)
downloadcpython-65ab98c42788057488cd923f7cc0b0c6373c05e3.zip
cpython-65ab98c42788057488cd923f7cc0b0c6373c05e3.tar.gz
cpython-65ab98c42788057488cd923f7cc0b0c6373c05e3.tar.bz2
use mimetools; add close()
Diffstat (limited to 'Lib/httplib.py')
-rw-r--r--Lib/httplib.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/Lib/httplib.py b/Lib/httplib.py
index 1bb6bf2..68c9d8b 100644
--- a/Lib/httplib.py
+++ b/Lib/httplib.py
@@ -33,7 +33,7 @@ import socket
import string
import regex
import regsub
-import rfc822
+import mimetools
HTTP_VERSION = 'HTTP/1.0'
HTTP_PORT = 80
@@ -46,6 +46,7 @@ class HTTP:
def __init__(self, host = '', port = 0):
self.debuglevel = 0
+ self.file = None
if host: self.connect(host, port)
def set_debuglevel(self, debuglevel):
@@ -90,12 +91,17 @@ class HTTP:
errcode, errmsg = replyprog.group(1, 2)
errcode = string.atoi(errcode)
errmsg = string.strip(errmsg)
- self.headers = rfc822.Message(self.file, 0)
+ self.headers = mimetools.Message(self.file, 0)
return errcode, errmsg, self.headers
def getfile(self):
return self.file
+ def close(self):
+ if self.file:
+ self.file.close()
+ self.file = None
+
def test():
import sys