Ticket #190: patch_request.diff-u

File patch_request.diff-u, 1.4 KB (added by Ben, 17 years ago)
Line 
1--- client.py   2003-08-10 03:00:47.000000000 +0200
2+++ client.py   2003-08-10 02:58:40.000000000 +0200
3@@ -54,6 +54,8 @@
4 
5     def handleStatus(self, version, status, message):
6         self.version, self.status, self.message = version, status, message
7+        if self.factory.statusrequested:
8+            self.factory.gotStatus(version, status, message)
9 
10     def handleEndHeaders(self):
11         self.factory.gotHeaders(self.headers)
12@@ -133,10 +135,11 @@
13 
14     protocol = HTTPPageGetter
15 
16-    def __init__(self, host, url, method='GET', postdata=None, headers=None, agent="Twisted PageGetter", timeout=0):
17+    def __init__(self, host, url, method='GET', postdata=None, headers=None, agent="Twisted PageGetter", timeout=0, statusrequested=0):
18         self.timeout = timeout
19         self.agent = agent
20         self.url = url
21+        self.statusrequested = statusrequested
22 
23         self.cookies = {}
24         if headers is not None:
25@@ -169,9 +172,12 @@
26                 cookparts = cookie.split(';')
27                 for cook in cookparts:
28                     cook.lstrip()
29-                    k, v = cook.split('=')
30+                    k, v = cook.split('=', 1)
31                     self.cookies[k.lstrip()] = v.lstrip()
32 
33+    def gotStatus(self, version, status, message):
34+        self.version, self.status, self.message = version, status, message       
35+
36     def page(self, page):
37         if self.waiting:
38             self.waiting = 0