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

Unified Diff: net/spdy/spdy_proxy_client_socket_unittest.cc

Issue 9316101: Revert 118950 - Allow chrome to handle 407 auth challenges to CONNECT requests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 11 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/spdy/spdy_proxy_client_socket.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/spdy_proxy_client_socket_unittest.cc
===================================================================
--- net/spdy/spdy_proxy_client_socket_unittest.cc (revision 120368)
+++ net/spdy/spdy_proxy_client_socket_unittest.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -68,7 +68,6 @@
spdy::SpdyFrame* ConstructConnectAuthRequestFrame();
spdy::SpdyFrame* ConstructConnectReplyFrame();
spdy::SpdyFrame* ConstructConnectAuthReplyFrame();
- spdy::SpdyFrame* ConstructConnectNtlmAuthReplyFrame();
spdy::SpdyFrame* ConstructConnectErrorReplyFrame();
spdy::SpdyFrame* ConstructBodyFrame(const char* data, int length);
scoped_refptr<IOBufferWithSize> CreateBuffer(const char* data, int size);
@@ -200,12 +199,8 @@
sock_.reset(
new SpdyProxyClientSocket(spdy_stream_, user_agent_,
endpoint_host_port_pair_, url_,
- proxy_host_port_,
- new HttpAuthController(
- HttpAuth::AUTH_PROXY,
- GURL(kProxyUrl),
- session_->http_auth_cache(),
- session_->http_auth_handler_factory())));
+ proxy_host_port_, session_->http_auth_cache(),
+ session_->http_auth_handler_factory()));
}
scoped_refptr<IOBufferWithSize> SpdyProxyClientSocketTest::CreateBuffer(
@@ -395,26 +390,6 @@
arraysize(kStandardReplyHeaders));
}
-// Constructs a standard SPDY SYN_REPLY frame to match the SPDY CONNECT.
-spdy::SpdyFrame*
-SpdyProxyClientSocketTest::ConstructConnectNtlmAuthReplyFrame() {
- const char* const kStandardReplyHeaders[] = {
- "status", "407 Proxy Authentication Required",
- "version", "HTTP/1.1",
- "proxy-authenticate", "NTLM"
- };
-
- return ConstructSpdyControlFrame(NULL,
- 0,
- false,
- kStreamId,
- LOWEST,
- spdy::SYN_REPLY,
- spdy::CONTROL_FLAG_NONE,
- kStandardReplyHeaders,
- arraysize(kStandardReplyHeaders));
-}
-
// Constructs a SPDY SYN_REPLY frame with an HTTP 500 error.
spdy::SpdyFrame* SpdyProxyClientSocketTest::ConstructConnectErrorReplyFrame() {
const char* const kStandardReplyHeaders[] = {
@@ -461,13 +436,13 @@
AssertConnectionEstablished();
}
-TEST_F(SpdyProxyClientSocketTest, ConnectWithUnsupportedAuthScheme) {
+TEST_F(SpdyProxyClientSocketTest, ConnectWithAuthRequested) {
scoped_ptr<spdy::SpdyFrame> conn(ConstructConnectRequestFrame());
MockWrite writes[] = {
CreateMockWrite(*conn, 0, false),
};
- scoped_ptr<spdy::SpdyFrame> resp(ConstructConnectNtlmAuthReplyFrame());
+ scoped_ptr<spdy::SpdyFrame> resp(ConstructConnectAuthReplyFrame());
MockRead reads[] = {
CreateMockRead(*resp, 1, true),
MockRead(true, 0, 3), // EOF
@@ -475,7 +450,13 @@
Initialize(reads, arraysize(reads), writes, arraysize(writes));
- AssertConnectFails(ERR_PROXY_AUTH_UNSUPPORTED);
+ AssertConnectFails(ERR_TUNNEL_CONNECTION_FAILED);
+
+ const HttpResponseInfo* response = sock_->GetConnectResponseInfo();
+ ASSERT_TRUE(response != NULL);
+ ASSERT_EQ(407, response->headers->response_code());
+ ASSERT_EQ("Proxy Authentication Required",
+ response->headers->GetStatusText());
}
TEST_F(SpdyProxyClientSocketTest, ConnectWithAuthCredentials) {
@@ -498,39 +479,6 @@
AssertConnectionEstablished();
}
-TEST_F(SpdyProxyClientSocketTest, ConnectWithAuthRestart) {
- scoped_ptr<spdy::SpdyFrame> conn(ConstructConnectRequestFrame());
- scoped_ptr<spdy::SpdyFrame> auth(ConstructConnectAuthRequestFrame());
- MockWrite writes[] = {
- CreateMockWrite(*conn, 0, false),
- };
-
- scoped_ptr<spdy::SpdyFrame> resp(ConstructConnectAuthReplyFrame());
- scoped_ptr<spdy::SpdyFrame> auth_resp(ConstructConnectReplyFrame());
- MockRead reads[] = {
- CreateMockRead(*resp, 1, true),
- MockRead(true, 0, 3), // EOF
- };
-
- Initialize(reads, arraysize(reads), writes, arraysize(writes));
-
- AssertConnectFails(ERR_PROXY_AUTH_REQUESTED);
-
- const HttpResponseInfo* response = sock_->GetConnectResponseInfo();
- ASSERT_TRUE(response != NULL);
- ASSERT_EQ(407, response->headers->response_code());
- ASSERT_EQ("Proxy Authentication Required",
- response->headers->GetStatusText());
-
- AddAuthToCache();
-
- ASSERT_EQ(ERR_NO_KEEP_ALIVE_ON_AUTH_RESTART,
- sock_->RestartWithAuth(read_callback_.callback()));
- // A SpdyProxyClientSocket sits on a single SPDY stream which can
- // only be used for a single request/response.
- ASSERT_FALSE(sock_->IsConnectedAndIdle());
-}
-
TEST_F(SpdyProxyClientSocketTest, ConnectFails) {
scoped_ptr<spdy::SpdyFrame> conn(ConstructConnectRequestFrame());
MockWrite writes[] = {
@@ -883,7 +831,7 @@
Initialize(reads, arraysize(reads), writes, arraysize(writes));
- AssertConnectFails(ERR_PROXY_AUTH_REQUESTED);
+ AssertConnectFails(ERR_TUNNEL_CONNECTION_FAILED);
Run(2); // SpdySession consumes the next two reads and sends then to
// sock_ to be buffered.
Property changes on: net/spdy/spdy_proxy_client_socket_unittest.cc
___________________________________________________________________
Added: svn:mergeinfo
« no previous file with comments | « net/spdy/spdy_proxy_client_socket.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698