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

Unified Diff: net/tools/testserver/testserver.py

Issue 9302024: Add client for background testing of HTTP pipelining. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix memory leak in unit test Created 8 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/base/net_error_list.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/tools/testserver/testserver.py
diff --git a/net/tools/testserver/testserver.py b/net/tools/testserver/testserver.py
index f9177897cc6e17b64a3fa075498365b96f0a7b81..12882b5dcd9cf6dca05a1e0d4516a518d84067da 100755
--- a/net/tools/testserver/testserver.py
+++ b/net/tools/testserver/testserver.py
@@ -378,6 +378,7 @@ class TestPageHandler(BasePageHandler):
self.MultipartHandler,
self.MultipartSlowHandler,
self.GetSSLSessionCacheHandler,
+ self.CloseSocketHandler,
self.DefaultResponseHandler]
post_handlers = [
self.EchoTitleHandler,
@@ -922,6 +923,7 @@ class TestPageHandler(BasePageHandler):
return self._FileHandlerHelper(prefix)
def _FileHandlerHelper(self, prefix):
+ old_protocol_version = self.protocol_version
_, _, url_path, _, query, _ = urlparse.urlparse(self.path)
sub_path = url_path[len(prefix):]
entries = sub_path.split('/')
@@ -948,7 +950,9 @@ class TestPageHandler(BasePageHandler):
# "HTTP/1.1 200 OK"
response = f.readline()
- status_code = re.findall('HTTP/\d+.\d+ (\d+)', response)[0]
+ http_major, http_minor, status_code = re.findall(
+ 'HTTP/(\d+).(\d+) (\d+)', response)[0]
+ self.protocol_version = "HTTP/%s.%s" % (http_major, http_minor)
self.send_response(int(status_code))
for line in f:
@@ -990,6 +994,7 @@ class TestPageHandler(BasePageHandler):
if (self.command != 'HEAD'):
self.wfile.write(data)
+ self.protocol_version = old_protocol_version
return True
def SetCookieHandler(self):
@@ -1427,6 +1432,15 @@ class TestPageHandler(BasePageHandler):
' this request')
return True
+ def CloseSocketHandler(self):
+ """Closes the socket without sending anything."""
+
+ if not self._ShouldHandleRequest('/close-socket'):
+ return False
+
+ self.wfile.close()
+ return True
+
def DefaultResponseHandler(self):
"""This is the catch-all response handler for requests that aren't handled
by one of the special handlers above.
« no previous file with comments | « net/base/net_error_list.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698