diff options
author | ricea@chromium.org <ricea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-29 07:42:29 +0000 |
---|---|---|
committer | ricea@chromium.org <ricea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-29 07:42:29 +0000 |
commit | e69c1cd33dee41835499a5130c3431a059b4ac7d (patch) | |
tree | 45a0bd23c30d455d99c45909d05329b18800d6b7 /net/tools | |
parent | e0cc8e2ac33e2943920e8b0f0184cce62c01fd5a (diff) | |
download | chromium_src-e69c1cd33dee41835499a5130c3431a059b4ac7d.zip chromium_src-e69c1cd33dee41835499a5130c3431a059b4ac7d.tar.gz chromium_src-e69c1cd33dee41835499a5130c3431a059b4ac7d.tar.bz2 |
Map WebSocket URL schemes to HTTP URL schemes for auth purposes.
This permits WebSocket connections to inherit credentials from HTTP pages, and
matches the behaviour of other browsers.
Design doc: https://docs.google.com/a/chromium.org/document/d/129rLtf5x3hvhP5rayLiSxnEjOXS8Z7EnLJgBL4CdwjI/edit
Also consider any 401 or 407 results that reach the WebSocketStream
URLRequest::Delegate to be unrecoverable errors.
Also ensure that the response headers are reported back to the renderer
when the developer tools are open and a 401 error happens.
BUG=123862
Review URL: https://codereview.chromium.org/336263005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@286108 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/tools')
-rwxr-xr-x | net/tools/testserver/testserver.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/net/tools/testserver/testserver.py b/net/tools/testserver/testserver.py index 0ff4e69..60b7b28 100755 --- a/net/tools/testserver/testserver.py +++ b/net/tools/testserver/testserver.py @@ -103,6 +103,7 @@ class WebSocketOptions: self.tls_client_ca = None self.tls_module = 'ssl' self.use_basic_auth = False + self.basic_auth_credential = 'Basic ' + base64.b64encode('test:test') class RecordingSSLSessionCache(object): @@ -2025,6 +2026,7 @@ class ServerRunner(testserver_base.TestServerRunner): print 'WebSocket server started on %s://%s:%d...' % \ (scheme, host, server.server_port) server_data['port'] = server.server_port + websocket_options.use_basic_auth = self.options.ws_basic_auth elif self.options.server_type == SERVER_TCP_ECHO: # Used for generating the key (randomly) that encodes the "echo request" # message. @@ -2206,6 +2208,10 @@ class ServerRunner(testserver_base.TestServerRunner): 'support for exactly one protocol, http/1.1') self.option_parser.add_option('--file-root-url', default='/files/', help='Specify a root URL for files served.') + # TODO(ricea): Generalize this to support basic auth for HTTP too. + self.option_parser.add_option('--ws-basic-auth', action='store_true', + dest='ws_basic_auth', + help='Enable basic-auth for WebSocket') if __name__ == '__main__': |