Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(276)

Side by Side Diff: net/tools/testserver/testserver.py

Issue 8054013: Recover from bad proxy settings pointing to non-proxy servers that reply anyway. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased, reviewed Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/test/test_url_fetcher_factory.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python2.4 1 #!/usr/bin/python2.4
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """This is a simple HTTP/FTP/SYNC/TCP/UDP/ server used for testing Chrome. 6 """This is a simple HTTP/FTP/SYNC/TCP/UDP/ server used for testing Chrome.
7 7
8 It supports several test URLs, as specified by the handlers in TestPageHandler. 8 It supports several test URLs, as specified by the handlers in TestPageHandler.
9 By default, it listens on an ephemeral port and sends the port number back to 9 By default, it listens on an ephemeral port and sends the port number back to
10 the originating process over a pipe. The originating process can specify an 10 the originating process over a pipe. The originating process can specify an
(...skipping 1400 matching lines...) Expand 10 before | Expand all | Expand 10 after
1411 self.server._device_management_handler = ( 1411 self.server._device_management_handler = (
1412 device_management.TestServer(policy_path, 1412 device_management.TestServer(policy_path,
1413 self.server.policy_keys, 1413 self.server.policy_keys,
1414 self.server.policy_user)) 1414 self.server.policy_user))
1415 1415
1416 http_response, raw_reply = ( 1416 http_response, raw_reply = (
1417 self.server._device_management_handler.HandleRequest(self.path, 1417 self.server._device_management_handler.HandleRequest(self.path,
1418 self.headers, 1418 self.headers,
1419 raw_request)) 1419 raw_request))
1420 self.send_response(http_response) 1420 self.send_response(http_response)
1421 if (http_response == 200):
1422 self.send_header('Content-type', 'application/x-protobuffer')
1421 self.end_headers() 1423 self.end_headers()
1422 self.wfile.write(raw_reply) 1424 self.wfile.write(raw_reply)
1423 return True 1425 return True
1424 1426
1425 # called by the redirect handling function when there is no parameter 1427 # called by the redirect handling function when there is no parameter
1426 def sendRedirectHelp(self, redirect_name): 1428 def sendRedirectHelp(self, redirect_name):
1427 self.send_response(200) 1429 self.send_response(200)
1428 self.send_header('Content-type', 'text/html') 1430 self.send_header('Content-type', 'text/html')
1429 self.end_headers() 1431 self.end_headers()
1430 self.wfile.write('<html><body><h1>Error: no redirect destination</h1>') 1432 self.wfile.write('<html><body><h1>Error: no redirect destination</h1>')
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
1909 'random key if none is specified on the command ' 1911 'random key if none is specified on the command '
1910 'line.') 1912 'line.')
1911 option_parser.add_option('', '--policy-user', default='user@example.com', 1913 option_parser.add_option('', '--policy-user', default='user@example.com',
1912 dest='policy_user', 1914 dest='policy_user',
1913 help='Specify the user name the server should ' 1915 help='Specify the user name the server should '
1914 'report back to the client as the user owning the ' 1916 'report back to the client as the user owning the '
1915 'token used for making the policy request.') 1917 'token used for making the policy request.')
1916 options, args = option_parser.parse_args() 1918 options, args = option_parser.parse_args()
1917 1919
1918 sys.exit(main(options, args)) 1920 sys.exit(main(options, args))
OLDNEW
« no previous file with comments | « content/test/test_url_fetcher_factory.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698