summaryrefslogtreecommitdiffstats
path: root/net/tools
diff options
context:
space:
mode:
authorcbentzel@chromium.org <cbentzel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-09 03:40:22 +0000
committercbentzel@chromium.org <cbentzel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-09 03:40:22 +0000
commitea993c2cb08e5e8915b369fb17087d29776cad1f (patch)
tree906dab60d90300685a1ee47fa5ec455409fd74cb /net/tools
parent8c515f8612a8449f26345c062a8ebda1f3c7b81f (diff)
downloadchromium_src-ea993c2cb08e5e8915b369fb17087d29776cad1f.zip
chromium_src-ea993c2cb08e5e8915b369fb17087d29776cad1f.tar.gz
chromium_src-ea993c2cb08e5e8915b369fb17087d29776cad1f.tar.bz2
Revert 65465 - testserver.py listens on ephemeral ports by default.
Some SSL UI tests timed out again on 10.5/10.6 bots when landing this, despite the changes made. Different tests this time however. If --port is specified on the command line, testserver.py will listen on that port, otherwise it will listen on an ephemeral port. If --startup_pipe is specified, the port number is written to the pipe as a 2 byte unsigned int in host order. TestServer spawns testserver.py to listen on an ephemeral port and reads the port value from the pipe. A fixed port can not be specified. BUG=56814 TEST=try bots pass Review URL: http://codereview.chromium.org/4136008 TBR=cbentzel@chromium.org Review URL: http://codereview.chromium.org/4731003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65488 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/tools')
-rwxr-xr-xnet/tools/testserver/testserver.py26
1 files changed, 9 insertions, 17 deletions
diff --git a/net/tools/testserver/testserver.py b/net/tools/testserver/testserver.py
index 0e1445b..55aa6a9 100755
--- a/net/tools/testserver/testserver.py
+++ b/net/tools/testserver/testserver.py
@@ -6,9 +6,7 @@
"""This is a simple HTTP server used for testing Chrome.
It supports several test URLs, as specified by the handlers in TestPageHandler.
-By default, it listens on an ephemeral port and sends the port number back to
-the originating process over a pipe. The originating process can specify an
-explicit port if necessary.
+It defaults to living on localhost:8888.
It can use https if you specify the flag --https=CERT where CERT is the path
to a pem file containing the certificate and private key that should be used.
"""
@@ -22,7 +20,6 @@ import re
import shutil
import SocketServer
import sys
-import struct
import time
import urlparse
import warnings
@@ -503,7 +500,7 @@ class TestPageHandler(BaseHTTPServer.BaseHTTPRequestHandler):
'pre { border: 1px solid black; margin: 5px; padding: 5px }'
'</style></head><body>'
'<div style="float: right">'
- '<a href="/echo">back to referring page</a></div>'
+ '<a href="http://localhost:8888/echo">back to referring page</a></div>'
'<h1>Request Body:</h1><pre>')
if self.command == 'POST' or self.command == 'PUT':
@@ -1194,15 +1191,15 @@ def main(options, args):
server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert,
options.ssl_client_auth, options.ssl_client_ca,
options.ssl_bulk_cipher)
- print 'HTTPS server started on port %d...' % server.server_port
+ print 'HTTPS server started on port %d...' % port
else:
server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler)
- print 'HTTP server started on port %d...' % server.server_port
+ print 'HTTP server started on port %d...' % port
server.data_dir = MakeDataDir()
server.file_root_url = options.file_root_url
server._sync_handler = None
- listen_port = server.server_port
+
# means FTP Server
else:
my_data_dir = MakeDataDir()
@@ -1227,8 +1224,7 @@ def main(options, args):
# Instantiate FTP server class and listen to 127.0.0.1:port
address = ('127.0.0.1', port)
server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler)
- listen_port = server.socket.getsockname()[1]
- print 'FTP server started on port %d...' % listen_port
+ print 'FTP server started on port %d...' % port
# Notify the parent that we've started. (BaseServer subclasses
# bind their sockets on construction.)
@@ -1238,10 +1234,7 @@ def main(options, args):
else:
fd = options.startup_pipe
startup_pipe = os.fdopen(fd, "w")
- # Write the listening port as a 2 byte value. This is _not_ using
- # network byte ordering since the other end of the pipe is on the same
- # machine.
- startup_pipe.write(struct.pack('@H', listen_port))
+ startup_pipe.write("READY")
startup_pipe.close()
try:
@@ -1256,9 +1249,8 @@ if __name__ == '__main__':
const=SERVER_FTP, default=SERVER_HTTP,
dest='server_type',
help='FTP or HTTP server: default is HTTP.')
- option_parser.add_option('', '--port', default='0', type='int',
- help='Port used by the server. If unspecified, the '
- 'server will listen on an ephemeral port.')
+ option_parser.add_option('', '--port', default='8888', type='int',
+ help='Port used by the server.')
option_parser.add_option('', '--data-dir', dest='data_dir',
help='Directory from which to read the files.')
option_parser.add_option('', '--https', dest='cert',