summaryrefslogtreecommitdiffstats
path: root/net/tools/testserver
diff options
context:
space:
mode:
authorericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-27 04:00:22 +0000
committerericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-27 04:00:22 +0000
commit0757e770ac9ce685ee0db0179271f1a3dba47cb0 (patch)
tree54e1a153fd38a9f950187929076a1d5d6966357e /net/tools/testserver
parent3a2d366b664bb0c13f4427f3ed6a3b6af6e77451 (diff)
downloadchromium_src-0757e770ac9ce685ee0db0179271f1a3dba47cb0.zip
chromium_src-0757e770ac9ce685ee0db0179271f1a3dba47cb0.tar.gz
chromium_src-0757e770ac9ce685ee0db0179271f1a3dba47cb0.tar.bz2
Respect cookies set in a 401 responses when restarting the http transaction.
There are two parts to this change: (1) rebuild the request cookies before each transaction restart for authentication (2) notify the URLRequestHttpJob of header completion before *each* transaction restart for authentication By "each transaction" I mean the automatic restarts that don't require user input, such as: - replying to the first step of NTLM - selecting identity embedded in URL - selecting identity in auth-cache Needing to notify URLRequestHttpJob for these intermediate restarts is a consequence of cookie store management being done outside of HttpNetworkTransaction. After updating the cookie store, URLRequestHttpJob now tests |HttpTransaction::IsReadyToRestartForAuth()| to check whether the notification was informational or an identity is actually needed. R=wtc BUG=6450 Review URL: http://codereview.chromium.org/51004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12635 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/tools/testserver')
-rw-r--r--net/tools/testserver/testserver.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/net/tools/testserver/testserver.py b/net/tools/testserver/testserver.py
index 407694a..5784059 100644
--- a/net/tools/testserver/testserver.py
+++ b/net/tools/testserver/testserver.py
@@ -691,6 +691,8 @@ class TestPageHandler(BaseHTTPServer.BaseHTTPRequestHandler):
username = userpass = password = b64str = ""
+ set_cookie_if_challenged = self.path.find('?set-cookie-if-challenged') > 0
+
auth = self.headers.getheader('authorization')
try:
if not auth:
@@ -705,6 +707,8 @@ class TestPageHandler(BaseHTTPServer.BaseHTTPRequestHandler):
self.send_response(401)
self.send_header('WWW-Authenticate', 'Basic realm="testrealm"')
self.send_header('Content-type', 'text/html')
+ if set_cookie_if_challenged:
+ self.send_header('Set-Cookie', 'got_challenged=true')
self.end_headers()
self.wfile.write('<html><head>')
self.wfile.write('<title>Denied: %s</title>' % e)
@@ -734,6 +738,7 @@ class TestPageHandler(BaseHTTPServer.BaseHTTPRequestHandler):
self.wfile.write('<title>%s/%s</title>' % (username, password))
self.wfile.write('</head><body>')
self.wfile.write('auth=%s<p>' % auth)
+ self.wfile.write('You sent:<br>%s<p>' % self.headers)
self.wfile.write('</body></html>')
return True