Ticket #1774: twisted-web-proxy.patch
| File twisted-web-proxy.patch, 2.6 KB (added by ironfroggy, 7 years ago) |
|---|
-
web/client.py
34 34 35 35 def connectionMade(self): 36 36 method = getattr(self.factory, 'method', 'GET') 37 self.sendCommand(method, self.factory.path) 37 addr = (self.factory.host, self.factory.port) 38 if getattr(self.transport, 'addr', addr) == addr: 39 getpath = self.factory.path 40 else: 41 getpath = "%s://%s:%s%s" % (self.factory.scheme, 42 self.factory.host, 43 self.factory.port, 44 self.factory.path) 45 self.sendCommand(method, getpath) 38 46 self.sendHeader('Host', self.factory.headers.get("host", self.factory.host)) 39 47 self.sendHeader('User-Agent', self.factory.agent) 40 48 if self.factory.cookies: 41 49 l=[] 42 for cookie, cookval in self.factory.cookies.items(): 50 for cookie, cookval in self.factory.cookies.items(): 43 51 l.append('%s=%s' % (cookie, cookval)) 44 52 self.sendHeader('Cookie', '; '.join(l)) 45 53 data = getattr(self.factory, 'postdata', None) -
web/http.py
559 559 560 560 self.method, self.uri = command, path 561 561 self.clientproto = version 562 x = self.uri.split('?') 562 563 if '://' in path: 564 path = '/'+path.split('/', 3)[-1] 565 566 x = path.split('?') 563 567 564 568 if len(x) == 1: 565 self.path = self.uri569 self.path = path 566 570 else: 567 571 if len(x) != 2: 568 572 log.msg("May ignore parts of this invalid URI: %s" … … 597 601 self.channel.transport.loseConnection() 598 602 return 599 603 raise 600 604 601 605 self.process() 602 606 603 607 def __repr__(self): -
web/proxy.py
113 113 headers['host'] = host 114 114 self.content.seek(0, 0) 115 115 s = self.content.read() 116 clientFactory = class_(self.method, rest, self.clientproto, headers,116 clientFactory = class_(self.method, self.uri, self.clientproto, headers, 117 117 s, self) 118 118 reactor.connectTCP(host, port, clientFactory) 119 119
