summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorKjetil Jacobsen <kjetilja@gmail.com>2005-05-19 08:39:35 +0000
committerKjetil Jacobsen <kjetilja@gmail.com>2005-05-19 08:39:35 +0000
commit08e34fb7d53c7ef61faf55a4006060ce57d69a5d (patch)
tree6746c35c21d281b59fa842a6b082f13862724992 /python
parente9b4205f8259614dfb1f0f95ae19d383a388a1b3 (diff)
downloadpycurl-08e34fb7d53c7ef61faf55a4006060ce57d69a5d.tar.gz
- fix header handling
Diffstat (limited to 'python')
-rw-r--r--python/curl/__init__.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/python/curl/__init__.py b/python/curl/__init__.py
index 40f7406..13001f2 100644
--- a/python/curl/__init__.py
+++ b/python/curl/__init__.py
@@ -26,7 +26,7 @@ class Curl:
self.fakeheaders = fakeheaders
# Nothing past here should be modified by the caller.
self.payload = ""
- self.header = StringIO()
+ self.hrd = ""
# Verify that we've got the right site; harmless on a non-SSL connect.
self.set_option(pycurl.SSL_VERIFYHOST, 2)
# Follow redirects in case it wants to take us to a CGI...
@@ -44,7 +44,7 @@ class Curl:
self.payload += x
self.set_option(pycurl.WRITEFUNCTION, payload_callback)
def header_callback(x):
- self.header.write(x)
+ self.hdr += x
self.set_option(pycurl.HEADERFUNCTION, header_callback)
def set_timeout(self, timeout):
@@ -70,8 +70,8 @@ class Curl:
self.set_option(pycurl.HTTPHEADER, self.fakeheaders)
if relative_url:
self.set_option(pycurl.URL,os.path.join(self.base_url,relative_url))
- self.header.seek(0,0)
self.payload = ""
+ self.hdr = ""
self.handle.perform()
return self.payload
@@ -94,7 +94,7 @@ class Curl:
def header(self):
"Return the header from the last response."
- return self.header.getvalue()
+ return self.hdr
def get_info(self, *args):
"Get information about retrieval."
@@ -141,9 +141,8 @@ class Curl:
def close(self):
"Close a session, freeing resources."
if self.handle: self.handle.close()
- if self.header: self.header.close()
self.handle = None
- self.header = None
+ self.hdr = ""
self.payload = ""
def __del__(self):