Add support to URLRequest for deferring redirects.
I chose to add an out parameter to OnReceivedRedirect because it allows for the
default behavior to remain the same.
I considered adding a ContinueAfterRedirect method that all OnReceivedRedirect
implementations would need to call, but this caused one annoying problem: In
the case of a ChromePlugin, it is possible for the URLRequest to get deleted
inside the handler for the redirect. This would make it hard to subsequently
call a method on the URLRequest since I would need to have a way to determine
if the URLRequest had been deleted.
TEST=covered by unit tests
BUG=16413,6442
R=eroman,wtc
Review URL: http://codereview.chromium.org/155897
git-svn-id: http://src.chromium.org/svn/trunk/src/net/tools/testserver@21417 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
diff --git a/testserver.py b/testserver.py
index 06bcfad..14ae182 100644
--- a/testserver.py
+++ b/testserver.py
@@ -570,6 +570,10 @@
if not self.path.startswith(prefix):
return False
+ # Consume a request body if present.
+ if self.command == 'POST':
+ self.rfile.read(int(self.headers.getheader('content-length')))
+
file = self.path[len(prefix):]
entries = file.split('/');
path = os.path.join(self.server.data_dir, *entries)