Show More
@@ -20,7 +20,10 b' import select' | |||
|
20 | 20 | import socket |
|
21 | 21 | import sys |
|
22 | 22 | |
|
23 |
from mercurial import |
|
|
23 | from mercurial import ( | |
|
24 | pycompat, | |
|
25 | util, | |
|
26 | ) | |
|
24 | 27 | |
|
25 | 28 | httpserver = util.httpserver |
|
26 | 29 | socketserver = util.socketserver |
@@ -77,10 +80,11 b' class ProxyHandler (httpserver.basehttpr' | |||
|
77 | 80 | try: |
|
78 | 81 | if self._connect_to(self.path, soc): |
|
79 | 82 | self.log_request(200) |
|
80 | self.wfile.write(self.protocol_version + | |
|
81 | " 200 Connection established\r\n") | |
|
82 |
self.wfile.write("Proxy-agent: %s\r\n" % |
|
|
83 | self.wfile.write("\r\n") | |
|
83 | self.wfile.write(pycompat.bytestr(self.protocol_version) + | |
|
84 | b" 200 Connection established\r\n") | |
|
85 | self.wfile.write(b"Proxy-agent: %s\r\n" % | |
|
86 | pycompat.bytestr(self.version_string())) | |
|
87 | self.wfile.write(b"\r\n") | |
|
84 | 88 | self._read_write(soc, 300) |
|
85 | 89 | finally: |
|
86 | 90 | print("\t" "bye") |
@@ -97,15 +101,17 b' class ProxyHandler (httpserver.basehttpr' | |||
|
97 | 101 | try: |
|
98 | 102 | if self._connect_to(netloc, soc): |
|
99 | 103 | self.log_request() |
|
100 | soc.send("%s %s %s\r\n" % ( | |
|
101 | self.command, | |
|
102 | urlreq.urlunparse(('', '', path, params, query, '')), | |
|
103 |
|
|
|
104 | url = urlreq.urlunparse(('', '', path, params, query, '')) | |
|
105 | soc.send(b"%s %s %s\r\n" % ( | |
|
106 | pycompat.bytestr(self.command), | |
|
107 | pycompat.bytestr(url), | |
|
108 | pycompat.bytestr(self.request_version))) | |
|
104 | 109 | self.headers['Connection'] = 'close' |
|
105 | 110 | del self.headers['Proxy-Connection'] |
|
106 |
for key |
|
|
107 |
soc.send("%s: %s\r\n" % key |
|
|
108 | soc.send("\r\n") | |
|
111 | for key, val in self.headers.items(): | |
|
112 | soc.send(b"%s: %s\r\n" % (pycompat.bytestr(key), | |
|
113 | pycompat.bytestr(val))) | |
|
114 | soc.send(b"\r\n") | |
|
109 | 115 | self._read_write(soc) |
|
110 | 116 | finally: |
|
111 | 117 | print("\t" "bye") |
General Comments 0
You need to be logged in to leave comments.
Login now