/[straw]/straw/src/lib/httplib_async.py
ViewVC logotype

Diff of /straw/src/lib/httplib_async.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.10 by juri, Mon Jun 16 17:32:12 2003 UTC revision 1.11 by jmalonzo, Fri Oct 17 08:03:44 2003 UTC
# Line 12  from error import log Line 12  from error import log
12    
13  class HTTPConnection_async(asyncore.dispatcher_with_send):  class HTTPConnection_async(asyncore.dispatcher_with_send):
14      # asynchronous http client      # asynchronous http client
15      def __init__(self, host, ip, port, consumer, sock=None, map=None,      def __init__(self, host, ip, port, consumer, sock=None, map=None, proxy=None):
                  proxy=None):  
16          asyncore.dispatcher_with_send.__init__(self)          asyncore.dispatcher_with_send.__init__(self)
17    
18          if ip == None:          if ip is None:
19              ip = host              ip = host
20          self.ip = ip          self.ip = ip
21          self.host = host          self.host = host
# Line 42  class HTTPConnection_async(asyncore.disp Line 41  class HTTPConnection_async(asyncore.disp
41          if self.proxy and self.proxy_port:          if self.proxy and self.proxy_port:
42              self.path = "http://%s%s" % (self.host, path)              self.path = "http://%s%s" % (self.host, path)
43          self._initialize_chunked()          self._initialize_chunked()
44          send_data.append(          send_data.append("%s %s %s\r\n" % (self.method, self.path, self.http_version))
             "%s %s %s\r\n" % (self.method, self.path, self.http_version))  
45          host_found = 0          host_found = 0
46          cl_found = 0          cl_found = 0
47          for h, v in headers.items():          for h, v in headers.items():
# Line 115  class HTTPConnection_async(asyncore.disp Line 113  class HTTPConnection_async(asyncore.disp
113    
114              self.data = data              self.data = data
115              if self.status[1] in (301, 302):              if self.status[1] in (301, 302):
116                  self.consumer.http_redirect(self.header.getheader('location'),                  self.consumer.http_redirect(self.header.getheader('location'),self.status[1] == 301)
                                             self.status[1] == 301)  
117                  self.close()                  self.close()
118                  return                  return
119              elif self.header.getheader(              elif self.header.getheader('transfer-encoding', '').lower() == 'chunked':
                 'transfer-encoding', '').lower() == 'chunked':  
120                  self._initialize_chunked(1)                  self._initialize_chunked(1)
121              else:              else:
122                  self.consumer.http_header(self.status, self.header)                  self.consumer.http_header(self.status, self.header)

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26