Show More
@@ -117,7 +117,6 b'' | |||||
117 | tests/test-url.py requires print_function |
|
117 | tests/test-url.py requires print_function | |
118 | tests/test-walkrepo.py requires print_function |
|
118 | tests/test-walkrepo.py requires print_function | |
119 | tests/test-wireproto.py requires print_function |
|
119 | tests/test-wireproto.py requires print_function | |
120 | tests/tinyproxy.py requires print_function |
|
|||
121 |
|
120 | |||
122 | #if py3exe |
|
121 | #if py3exe | |
123 | $ hg files 'set:(**.py)' | sed 's|\\|/|g' | xargs $PYTHON3 contrib/check-py3-compat.py |
|
122 | $ hg files 'set:(**.py)' | sed 's|\\|/|g' | xargs $PYTHON3 contrib/check-py3-compat.py | |
@@ -303,6 +302,5 b'' | |||||
303 | tests/test-ui-verbosity.py: invalid syntax: Missing parentheses in call to 'print' (<unknown>, line *) (glob) |
|
302 | tests/test-ui-verbosity.py: invalid syntax: Missing parentheses in call to 'print' (<unknown>, line *) (glob) | |
304 | tests/test-walkrepo.py: invalid syntax: invalid syntax (<unknown>, line *) (glob) |
|
303 | tests/test-walkrepo.py: invalid syntax: invalid syntax (<unknown>, line *) (glob) | |
305 | tests/test-wireproto.py: invalid syntax: invalid syntax (<unknown>, line *) (glob) |
|
304 | tests/test-wireproto.py: invalid syntax: invalid syntax (<unknown>, line *) (glob) | |
306 | tests/tinyproxy.py: invalid syntax: Missing parentheses in call to 'print' (<unknown>, line *) (glob) |
|
|||
307 |
|
305 | |||
308 | #endif |
|
306 | #endif |
@@ -1,6 +1,6 b'' | |||||
1 | #!/usr/bin/env python |
|
1 | #!/usr/bin/env python | |
2 |
|
2 | |||
3 | from __future__ import absolute_import |
|
3 | from __future__ import absolute_import, print_function | |
4 |
|
4 | |||
5 | __doc__ = """Tiny HTTP Proxy. |
|
5 | __doc__ = """Tiny HTTP Proxy. | |
6 |
|
6 | |||
@@ -50,7 +50,7 b' class ProxyHandler (BaseHTTPServer.BaseH' | |||||
50 | host_port = netloc[:i], int(netloc[i + 1:]) |
|
50 | host_port = netloc[:i], int(netloc[i + 1:]) | |
51 | else: |
|
51 | else: | |
52 | host_port = netloc, 80 |
|
52 | host_port = netloc, 80 | |
53 |
print |
|
53 | print("\t" "connect to %s:%d" % host_port) | |
54 | try: soc.connect(host_port) |
|
54 | try: soc.connect(host_port) | |
55 | except socket.error as arg: |
|
55 | except socket.error as arg: | |
56 | try: msg = arg[1] |
|
56 | try: msg = arg[1] | |
@@ -70,7 +70,7 b' class ProxyHandler (BaseHTTPServer.BaseH' | |||||
70 | self.wfile.write("\r\n") |
|
70 | self.wfile.write("\r\n") | |
71 | self._read_write(soc, 300) |
|
71 | self._read_write(soc, 300) | |
72 | finally: |
|
72 | finally: | |
73 |
print |
|
73 | print("\t" "bye") | |
74 | soc.close() |
|
74 | soc.close() | |
75 | self.connection.close() |
|
75 | self.connection.close() | |
76 |
|
76 | |||
@@ -95,7 +95,7 b' class ProxyHandler (BaseHTTPServer.BaseH' | |||||
95 | soc.send("\r\n") |
|
95 | soc.send("\r\n") | |
96 | self._read_write(soc) |
|
96 | self._read_write(soc) | |
97 | finally: |
|
97 | finally: | |
98 |
print |
|
98 | print("\t" "bye") | |
99 | soc.close() |
|
99 | soc.close() | |
100 | self.connection.close() |
|
100 | self.connection.close() | |
101 |
|
101 | |||
@@ -122,7 +122,7 b' class ProxyHandler (BaseHTTPServer.BaseH' | |||||
122 | out.send(data) |
|
122 | out.send(data) | |
123 | count = 0 |
|
123 | count = 0 | |
124 | else: |
|
124 | else: | |
125 |
print |
|
125 | print("\t" "idle", count) | |
126 | if count == max_idling: |
|
126 | if count == max_idling: | |
127 | break |
|
127 | break | |
128 |
|
128 | |||
@@ -142,16 +142,16 b' class ThreadingHTTPServer (SocketServer.' | |||||
142 | if __name__ == '__main__': |
|
142 | if __name__ == '__main__': | |
143 | from sys import argv |
|
143 | from sys import argv | |
144 | if argv[1:] and argv[1] in ('-h', '--help'): |
|
144 | if argv[1:] and argv[1] in ('-h', '--help'): | |
145 |
print |
|
145 | print(argv[0], "[port [allowed_client_name ...]]") | |
146 | else: |
|
146 | else: | |
147 | if argv[2:]: |
|
147 | if argv[2:]: | |
148 | allowed = [] |
|
148 | allowed = [] | |
149 | for name in argv[2:]: |
|
149 | for name in argv[2:]: | |
150 | client = socket.gethostbyname(name) |
|
150 | client = socket.gethostbyname(name) | |
151 | allowed.append(client) |
|
151 | allowed.append(client) | |
152 |
print |
|
152 | print("Accept: %s (%s)" % (client, name)) | |
153 | ProxyHandler.allowed_clients = allowed |
|
153 | ProxyHandler.allowed_clients = allowed | |
154 | del argv[2:] |
|
154 | del argv[2:] | |
155 | else: |
|
155 | else: | |
156 |
print |
|
156 | print("Any clients will be served...") | |
157 | BaseHTTPServer.test(ProxyHandler, ThreadingHTTPServer) |
|
157 | BaseHTTPServer.test(ProxyHandler, ThreadingHTTPServer) |
General Comments 0
You need to be logged in to leave comments.
Login now