summaryrefslogtreecommitdiffstats
path: root/net/http/http_network_transaction_unittest.cc
diff options
context:
space:
mode:
authordhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-25 16:29:08 +0000
committerdhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-25 16:29:08 +0000
commit9b40b28c0598ca9fa968e69b5da4be8c2d16f115 (patch)
treea61576c20105b80a40976ba4563d266b4eef7de7 /net/http/http_network_transaction_unittest.cc
parentc0b656408d922a6a4a795e8912342f3ead0465ae (diff)
downloadchromium_src-9b40b28c0598ca9fa968e69b5da4be8c2d16f115.zip
chromium_src-9b40b28c0598ca9fa968e69b5da4be8c2d16f115.tar.gz
chromium_src-9b40b28c0598ca9fa968e69b5da4be8c2d16f115.tar.bz2
Revert 57333 - Add support for speaking SSL to an HTTP Proxy, to
HttpProxyClientSocketPool (and friends) Reverting due to heapcheck issues: http://build.chromium.org/buildbot/memory/builders/Linux%20Heapcheck/builds/7039/steps/heapcheck%20test:%20net/logs/stdio Suppression: { <insert_a_suppression_name_here> Heapcheck:Leak fun:RefCountedBase fun:RefCounted fun:TCPSocketParams fun:net::HttpStreamRequest::DoInitConnection fun:net::HttpStreamRequest::DoLoop fun:net::HttpStreamRequest::RunLoop fun:net::HttpStreamRequest::Start fun:net::HttpStreamFactory::RequestStream fun:net::HttpNetworkTransaction::DoInitStream fun:net::HttpNetworkTransaction::DoLoop fun:net::HttpNetworkTransaction::RestartIgnoringLastError fun:net::HttpNetworkTransactionTest_HTTPSBadCertificateViaHttpsProxy_Test::TestBody fun:testing::Test::Run fun:testing::internal::TestInfoImpl::Run fun:testing::TestCase::Run fun:testing::internal::UnitTestImpl::RunAllTests fun:testing::UnitTest::Run fun:base::TestSuite::Run fun:main fun:__libc_start_main } More information about an HTTPS Proxy can be found here: http://dev.chromium.org/spdy/spdy-proxy This implementation supports both http:// and https:// requests, as well as support for both Proxy and Server auth. BUG=29625 TEST=none Review URL: http://codereview.chromium.org/3110006 TBR=rch@chromium.org Review URL: http://codereview.chromium.org/3134034 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57335 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http/http_network_transaction_unittest.cc')
-rw-r--r--net/http/http_network_transaction_unittest.cc290
1 files changed, 0 insertions, 290 deletions
diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc
index 81c26fa..5e07b88 100644
--- a/net/http/http_network_transaction_unittest.cc
+++ b/net/http/http_network_transaction_unittest.cc
@@ -327,12 +327,6 @@ CaptureGroupNameSocketPool<ParentPool>::CaptureGroupNameSocketPool(
: ParentPool(0, 0, NULL, session->host_resolver(), NULL, NULL) {}
template<>
-CaptureGroupNameHttpProxySocketPool::CaptureGroupNameSocketPool(
- HttpNetworkSession* session)
- : HttpProxyClientSocketPool(0, 0, NULL, session->host_resolver(), NULL,
- NULL, NULL) {}
-
-template<>
CaptureGroupNameSSLSocketPool::CaptureGroupNameSocketPool(
HttpNetworkSession* session)
: SSLClientSocketPool(0, 0, NULL, session->host_resolver(), NULL, NULL,
@@ -1667,153 +1661,6 @@ TEST_F(HttpNetworkTransactionTest, UnexpectedProxyAuth) {
EXPECT_EQ(ERR_UNEXPECTED_PROXY_AUTH, rv);
}
-
-// Test a simple get through an HTTPS Proxy.
-TEST_F(HttpNetworkTransactionTest, HttpsProxyGet) {
- // Configure against https proxy server "proxy:70".
- SessionDependencies session_deps(CreateFixedProxyService("https://proxy:70"));
- CapturingBoundNetLog log(CapturingNetLog::kUnbounded);
- session_deps.net_log = log.bound().net_log();
- scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps));
-
- scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session));
-
- HttpRequestInfo request;
- request.method = "GET";
- request.url = GURL("http://www.google.com/");
-
- // Since we have proxy, should use full url
- MockWrite data_writes1[] = {
- MockWrite("GET http://www.google.com/ HTTP/1.1\r\n"
- "Host: www.google.com\r\n"
- "Proxy-Connection: keep-alive\r\n\r\n"),
- };
-
- MockRead data_reads1[] = {
- MockRead("HTTP/1.1 200 OK\r\n"),
- MockRead("Content-Type: text/html; charset=iso-8859-1\r\n"),
- MockRead("Content-Length: 100\r\n\r\n"),
- MockRead(false, OK),
- };
-
- StaticSocketDataProvider data1(data_reads1, arraysize(data_reads1),
- data_writes1, arraysize(data_writes1));
- session_deps.socket_factory.AddSocketDataProvider(&data1);
- SSLSocketDataProvider ssl(true, OK);
- session_deps.socket_factory.AddSSLSocketDataProvider(&ssl);
-
- TestCompletionCallback callback1;
-
- int rv = trans->Start(&request, &callback1, log.bound());
- EXPECT_EQ(ERR_IO_PENDING, rv);
-
- rv = callback1.WaitForResult();
- EXPECT_EQ(OK, rv);
-
- const HttpResponseInfo* response = trans->GetResponseInfo();
- ASSERT_FALSE(response == NULL);
-
- EXPECT_TRUE(response->headers->IsKeepAlive());
- EXPECT_EQ(200, response->headers->response_code());
- EXPECT_EQ(100, response->headers->GetContentLength());
- EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion());
-
- // The password prompt info should not be set.
- EXPECT_TRUE(response->auth_challenge.get() == NULL);
-}
-
-// Test the challenge-response-retry sequence through an HTTPS Proxy
-TEST_F(HttpNetworkTransactionTest, HttpsProxyAuthRetry) {
- // Configure against https proxy server "proxy:70".
- SessionDependencies session_deps(CreateFixedProxyService("https://proxy:70"));
- CapturingBoundNetLog log(CapturingNetLog::kUnbounded);
- session_deps.net_log = log.bound().net_log();
- scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps));
-
- scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session));
-
- HttpRequestInfo request;
- request.method = "GET";
- request.url = GURL("http://www.google.com/");
- // when the no authentication data flag is set.
- request.load_flags = net::LOAD_DO_NOT_SEND_AUTH_DATA;
-
- // Since we have proxy, should use full url
- MockWrite data_writes1[] = {
- MockWrite("GET http://www.google.com/ HTTP/1.1\r\n"
- "Host: www.google.com\r\n"
- "Proxy-Connection: keep-alive\r\n\r\n"),
-
- // After calling trans->RestartWithAuth(), this is the request we should
- // be issuing -- the final header line contains the credentials.
- MockWrite("GET http://www.google.com/ HTTP/1.1\r\n"
- "Host: www.google.com\r\n"
- "Proxy-Connection: keep-alive\r\n"
- "Proxy-Authorization: Basic Zm9vOmJhcg==\r\n\r\n"),
- };
-
- // The proxy responds to the GET with a 407, using a persistent
- // connection.
- MockRead data_reads1[] = {
- // No credentials.
- MockRead("HTTP/1.1 407 Proxy Authentication Required\r\n"),
- MockRead("Proxy-Authenticate: Basic realm=\"MyRealm1\"\r\n"),
- MockRead("Proxy-Connection: keep-alive\r\n"),
- MockRead("Content-Length: 0\r\n\r\n"),
-
- MockRead("HTTP/1.1 200 OK\r\n"),
- MockRead("Content-Type: text/html; charset=iso-8859-1\r\n"),
- MockRead("Content-Length: 100\r\n\r\n"),
- MockRead(false, OK),
- };
-
- StaticSocketDataProvider data1(data_reads1, arraysize(data_reads1),
- data_writes1, arraysize(data_writes1));
- session_deps.socket_factory.AddSocketDataProvider(&data1);
- SSLSocketDataProvider ssl(true, OK);
- session_deps.socket_factory.AddSSLSocketDataProvider(&ssl);
-
- TestCompletionCallback callback1;
-
- int rv = trans->Start(&request, &callback1, log.bound());
- EXPECT_EQ(ERR_IO_PENDING, rv);
-
- rv = callback1.WaitForResult();
- EXPECT_EQ(OK, rv);
-
- const HttpResponseInfo* response = trans->GetResponseInfo();
- ASSERT_FALSE(response == NULL);
-
- EXPECT_EQ(407, response->headers->response_code());
- EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion());
-
- // The password prompt info should have been set in response->auth_challenge.
- ASSERT_FALSE(response->auth_challenge.get() == NULL);
-
- EXPECT_EQ(L"proxy:70", response->auth_challenge->host_and_port);
- EXPECT_EQ(L"MyRealm1", response->auth_challenge->realm);
- EXPECT_EQ(L"basic", response->auth_challenge->scheme);
-
- TestCompletionCallback callback2;
-
- rv = trans->RestartWithAuth(kFoo, kBar, &callback2);
- EXPECT_EQ(ERR_IO_PENDING, rv);
-
- rv = callback2.WaitForResult();
- EXPECT_EQ(OK, rv);
-
- response = trans->GetResponseInfo();
- ASSERT_FALSE(response == NULL);
-
- EXPECT_TRUE(response->headers->IsKeepAlive());
- EXPECT_EQ(200, response->headers->response_code());
- EXPECT_EQ(100, response->headers->GetContentLength());
- EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion());
-
- // The password prompt info should not be set.
- EXPECT_TRUE(response->auth_challenge.get() == NULL);
-}
-
void HttpNetworkTransactionTest::ConnectStatusHelperWithExpectedStatus(
const MockRead& status, int expected_status) {
// Configure against proxy server "myproxy:70".
@@ -3844,143 +3691,6 @@ TEST_F(HttpNetworkTransactionTest, HTTPSBadCertificateViaProxy) {
}
}
-
-// Test HTTPS connections to a site, going through an HTTPS proxy
-TEST_F(HttpNetworkTransactionTest, HTTPSViaHttpsProxy) {
- SessionDependencies session_deps(CreateFixedProxyService("https://proxy:70"));
-
- HttpRequestInfo request;
- request.method = "GET";
- request.url = GURL("https://www.google.com/");
- request.load_flags = 0;
-
- MockWrite data_writes[] = {
- MockWrite("CONNECT www.google.com:443 HTTP/1.1\r\n"
- "Host: www.google.com\r\n"
- "Proxy-Connection: keep-alive\r\n\r\n"),
- MockWrite("GET / HTTP/1.1\r\n"
- "Host: www.google.com\r\n"
- "Connection: keep-alive\r\n\r\n"),
- };
-
- MockRead data_reads[] = {
- MockRead("HTTP/1.0 200 Connected\r\n\r\n"),
- MockRead("HTTP/1.1 200 OK\r\n"),
- MockRead("Content-Type: text/html; charset=iso-8859-1\r\n"),
- MockRead("Content-Length: 100\r\n\r\n"),
- MockRead(false, OK),
- };
-
- StaticSocketDataProvider data(data_reads, arraysize(data_reads),
- data_writes, arraysize(data_writes));
- SSLSocketDataProvider proxy_ssl(true, OK); // SSL to the proxy
- SSLSocketDataProvider tunnel_ssl(true, OK); // SSL through the tunnel
-
- session_deps.socket_factory.AddSocketDataProvider(&data);
- session_deps.socket_factory.AddSSLSocketDataProvider(&proxy_ssl);
- session_deps.socket_factory.AddSSLSocketDataProvider(&tunnel_ssl);
-
- TestCompletionCallback callback;
-
- scoped_ptr<HttpTransaction> trans(
- new HttpNetworkTransaction(CreateSession(&session_deps)));
-
- int rv = trans->Start(&request, &callback, BoundNetLog());
- EXPECT_EQ(ERR_IO_PENDING, rv);
-
- rv = callback.WaitForResult();
- EXPECT_EQ(OK, rv);
- const HttpResponseInfo* response = trans->GetResponseInfo();
-
- ASSERT_FALSE(response == NULL);
-
- EXPECT_TRUE(response->headers->IsKeepAlive());
- EXPECT_EQ(200, response->headers->response_code());
- EXPECT_EQ(100, response->headers->GetContentLength());
- EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion());
-}
-
-// Test HTTPS connections to a site with a bad certificate, going through an
-// HTTPS proxy
-TEST_F(HttpNetworkTransactionTest, HTTPSBadCertificateViaHttpsProxy) {
- SessionDependencies session_deps(CreateFixedProxyService("https://proxy:70"));
-
- HttpRequestInfo request;
- request.method = "GET";
- request.url = GURL("https://www.google.com/");
- request.load_flags = 0;
-
- // Attempt to fetch the URL from a server with a bad cert
- MockWrite bad_cert_writes[] = {
- MockWrite("CONNECT www.google.com:443 HTTP/1.1\r\n"
- "Host: www.google.com\r\n"
- "Proxy-Connection: keep-alive\r\n\r\n"),
- };
-
- MockRead bad_cert_reads[] = {
- MockRead("HTTP/1.0 200 Connected\r\n\r\n"),
- MockRead(false, OK)
- };
-
- // Attempt to fetch the URL with a good cert
- MockWrite good_data_writes[] = {
- MockWrite("CONNECT www.google.com:443 HTTP/1.1\r\n"
- "Host: www.google.com\r\n"
- "Proxy-Connection: keep-alive\r\n\r\n"),
- MockWrite("GET / HTTP/1.1\r\n"
- "Host: www.google.com\r\n"
- "Connection: keep-alive\r\n\r\n"),
- };
-
- MockRead good_cert_reads[] = {
- MockRead("HTTP/1.0 200 Connected\r\n\r\n"),
- MockRead("HTTP/1.0 200 OK\r\n"),
- MockRead("Content-Type: text/html; charset=iso-8859-1\r\n"),
- MockRead("Content-Length: 100\r\n\r\n"),
- MockRead(false, OK),
- };
-
- StaticSocketDataProvider ssl_bad_certificate(
- bad_cert_reads, arraysize(bad_cert_reads),
- bad_cert_writes, arraysize(bad_cert_writes));
- StaticSocketDataProvider data(good_cert_reads, arraysize(good_cert_reads),
- good_data_writes, arraysize(good_data_writes));
- SSLSocketDataProvider ssl_bad(true, ERR_CERT_AUTHORITY_INVALID);
- SSLSocketDataProvider ssl(true, OK);
-
- // SSL to the proxy, then CONNECT request, then SSL with bad certificate
- session_deps.socket_factory.AddSSLSocketDataProvider(&ssl);
- session_deps.socket_factory.AddSocketDataProvider(&ssl_bad_certificate);
- session_deps.socket_factory.AddSSLSocketDataProvider(&ssl_bad);
-
- // SSL to the proxy, then CONNECT request, then valid SSL certificate
- session_deps.socket_factory.AddSSLSocketDataProvider(&ssl);
- session_deps.socket_factory.AddSocketDataProvider(&data);
- session_deps.socket_factory.AddSSLSocketDataProvider(&ssl);
-
- TestCompletionCallback callback;
-
- scoped_ptr<HttpTransaction> trans(
- new HttpNetworkTransaction(CreateSession(&session_deps)));
-
- int rv = trans->Start(&request, &callback, BoundNetLog());
- EXPECT_EQ(ERR_IO_PENDING, rv);
-
- rv = callback.WaitForResult();
- EXPECT_EQ(ERR_CERT_AUTHORITY_INVALID, rv);
-
- rv = trans->RestartIgnoringLastError(&callback);
- EXPECT_EQ(ERR_IO_PENDING, rv);
-
- rv = callback.WaitForResult();
- EXPECT_EQ(OK, rv);
-
- const HttpResponseInfo* response = trans->GetResponseInfo();
-
- EXPECT_FALSE(response == NULL);
- EXPECT_EQ(100, response->headers->GetContentLength());
-}
-
TEST_F(HttpNetworkTransactionTest, BuildRequest_UserAgent) {
SessionDependencies session_deps;
scoped_ptr<HttpTransaction> trans(