Skip to content

Commit

Permalink
use mimetools; add close()
Browse files Browse the repository at this point in the history
  • Loading branch information
gvanrossum committed Aug 7, 1995
1 parent e780877 commit 65ab98c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Lib/httplib.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import string
import regex
import regsub
import rfc822
import mimetools

HTTP_VERSION = 'HTTP/1.0'
HTTP_PORT = 80
Expand All @@ -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):
Expand Down Expand Up @@ -90,12 +91,17 @@ def getreply(self):
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
Expand Down

0 comments on commit 65ab98c

Please sign in to comment.