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