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

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

Issue 8044003: Fix a crash when loading a multipart html page. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sort Created 9 years, 3 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 | « chrome/renderer/extensions/user_script_slave.cc ('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 7f9e17a54129759cbf0409e9b16360503f570ef5..cfb5a2f8d38b3bab8c913bcf2e55343ed303f44e 100755
--- a/net/tools/testserver/testserver.py
+++ b/net/tools/testserver/testserver.py
@@ -343,6 +343,7 @@ class TestPageHandler(BasePageHandler):
self.ServerRedirectHandler,
self.ClientRedirectHandler,
self.MultipartHandler,
+ self.MultipartSlowHandler,
self.DefaultResponseHandler]
post_handlers = [
self.EchoTitleHandler,
@@ -1310,6 +1311,34 @@ class TestPageHandler(BasePageHandler):
self.wfile.write('--' + bound + '--')
return True
+ def MultipartSlowHandler(self):
+ """Send a multipart response (3 text/html pages) with a slight delay
+ between each page. This is similar to how some pages show status using
+ multipart."""
+ test_name = "/multipart-slow"
eroman 2011/09/27 00:56:41 nit: for consistency use single quotemarks through
+ if not self._ShouldHandleRequest(test_name):
+ return False
+
+ num_frames = 3
+ bound = '12345'
+ self.send_response(200)
+ self.send_header('Content-type',
+ 'multipart/x-mixed-replace;boundary=' + bound)
+ self.end_headers()
+
+ for i in xrange(num_frames):
+ self.wfile.write('--' + bound + '\r\n')
+ self.wfile.write('Content-type: text/html\r\n\r\n')
+ time.sleep(0.25)
+ if i == 2:
+ self.wfile.write('<title>PASS</title>')
+ else:
+ self.wfile.write('<title>page ' + str(i) + '</title>')
+ self.wfile.write('page ' + str(i) + '<!-- ' + ('x' * 2048) + '-->')
+
+ self.wfile.write('--' + bound + '--')
+ 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 | « chrome/renderer/extensions/user_script_slave.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698