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

Unified Diff: net/http/http_proxy_client_socket_pool_unittest.cc

Issue 9148011: 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/http/http_proxy_client_socket_pool.cc ('k') | net/http/http_proxy_utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_proxy_client_socket_pool_unittest.cc
===================================================================
--- net/http/http_proxy_client_socket_pool_unittest.cc (revision 118888)
+++ net/http/http_proxy_client_socket_pool_unittest.cc (working copy)
@@ -131,7 +131,9 @@
session_->http_auth_cache(),
session_->http_auth_handler_factory(),
session_->spdy_session_pool(),
- tunnel));
+ tunnel,
+ base::Bind(&HttpProxyClientSocketPoolTest::OnNeedsProxyAuthCallback,
+ base::Unretained(this))));
}
scoped_refptr<HttpProxySocketParams> GetTunnelParams() {
@@ -191,6 +193,14 @@
return new HttpNetworkSession(params);
}
+ void OnNeedsProxyAuthCallback(const HttpResponseInfo& response_info,
+ HttpAuthController* auth_controller,
+ CompletionCallback cb) {
+ // Don't add any auth, just run the callback
+ cb.Run(OK);
+ }
+
+
private:
SSLConfig ssl_config_;
@@ -258,9 +268,21 @@
CreateMockWrite(*req, 0, true),
CreateMockWrite(*rst, 2, true),
};
+ static const char* const kAuthChallenge[] = {
+ "status", "407 Proxy Authentication Required",
+ "version", "HTTP/1.1",
+ "proxy-authenticate", "Basic realm=\"MyRealm1\"",
+ };
scoped_ptr<spdy::SpdyFrame> resp(
- ConstructSpdySynReplyError(
- "407 Proxy Authentication Required", NULL, 0, 1));
+ ConstructSpdyControlFrame(NULL,
+ 0,
+ false,
+ 1,
+ LOWEST,
+ spdy::SYN_REPLY,
+ spdy::CONTROL_FLAG_NONE,
+ kAuthChallenge,
+ arraysize(kAuthChallenge)));
MockRead spdy_reads[] = {
CreateMockWrite(*resp, 1, true),
MockRead(true, 0, 3)
@@ -277,21 +299,16 @@
EXPECT_FALSE(handle_.is_initialized());
EXPECT_FALSE(handle_.socket());
- data_->RunFor(4);
+ data_->RunFor(GetParam() == SPDY ? 2 : 4);
rv = callback_.WaitForResult();
+ EXPECT_EQ(ERR_PROXY_AUTH_REQUESTED, rv);
+ EXPECT_TRUE(handle_.is_initialized());
+ ASSERT_TRUE(handle_.socket());
if (GetParam() != SPDY) {
- EXPECT_EQ(ERR_PROXY_AUTH_REQUESTED, rv);
- EXPECT_TRUE(handle_.is_initialized());
- ASSERT_TRUE(handle_.socket());
HttpProxyClientSocket* tunnel_socket =
static_cast<HttpProxyClientSocket*>(handle_.socket());
EXPECT_FALSE(tunnel_socket->IsConnected());
EXPECT_FALSE(tunnel_socket->using_spdy());
- } else {
- // Proxy auth is not really implemented for SPDY yet
- EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, rv);
- EXPECT_FALSE(handle_.is_initialized());
- EXPECT_FALSE(handle_.socket());
}
}
« no previous file with comments | « net/http/http_proxy_client_socket_pool.cc ('k') | net/http/http_proxy_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698