p = self.proxies[session]
# send command
- req = "%s %s %s\n" % (reqtype, self.hr.path, self.hr.request_version)
+ #req = "%s %s %s\n" % (reqtype, self.hr.path, self.hr.request_version)
+ req = "%s %s %s\n" % (reqtype, self.hr.path, "HTTP/1.1")
print "req", req
yield p.ss.write(req)
+ conntype = self.hr.headers.get('Connection', "")
+ keepalive = conntype.lower() == 'keep-alive'
+
+ self.hr.headers['Connection'] = 'keep-alive'
+ self.hr.close_connection = 0
+
# send headers
hdrs = str(self.hr.headers)
print "hdrs", hdrs
yield p.ss.write(hdrs)
yield p.ss.write('\r\n')
- conntype = self.hr.headers.get('Connection', "")
- keepalive = conntype.lower() == 'keep-alive'
-
# now content
if self.hr.headers.has_key('content-length'):
max_chunk_size = 10*1024*1024
break
yield self.client.writeMessage(data)
- raise StopIteration
-
- if self.hr.close_connection:
+ if not keepalive: #self.hr.close_connection:
print 'proxy wants client to close_connection'
try:
- raise httpd.ConnectionClosed
yield self.client.connectionClosed()
+ raise httpd.ConnectionClosed
except httpd.ConnectionClosed:
print 'close_connection done'
pass