| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/http/http_network_transaction.h" | 5 #include "net/http/http_network_transaction.h" |
| 6 | 6 |
| 7 #include <math.h> // ceil | 7 #include <math.h> // ceil |
| 8 #include <stdarg.h> | 8 #include <stdarg.h> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 #include "net/http/http_basic_state.h" | 43 #include "net/http/http_basic_state.h" |
| 44 #include "net/http/http_basic_stream.h" | 44 #include "net/http/http_basic_stream.h" |
| 45 #include "net/http/http_network_session.h" | 45 #include "net/http/http_network_session.h" |
| 46 #include "net/http/http_network_session_peer.h" | 46 #include "net/http/http_network_session_peer.h" |
| 47 #include "net/http/http_request_headers.h" | 47 #include "net/http/http_request_headers.h" |
| 48 #include "net/http/http_server_properties_impl.h" | 48 #include "net/http/http_server_properties_impl.h" |
| 49 #include "net/http/http_stream.h" | 49 #include "net/http/http_stream.h" |
| 50 #include "net/http/http_stream_factory.h" | 50 #include "net/http/http_stream_factory.h" |
| 51 #include "net/http/http_stream_parser.h" | 51 #include "net/http/http_stream_parser.h" |
| 52 #include "net/http/http_transaction_test_util.h" | 52 #include "net/http/http_transaction_test_util.h" |
| 53 #include "net/log/capturing_net_log.h" | |
| 54 #include "net/log/net_log.h" | 53 #include "net/log/net_log.h" |
| 55 #include "net/log/net_log_unittest.h" | 54 #include "net/log/net_log_unittest.h" |
| 55 #include "net/log/test_net_log.h" |
| 56 #include "net/proxy/mock_proxy_resolver.h" | 56 #include "net/proxy/mock_proxy_resolver.h" |
| 57 #include "net/proxy/proxy_config_service_fixed.h" | 57 #include "net/proxy/proxy_config_service_fixed.h" |
| 58 #include "net/proxy/proxy_info.h" | 58 #include "net/proxy/proxy_info.h" |
| 59 #include "net/proxy/proxy_resolver.h" | 59 #include "net/proxy/proxy_resolver.h" |
| 60 #include "net/proxy/proxy_service.h" | 60 #include "net/proxy/proxy_service.h" |
| 61 #include "net/socket/client_socket_factory.h" | 61 #include "net/socket/client_socket_factory.h" |
| 62 #include "net/socket/client_socket_pool_manager.h" | 62 #include "net/socket/client_socket_pool_manager.h" |
| 63 #include "net/socket/mock_client_socket_pool_manager.h" | 63 #include "net/socket/mock_client_socket_pool_manager.h" |
| 64 #include "net/socket/next_proto.h" | 64 #include "net/socket/next_proto.h" |
| 65 #include "net/socket/socket_test_util.h" | 65 #include "net/socket/socket_test_util.h" |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 return out; | 351 return out; |
| 352 } | 352 } |
| 353 out.status_line = response->headers->GetStatusLine(); | 353 out.status_line = response->headers->GetStatusLine(); |
| 354 | 354 |
| 355 EXPECT_EQ("127.0.0.1", response->socket_address.host()); | 355 EXPECT_EQ("127.0.0.1", response->socket_address.host()); |
| 356 EXPECT_EQ(80, response->socket_address.port()); | 356 EXPECT_EQ(80, response->socket_address.port()); |
| 357 | 357 |
| 358 rv = ReadTransaction(trans.get(), &out.response_data); | 358 rv = ReadTransaction(trans.get(), &out.response_data); |
| 359 EXPECT_EQ(OK, rv); | 359 EXPECT_EQ(OK, rv); |
| 360 | 360 |
| 361 net::CapturingNetLog::CapturedEntryList entries; | 361 net::TestNetLog::CapturedEntryList entries; |
| 362 log.GetEntries(&entries); | 362 log.GetEntries(&entries); |
| 363 size_t pos = ExpectLogContainsSomewhere( | 363 size_t pos = ExpectLogContainsSomewhere( |
| 364 entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_REQUEST_HEADERS, | 364 entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_REQUEST_HEADERS, |
| 365 NetLog::PHASE_NONE); | 365 NetLog::PHASE_NONE); |
| 366 ExpectLogContainsSomewhere( | 366 ExpectLogContainsSomewhere( |
| 367 entries, pos, | 367 entries, pos, |
| 368 NetLog::TYPE_HTTP_TRANSACTION_READ_RESPONSE_HEADERS, | 368 NetLog::TYPE_HTTP_TRANSACTION_READ_RESPONSE_HEADERS, |
| 369 NetLog::PHASE_NONE); | 369 NetLog::PHASE_NONE); |
| 370 | 370 |
| 371 std::string line; | 371 std::string line; |
| (...skipping 894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1266 } | 1266 } |
| 1267 | 1267 |
| 1268 void HttpNetworkTransactionTest::KeepAliveConnectionResendRequestTest( | 1268 void HttpNetworkTransactionTest::KeepAliveConnectionResendRequestTest( |
| 1269 const MockWrite* write_failure, | 1269 const MockWrite* write_failure, |
| 1270 const MockRead* read_failure) { | 1270 const MockRead* read_failure) { |
| 1271 HttpRequestInfo request; | 1271 HttpRequestInfo request; |
| 1272 request.method = "GET"; | 1272 request.method = "GET"; |
| 1273 request.url = GURL("http://www.foo.com/"); | 1273 request.url = GURL("http://www.foo.com/"); |
| 1274 request.load_flags = 0; | 1274 request.load_flags = 0; |
| 1275 | 1275 |
| 1276 CapturingNetLog net_log; | 1276 TestNetLog net_log; |
| 1277 session_deps_.net_log = &net_log; | 1277 session_deps_.net_log = &net_log; |
| 1278 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 1278 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 1279 | 1279 |
| 1280 // Written data for successfully sending both requests. | 1280 // Written data for successfully sending both requests. |
| 1281 MockWrite data1_writes[] = { | 1281 MockWrite data1_writes[] = { |
| 1282 MockWrite("GET / HTTP/1.1\r\n" | 1282 MockWrite("GET / HTTP/1.1\r\n" |
| 1283 "Host: www.foo.com\r\n" | 1283 "Host: www.foo.com\r\n" |
| 1284 "Connection: keep-alive\r\n\r\n"), | 1284 "Connection: keep-alive\r\n\r\n"), |
| 1285 MockWrite("GET / HTTP/1.1\r\n" | 1285 MockWrite("GET / HTTP/1.1\r\n" |
| 1286 "Host: www.foo.com\r\n" | 1286 "Host: www.foo.com\r\n" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1356 | 1356 |
| 1357 void HttpNetworkTransactionTest::PreconnectErrorResendRequestTest( | 1357 void HttpNetworkTransactionTest::PreconnectErrorResendRequestTest( |
| 1358 const MockWrite* write_failure, | 1358 const MockWrite* write_failure, |
| 1359 const MockRead* read_failure, | 1359 const MockRead* read_failure, |
| 1360 bool use_spdy) { | 1360 bool use_spdy) { |
| 1361 HttpRequestInfo request; | 1361 HttpRequestInfo request; |
| 1362 request.method = "GET"; | 1362 request.method = "GET"; |
| 1363 request.url = GURL("https://www.foo.com/"); | 1363 request.url = GURL("https://www.foo.com/"); |
| 1364 request.load_flags = 0; | 1364 request.load_flags = 0; |
| 1365 | 1365 |
| 1366 CapturingNetLog net_log; | 1366 TestNetLog net_log; |
| 1367 session_deps_.net_log = &net_log; | 1367 session_deps_.net_log = &net_log; |
| 1368 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 1368 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 1369 | 1369 |
| 1370 SSLSocketDataProvider ssl1(ASYNC, OK); | 1370 SSLSocketDataProvider ssl1(ASYNC, OK); |
| 1371 SSLSocketDataProvider ssl2(ASYNC, OK); | 1371 SSLSocketDataProvider ssl2(ASYNC, OK); |
| 1372 if (use_spdy) { | 1372 if (use_spdy) { |
| 1373 ssl1.SetNextProto(GetParam()); | 1373 ssl1.SetNextProto(GetParam()); |
| 1374 ssl2.SetNextProto(GetParam()); | 1374 ssl2.SetNextProto(GetParam()); |
| 1375 } | 1375 } |
| 1376 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl1); | 1376 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl1); |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1770 } | 1770 } |
| 1771 | 1771 |
| 1772 // Test that we correctly reuse a keep-alive connection after not explicitly | 1772 // Test that we correctly reuse a keep-alive connection after not explicitly |
| 1773 // reading the body. | 1773 // reading the body. |
| 1774 TEST_P(HttpNetworkTransactionTest, KeepAliveAfterUnreadBody) { | 1774 TEST_P(HttpNetworkTransactionTest, KeepAliveAfterUnreadBody) { |
| 1775 HttpRequestInfo request; | 1775 HttpRequestInfo request; |
| 1776 request.method = "GET"; | 1776 request.method = "GET"; |
| 1777 request.url = GURL("http://www.foo.com/"); | 1777 request.url = GURL("http://www.foo.com/"); |
| 1778 request.load_flags = 0; | 1778 request.load_flags = 0; |
| 1779 | 1779 |
| 1780 CapturingNetLog net_log; | 1780 TestNetLog net_log; |
| 1781 session_deps_.net_log = &net_log; | 1781 session_deps_.net_log = &net_log; |
| 1782 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 1782 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 1783 | 1783 |
| 1784 // Note that because all these reads happen in the same | 1784 // Note that because all these reads happen in the same |
| 1785 // StaticSocketDataProvider, it shows that the same socket is being reused for | 1785 // StaticSocketDataProvider, it shows that the same socket is being reused for |
| 1786 // all transactions. | 1786 // all transactions. |
| 1787 MockRead data1_reads[] = { | 1787 MockRead data1_reads[] = { |
| 1788 MockRead("HTTP/1.1 204 No Content\r\n\r\n"), | 1788 MockRead("HTTP/1.1 204 No Content\r\n\r\n"), |
| 1789 MockRead("HTTP/1.1 205 Reset Content\r\n\r\n"), | 1789 MockRead("HTTP/1.1 205 Reset Content\r\n\r\n"), |
| 1790 MockRead("HTTP/1.1 304 Not Modified\r\n\r\n"), | 1790 MockRead("HTTP/1.1 304 Not Modified\r\n\r\n"), |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1879 } | 1879 } |
| 1880 | 1880 |
| 1881 // Test the request-challenge-retry sequence for basic auth. | 1881 // Test the request-challenge-retry sequence for basic auth. |
| 1882 // (basic auth is the easiest to mock, because it has no randomness). | 1882 // (basic auth is the easiest to mock, because it has no randomness). |
| 1883 TEST_P(HttpNetworkTransactionTest, BasicAuth) { | 1883 TEST_P(HttpNetworkTransactionTest, BasicAuth) { |
| 1884 HttpRequestInfo request; | 1884 HttpRequestInfo request; |
| 1885 request.method = "GET"; | 1885 request.method = "GET"; |
| 1886 request.url = GURL("http://www.google.com/"); | 1886 request.url = GURL("http://www.google.com/"); |
| 1887 request.load_flags = 0; | 1887 request.load_flags = 0; |
| 1888 | 1888 |
| 1889 CapturingNetLog log; | 1889 TestNetLog log; |
| 1890 session_deps_.net_log = &log; | 1890 session_deps_.net_log = &log; |
| 1891 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 1891 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 1892 scoped_ptr<HttpTransaction> trans( | 1892 scoped_ptr<HttpTransaction> trans( |
| 1893 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 1893 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 1894 | 1894 |
| 1895 MockWrite data_writes1[] = { | 1895 MockWrite data_writes1[] = { |
| 1896 MockWrite("GET / HTTP/1.1\r\n" | 1896 MockWrite("GET / HTTP/1.1\r\n" |
| 1897 "Host: www.google.com\r\n" | 1897 "Host: www.google.com\r\n" |
| 1898 "Connection: keep-alive\r\n\r\n"), | 1898 "Connection: keep-alive\r\n\r\n"), |
| 1899 }; | 1899 }; |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2026 } | 2026 } |
| 2027 | 2027 |
| 2028 // Test the request-challenge-retry sequence for basic auth, over a keep-alive | 2028 // Test the request-challenge-retry sequence for basic auth, over a keep-alive |
| 2029 // connection. | 2029 // connection. |
| 2030 TEST_P(HttpNetworkTransactionTest, BasicAuthKeepAlive) { | 2030 TEST_P(HttpNetworkTransactionTest, BasicAuthKeepAlive) { |
| 2031 HttpRequestInfo request; | 2031 HttpRequestInfo request; |
| 2032 request.method = "GET"; | 2032 request.method = "GET"; |
| 2033 request.url = GURL("http://www.google.com/"); | 2033 request.url = GURL("http://www.google.com/"); |
| 2034 request.load_flags = 0; | 2034 request.load_flags = 0; |
| 2035 | 2035 |
| 2036 CapturingNetLog log; | 2036 TestNetLog log; |
| 2037 session_deps_.net_log = &log; | 2037 session_deps_.net_log = &log; |
| 2038 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 2038 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 2039 | 2039 |
| 2040 MockWrite data_writes1[] = { | 2040 MockWrite data_writes1[] = { |
| 2041 MockWrite("GET / HTTP/1.1\r\n" | 2041 MockWrite("GET / HTTP/1.1\r\n" |
| 2042 "Host: www.google.com\r\n" | 2042 "Host: www.google.com\r\n" |
| 2043 "Connection: keep-alive\r\n\r\n"), | 2043 "Connection: keep-alive\r\n\r\n"), |
| 2044 | 2044 |
| 2045 // After calling trans->RestartWithAuth(), this is the request we should | 2045 // After calling trans->RestartWithAuth(), this is the request we should |
| 2046 // be issuing -- the final header line contains the credentials. | 2046 // be issuing -- the final header line contains the credentials. |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2432 TestCompletionCallback callback1; | 2432 TestCompletionCallback callback1; |
| 2433 | 2433 |
| 2434 scoped_ptr<HttpTransaction> trans( | 2434 scoped_ptr<HttpTransaction> trans( |
| 2435 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 2435 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 2436 | 2436 |
| 2437 int rv = trans->Start(&request, callback1.callback(), log.bound()); | 2437 int rv = trans->Start(&request, callback1.callback(), log.bound()); |
| 2438 EXPECT_EQ(ERR_IO_PENDING, rv); | 2438 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 2439 | 2439 |
| 2440 rv = callback1.WaitForResult(); | 2440 rv = callback1.WaitForResult(); |
| 2441 EXPECT_EQ(OK, rv); | 2441 EXPECT_EQ(OK, rv); |
| 2442 net::CapturingNetLog::CapturedEntryList entries; | 2442 net::TestNetLog::CapturedEntryList entries; |
| 2443 log.GetEntries(&entries); | 2443 log.GetEntries(&entries); |
| 2444 size_t pos = ExpectLogContainsSomewhere( | 2444 size_t pos = ExpectLogContainsSomewhere( |
| 2445 entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, | 2445 entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, |
| 2446 NetLog::PHASE_NONE); | 2446 NetLog::PHASE_NONE); |
| 2447 ExpectLogContainsSomewhere( | 2447 ExpectLogContainsSomewhere( |
| 2448 entries, pos, NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, | 2448 entries, pos, NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, |
| 2449 NetLog::PHASE_NONE); | 2449 NetLog::PHASE_NONE); |
| 2450 | 2450 |
| 2451 const HttpResponseInfo* response = trans->GetResponseInfo(); | 2451 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 2452 ASSERT_TRUE(response != NULL); | 2452 ASSERT_TRUE(response != NULL); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2548 TestCompletionCallback callback1; | 2548 TestCompletionCallback callback1; |
| 2549 | 2549 |
| 2550 scoped_ptr<HttpTransaction> trans( | 2550 scoped_ptr<HttpTransaction> trans( |
| 2551 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 2551 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 2552 | 2552 |
| 2553 int rv = trans->Start(&request, callback1.callback(), log.bound()); | 2553 int rv = trans->Start(&request, callback1.callback(), log.bound()); |
| 2554 EXPECT_EQ(ERR_IO_PENDING, rv); | 2554 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 2555 | 2555 |
| 2556 rv = callback1.WaitForResult(); | 2556 rv = callback1.WaitForResult(); |
| 2557 EXPECT_EQ(OK, rv); | 2557 EXPECT_EQ(OK, rv); |
| 2558 net::CapturingNetLog::CapturedEntryList entries; | 2558 net::TestNetLog::CapturedEntryList entries; |
| 2559 log.GetEntries(&entries); | 2559 log.GetEntries(&entries); |
| 2560 size_t pos = ExpectLogContainsSomewhere( | 2560 size_t pos = ExpectLogContainsSomewhere( |
| 2561 entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, | 2561 entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, |
| 2562 NetLog::PHASE_NONE); | 2562 NetLog::PHASE_NONE); |
| 2563 ExpectLogContainsSomewhere( | 2563 ExpectLogContainsSomewhere( |
| 2564 entries, pos, | 2564 entries, pos, |
| 2565 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, | 2565 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, |
| 2566 NetLog::PHASE_NONE); | 2566 NetLog::PHASE_NONE); |
| 2567 | 2567 |
| 2568 const HttpResponseInfo* response = trans->GetResponseInfo(); | 2568 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2664 data_writes1, arraysize(data_writes1)); | 2664 data_writes1, arraysize(data_writes1)); |
| 2665 session_deps_.socket_factory->AddSocketDataProvider(&data1); | 2665 session_deps_.socket_factory->AddSocketDataProvider(&data1); |
| 2666 | 2666 |
| 2667 TestCompletionCallback callback1; | 2667 TestCompletionCallback callback1; |
| 2668 | 2668 |
| 2669 int rv = trans->Start(&request, callback1.callback(), log.bound()); | 2669 int rv = trans->Start(&request, callback1.callback(), log.bound()); |
| 2670 EXPECT_EQ(ERR_IO_PENDING, rv); | 2670 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 2671 | 2671 |
| 2672 rv = callback1.WaitForResult(); | 2672 rv = callback1.WaitForResult(); |
| 2673 EXPECT_EQ(OK, rv); | 2673 EXPECT_EQ(OK, rv); |
| 2674 net::CapturingNetLog::CapturedEntryList entries; | 2674 net::TestNetLog::CapturedEntryList entries; |
| 2675 log.GetEntries(&entries); | 2675 log.GetEntries(&entries); |
| 2676 size_t pos = ExpectLogContainsSomewhere( | 2676 size_t pos = ExpectLogContainsSomewhere( |
| 2677 entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, | 2677 entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, |
| 2678 NetLog::PHASE_NONE); | 2678 NetLog::PHASE_NONE); |
| 2679 ExpectLogContainsSomewhere( | 2679 ExpectLogContainsSomewhere( |
| 2680 entries, pos, NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, | 2680 entries, pos, NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, |
| 2681 NetLog::PHASE_NONE); | 2681 NetLog::PHASE_NONE); |
| 2682 | 2682 |
| 2683 const HttpResponseInfo* response = trans->GetResponseInfo(); | 2683 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 2684 ASSERT_TRUE(response); | 2684 ASSERT_TRUE(response); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2767 data_writes1, arraysize(data_writes1)); | 2767 data_writes1, arraysize(data_writes1)); |
| 2768 session_deps_.socket_factory->AddSocketDataProvider(&data1); | 2768 session_deps_.socket_factory->AddSocketDataProvider(&data1); |
| 2769 | 2769 |
| 2770 TestCompletionCallback callback1; | 2770 TestCompletionCallback callback1; |
| 2771 | 2771 |
| 2772 int rv = trans->Start(&request, callback1.callback(), log.bound()); | 2772 int rv = trans->Start(&request, callback1.callback(), log.bound()); |
| 2773 EXPECT_EQ(ERR_IO_PENDING, rv); | 2773 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 2774 | 2774 |
| 2775 rv = callback1.WaitForResult(); | 2775 rv = callback1.WaitForResult(); |
| 2776 EXPECT_EQ(OK, rv); | 2776 EXPECT_EQ(OK, rv); |
| 2777 net::CapturingNetLog::CapturedEntryList entries; | 2777 net::TestNetLog::CapturedEntryList entries; |
| 2778 log.GetEntries(&entries); | 2778 log.GetEntries(&entries); |
| 2779 size_t pos = ExpectLogContainsSomewhere( | 2779 size_t pos = ExpectLogContainsSomewhere( |
| 2780 entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, | 2780 entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, |
| 2781 NetLog::PHASE_NONE); | 2781 NetLog::PHASE_NONE); |
| 2782 ExpectLogContainsSomewhere( | 2782 ExpectLogContainsSomewhere( |
| 2783 entries, pos, | 2783 entries, pos, |
| 2784 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, | 2784 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, |
| 2785 NetLog::PHASE_NONE); | 2785 NetLog::PHASE_NONE); |
| 2786 | 2786 |
| 2787 const HttpResponseInfo* response = trans->GetResponseInfo(); | 2787 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3026 TestCompletionCallback callback1; | 3026 TestCompletionCallback callback1; |
| 3027 | 3027 |
| 3028 scoped_ptr<HttpTransaction> trans( | 3028 scoped_ptr<HttpTransaction> trans( |
| 3029 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 3029 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 3030 | 3030 |
| 3031 int rv = trans->Start(&request, callback1.callback(), log.bound()); | 3031 int rv = trans->Start(&request, callback1.callback(), log.bound()); |
| 3032 EXPECT_EQ(ERR_IO_PENDING, rv); | 3032 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 3033 | 3033 |
| 3034 rv = callback1.WaitForResult(); | 3034 rv = callback1.WaitForResult(); |
| 3035 EXPECT_EQ(ERR_UNEXPECTED_PROXY_AUTH, rv); | 3035 EXPECT_EQ(ERR_UNEXPECTED_PROXY_AUTH, rv); |
| 3036 net::CapturingNetLog::CapturedEntryList entries; | 3036 net::TestNetLog::CapturedEntryList entries; |
| 3037 log.GetEntries(&entries); | 3037 log.GetEntries(&entries); |
| 3038 size_t pos = ExpectLogContainsSomewhere( | 3038 size_t pos = ExpectLogContainsSomewhere( |
| 3039 entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, | 3039 entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, |
| 3040 NetLog::PHASE_NONE); | 3040 NetLog::PHASE_NONE); |
| 3041 ExpectLogContainsSomewhere( | 3041 ExpectLogContainsSomewhere( |
| 3042 entries, pos, | 3042 entries, pos, |
| 3043 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, | 3043 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, |
| 3044 NetLog::PHASE_NONE); | 3044 NetLog::PHASE_NONE); |
| 3045 } | 3045 } |
| 3046 | 3046 |
| (...skipping 3320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6367 ASSERT_TRUE(response != NULL); | 6367 ASSERT_TRUE(response != NULL); |
| 6368 EXPECT_EQ(100, response->headers->GetContentLength()); | 6368 EXPECT_EQ(100, response->headers->GetContentLength()); |
| 6369 } | 6369 } |
| 6370 } | 6370 } |
| 6371 | 6371 |
| 6372 | 6372 |
| 6373 // Test HTTPS connections to a site, going through an HTTPS proxy | 6373 // Test HTTPS connections to a site, going through an HTTPS proxy |
| 6374 TEST_P(HttpNetworkTransactionTest, HTTPSViaHttpsProxy) { | 6374 TEST_P(HttpNetworkTransactionTest, HTTPSViaHttpsProxy) { |
| 6375 session_deps_.proxy_service.reset( | 6375 session_deps_.proxy_service.reset( |
| 6376 ProxyService::CreateFixedFromPacResult("HTTPS proxy:70")); | 6376 ProxyService::CreateFixedFromPacResult("HTTPS proxy:70")); |
| 6377 CapturingNetLog net_log; | 6377 TestNetLog net_log; |
| 6378 session_deps_.net_log = &net_log; | 6378 session_deps_.net_log = &net_log; |
| 6379 | 6379 |
| 6380 HttpRequestInfo request; | 6380 HttpRequestInfo request; |
| 6381 request.method = "GET"; | 6381 request.method = "GET"; |
| 6382 request.url = GURL("https://www.google.com/"); | 6382 request.url = GURL("https://www.google.com/"); |
| 6383 request.load_flags = 0; | 6383 request.load_flags = 0; |
| 6384 | 6384 |
| 6385 MockWrite data_writes[] = { | 6385 MockWrite data_writes[] = { |
| 6386 MockWrite("CONNECT www.google.com:443 HTTP/1.1\r\n" | 6386 MockWrite("CONNECT www.google.com:443 HTTP/1.1\r\n" |
| 6387 "Host: www.google.com\r\n" | 6387 "Host: www.google.com\r\n" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6431 LoadTimingInfo load_timing_info; | 6431 LoadTimingInfo load_timing_info; |
| 6432 EXPECT_TRUE(trans->GetLoadTimingInfo(&load_timing_info)); | 6432 EXPECT_TRUE(trans->GetLoadTimingInfo(&load_timing_info)); |
| 6433 TestLoadTimingNotReusedWithPac(load_timing_info, | 6433 TestLoadTimingNotReusedWithPac(load_timing_info, |
| 6434 CONNECT_TIMING_HAS_SSL_TIMES); | 6434 CONNECT_TIMING_HAS_SSL_TIMES); |
| 6435 } | 6435 } |
| 6436 | 6436 |
| 6437 // Test an HTTPS Proxy's ability to redirect a CONNECT request | 6437 // Test an HTTPS Proxy's ability to redirect a CONNECT request |
| 6438 TEST_P(HttpNetworkTransactionTest, RedirectOfHttpsConnectViaHttpsProxy) { | 6438 TEST_P(HttpNetworkTransactionTest, RedirectOfHttpsConnectViaHttpsProxy) { |
| 6439 session_deps_.proxy_service.reset( | 6439 session_deps_.proxy_service.reset( |
| 6440 ProxyService::CreateFixedFromPacResult("HTTPS proxy:70")); | 6440 ProxyService::CreateFixedFromPacResult("HTTPS proxy:70")); |
| 6441 CapturingNetLog net_log; | 6441 TestNetLog net_log; |
| 6442 session_deps_.net_log = &net_log; | 6442 session_deps_.net_log = &net_log; |
| 6443 | 6443 |
| 6444 HttpRequestInfo request; | 6444 HttpRequestInfo request; |
| 6445 request.method = "GET"; | 6445 request.method = "GET"; |
| 6446 request.url = GURL("https://www.google.com/"); | 6446 request.url = GURL("https://www.google.com/"); |
| 6447 request.load_flags = 0; | 6447 request.load_flags = 0; |
| 6448 | 6448 |
| 6449 MockWrite data_writes[] = { | 6449 MockWrite data_writes[] = { |
| 6450 MockWrite("CONNECT www.google.com:443 HTTP/1.1\r\n" | 6450 MockWrite("CONNECT www.google.com:443 HTTP/1.1\r\n" |
| 6451 "Host: www.google.com\r\n" | 6451 "Host: www.google.com\r\n" |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6764 TestCompletionCallback callback1; | 6764 TestCompletionCallback callback1; |
| 6765 | 6765 |
| 6766 scoped_ptr<HttpTransaction> trans( | 6766 scoped_ptr<HttpTransaction> trans( |
| 6767 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 6767 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 6768 | 6768 |
| 6769 int rv = trans->Start(&request, callback1.callback(), log.bound()); | 6769 int rv = trans->Start(&request, callback1.callback(), log.bound()); |
| 6770 EXPECT_EQ(ERR_IO_PENDING, rv); | 6770 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 6771 | 6771 |
| 6772 rv = callback1.WaitForResult(); | 6772 rv = callback1.WaitForResult(); |
| 6773 EXPECT_EQ(OK, rv); | 6773 EXPECT_EQ(OK, rv); |
| 6774 net::CapturingNetLog::CapturedEntryList entries; | 6774 net::TestNetLog::CapturedEntryList entries; |
| 6775 log.GetEntries(&entries); | 6775 log.GetEntries(&entries); |
| 6776 size_t pos = ExpectLogContainsSomewhere( | 6776 size_t pos = ExpectLogContainsSomewhere( |
| 6777 entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, | 6777 entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, |
| 6778 NetLog::PHASE_NONE); | 6778 NetLog::PHASE_NONE); |
| 6779 ExpectLogContainsSomewhere( | 6779 ExpectLogContainsSomewhere( |
| 6780 entries, pos, | 6780 entries, pos, |
| 6781 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, | 6781 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, |
| 6782 NetLog::PHASE_NONE); | 6782 NetLog::PHASE_NONE); |
| 6783 | 6783 |
| 6784 const HttpResponseInfo* response = trans->GetResponseInfo(); | 6784 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| (...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7491 } | 7491 } |
| 7492 | 7492 |
| 7493 TEST_P(HttpNetworkTransactionTest, SOCKS4_HTTP_GET) { | 7493 TEST_P(HttpNetworkTransactionTest, SOCKS4_HTTP_GET) { |
| 7494 HttpRequestInfo request; | 7494 HttpRequestInfo request; |
| 7495 request.method = "GET"; | 7495 request.method = "GET"; |
| 7496 request.url = GURL("http://www.google.com/"); | 7496 request.url = GURL("http://www.google.com/"); |
| 7497 request.load_flags = 0; | 7497 request.load_flags = 0; |
| 7498 | 7498 |
| 7499 session_deps_.proxy_service.reset( | 7499 session_deps_.proxy_service.reset( |
| 7500 ProxyService::CreateFixedFromPacResult("SOCKS myproxy:1080")); | 7500 ProxyService::CreateFixedFromPacResult("SOCKS myproxy:1080")); |
| 7501 CapturingNetLog net_log; | 7501 TestNetLog net_log; |
| 7502 session_deps_.net_log = &net_log; | 7502 session_deps_.net_log = &net_log; |
| 7503 | 7503 |
| 7504 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 7504 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 7505 scoped_ptr<HttpTransaction> trans( | 7505 scoped_ptr<HttpTransaction> trans( |
| 7506 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 7506 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 7507 | 7507 |
| 7508 char write_buffer[] = { 0x04, 0x01, 0x00, 0x50, 127, 0, 0, 1, 0 }; | 7508 char write_buffer[] = { 0x04, 0x01, 0x00, 0x50, 127, 0, 0, 1, 0 }; |
| 7509 char read_buffer[] = { 0x00, 0x5A, 0x00, 0x00, 0, 0, 0, 0 }; | 7509 char read_buffer[] = { 0x00, 0x5A, 0x00, 0x00, 0, 0, 0, 0 }; |
| 7510 | 7510 |
| 7511 MockWrite data_writes[] = { | 7511 MockWrite data_writes[] = { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7550 } | 7550 } |
| 7551 | 7551 |
| 7552 TEST_P(HttpNetworkTransactionTest, SOCKS4_SSL_GET) { | 7552 TEST_P(HttpNetworkTransactionTest, SOCKS4_SSL_GET) { |
| 7553 HttpRequestInfo request; | 7553 HttpRequestInfo request; |
| 7554 request.method = "GET"; | 7554 request.method = "GET"; |
| 7555 request.url = GURL("https://www.google.com/"); | 7555 request.url = GURL("https://www.google.com/"); |
| 7556 request.load_flags = 0; | 7556 request.load_flags = 0; |
| 7557 | 7557 |
| 7558 session_deps_.proxy_service.reset( | 7558 session_deps_.proxy_service.reset( |
| 7559 ProxyService::CreateFixedFromPacResult("SOCKS myproxy:1080")); | 7559 ProxyService::CreateFixedFromPacResult("SOCKS myproxy:1080")); |
| 7560 CapturingNetLog net_log; | 7560 TestNetLog net_log; |
| 7561 session_deps_.net_log = &net_log; | 7561 session_deps_.net_log = &net_log; |
| 7562 | 7562 |
| 7563 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 7563 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 7564 scoped_ptr<HttpTransaction> trans( | 7564 scoped_ptr<HttpTransaction> trans( |
| 7565 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 7565 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 7566 | 7566 |
| 7567 unsigned char write_buffer[] = { 0x04, 0x01, 0x01, 0xBB, 127, 0, 0, 1, 0 }; | 7567 unsigned char write_buffer[] = { 0x04, 0x01, 0x01, 0xBB, 127, 0, 0, 1, 0 }; |
| 7568 unsigned char read_buffer[] = { 0x00, 0x5A, 0x00, 0x00, 0, 0, 0, 0 }; | 7568 unsigned char read_buffer[] = { 0x00, 0x5A, 0x00, 0x00, 0, 0, 0, 0 }; |
| 7569 | 7569 |
| 7570 MockWrite data_writes[] = { | 7570 MockWrite data_writes[] = { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7614 } | 7614 } |
| 7615 | 7615 |
| 7616 TEST_P(HttpNetworkTransactionTest, SOCKS4_HTTP_GET_no_PAC) { | 7616 TEST_P(HttpNetworkTransactionTest, SOCKS4_HTTP_GET_no_PAC) { |
| 7617 HttpRequestInfo request; | 7617 HttpRequestInfo request; |
| 7618 request.method = "GET"; | 7618 request.method = "GET"; |
| 7619 request.url = GURL("http://www.google.com/"); | 7619 request.url = GURL("http://www.google.com/"); |
| 7620 request.load_flags = 0; | 7620 request.load_flags = 0; |
| 7621 | 7621 |
| 7622 session_deps_.proxy_service.reset( | 7622 session_deps_.proxy_service.reset( |
| 7623 ProxyService::CreateFixed("socks4://myproxy:1080")); | 7623 ProxyService::CreateFixed("socks4://myproxy:1080")); |
| 7624 CapturingNetLog net_log; | 7624 TestNetLog net_log; |
| 7625 session_deps_.net_log = &net_log; | 7625 session_deps_.net_log = &net_log; |
| 7626 | 7626 |
| 7627 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 7627 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 7628 scoped_ptr<HttpTransaction> trans( | 7628 scoped_ptr<HttpTransaction> trans( |
| 7629 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 7629 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 7630 | 7630 |
| 7631 char write_buffer[] = { 0x04, 0x01, 0x00, 0x50, 127, 0, 0, 1, 0 }; | 7631 char write_buffer[] = { 0x04, 0x01, 0x00, 0x50, 127, 0, 0, 1, 0 }; |
| 7632 char read_buffer[] = { 0x00, 0x5A, 0x00, 0x00, 0, 0, 0, 0 }; | 7632 char read_buffer[] = { 0x00, 0x5A, 0x00, 0x00, 0, 0, 0, 0 }; |
| 7633 | 7633 |
| 7634 MockWrite data_writes[] = { | 7634 MockWrite data_writes[] = { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7673 } | 7673 } |
| 7674 | 7674 |
| 7675 TEST_P(HttpNetworkTransactionTest, SOCKS5_HTTP_GET) { | 7675 TEST_P(HttpNetworkTransactionTest, SOCKS5_HTTP_GET) { |
| 7676 HttpRequestInfo request; | 7676 HttpRequestInfo request; |
| 7677 request.method = "GET"; | 7677 request.method = "GET"; |
| 7678 request.url = GURL("http://www.google.com/"); | 7678 request.url = GURL("http://www.google.com/"); |
| 7679 request.load_flags = 0; | 7679 request.load_flags = 0; |
| 7680 | 7680 |
| 7681 session_deps_.proxy_service.reset( | 7681 session_deps_.proxy_service.reset( |
| 7682 ProxyService::CreateFixedFromPacResult("SOCKS5 myproxy:1080")); | 7682 ProxyService::CreateFixedFromPacResult("SOCKS5 myproxy:1080")); |
| 7683 CapturingNetLog net_log; | 7683 TestNetLog net_log; |
| 7684 session_deps_.net_log = &net_log; | 7684 session_deps_.net_log = &net_log; |
| 7685 | 7685 |
| 7686 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 7686 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 7687 scoped_ptr<HttpTransaction> trans( | 7687 scoped_ptr<HttpTransaction> trans( |
| 7688 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 7688 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 7689 | 7689 |
| 7690 const char kSOCKS5GreetRequest[] = { 0x05, 0x01, 0x00 }; | 7690 const char kSOCKS5GreetRequest[] = { 0x05, 0x01, 0x00 }; |
| 7691 const char kSOCKS5GreetResponse[] = { 0x05, 0x00 }; | 7691 const char kSOCKS5GreetResponse[] = { 0x05, 0x00 }; |
| 7692 const char kSOCKS5OkRequest[] = { | 7692 const char kSOCKS5OkRequest[] = { |
| 7693 0x05, // Version | 7693 0x05, // Version |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7746 } | 7746 } |
| 7747 | 7747 |
| 7748 TEST_P(HttpNetworkTransactionTest, SOCKS5_SSL_GET) { | 7748 TEST_P(HttpNetworkTransactionTest, SOCKS5_SSL_GET) { |
| 7749 HttpRequestInfo request; | 7749 HttpRequestInfo request; |
| 7750 request.method = "GET"; | 7750 request.method = "GET"; |
| 7751 request.url = GURL("https://www.google.com/"); | 7751 request.url = GURL("https://www.google.com/"); |
| 7752 request.load_flags = 0; | 7752 request.load_flags = 0; |
| 7753 | 7753 |
| 7754 session_deps_.proxy_service.reset( | 7754 session_deps_.proxy_service.reset( |
| 7755 ProxyService::CreateFixedFromPacResult("SOCKS5 myproxy:1080")); | 7755 ProxyService::CreateFixedFromPacResult("SOCKS5 myproxy:1080")); |
| 7756 CapturingNetLog net_log; | 7756 TestNetLog net_log; |
| 7757 session_deps_.net_log = &net_log; | 7757 session_deps_.net_log = &net_log; |
| 7758 | 7758 |
| 7759 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 7759 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 7760 scoped_ptr<HttpTransaction> trans( | 7760 scoped_ptr<HttpTransaction> trans( |
| 7761 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 7761 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 7762 | 7762 |
| 7763 const char kSOCKS5GreetRequest[] = { 0x05, 0x01, 0x00 }; | 7763 const char kSOCKS5GreetRequest[] = { 0x05, 0x01, 0x00 }; |
| 7764 const char kSOCKS5GreetResponse[] = { 0x05, 0x00 }; | 7764 const char kSOCKS5GreetResponse[] = { 0x05, 0x00 }; |
| 7765 const unsigned char kSOCKS5OkRequest[] = { | 7765 const unsigned char kSOCKS5OkRequest[] = { |
| 7766 0x05, // Version | 7766 0x05, // Version |
| (...skipping 1750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9517 ProxyConfig proxy_config; | 9517 ProxyConfig proxy_config; |
| 9518 proxy_config.set_auto_detect(true); | 9518 proxy_config.set_auto_detect(true); |
| 9519 proxy_config.set_pac_url(GURL("http://fooproxyurl")); | 9519 proxy_config.set_pac_url(GURL("http://fooproxyurl")); |
| 9520 | 9520 |
| 9521 CapturingProxyResolver capturing_proxy_resolver; | 9521 CapturingProxyResolver capturing_proxy_resolver; |
| 9522 session_deps_.proxy_service.reset(new ProxyService( | 9522 session_deps_.proxy_service.reset(new ProxyService( |
| 9523 new ProxyConfigServiceFixed(proxy_config), | 9523 new ProxyConfigServiceFixed(proxy_config), |
| 9524 make_scoped_ptr( | 9524 make_scoped_ptr( |
| 9525 new ForwardingProxyResolverFactory(&capturing_proxy_resolver)), | 9525 new ForwardingProxyResolverFactory(&capturing_proxy_resolver)), |
| 9526 NULL)); | 9526 NULL)); |
| 9527 CapturingNetLog net_log; | 9527 TestNetLog net_log; |
| 9528 session_deps_.net_log = &net_log; | 9528 session_deps_.net_log = &net_log; |
| 9529 | 9529 |
| 9530 HttpRequestInfo request; | 9530 HttpRequestInfo request; |
| 9531 request.method = "GET"; | 9531 request.method = "GET"; |
| 9532 request.url = GURL("http://www.google.com/"); | 9532 request.url = GURL("http://www.google.com/"); |
| 9533 request.load_flags = 0; | 9533 request.load_flags = 0; |
| 9534 | 9534 |
| 9535 std::string alternate_protocol_http_header = | 9535 std::string alternate_protocol_http_header = |
| 9536 GetAlternateProtocolHttpHeader(); | 9536 GetAlternateProtocolHttpHeader(); |
| 9537 | 9537 |
| (...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10448 }; | 10448 }; |
| 10449 | 10449 |
| 10450 TEST_P(HttpNetworkTransactionTest, SpdyAlternateProtocolThroughProxy) { | 10450 TEST_P(HttpNetworkTransactionTest, SpdyAlternateProtocolThroughProxy) { |
| 10451 // This test ensures that the URL passed into the proxy is upgraded | 10451 // This test ensures that the URL passed into the proxy is upgraded |
| 10452 // to https when doing an Alternate Protocol upgrade. | 10452 // to https when doing an Alternate Protocol upgrade. |
| 10453 session_deps_.use_alternate_protocols = true; | 10453 session_deps_.use_alternate_protocols = true; |
| 10454 session_deps_.next_protos = SpdyNextProtos(); | 10454 session_deps_.next_protos = SpdyNextProtos(); |
| 10455 | 10455 |
| 10456 session_deps_.proxy_service.reset( | 10456 session_deps_.proxy_service.reset( |
| 10457 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); | 10457 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); |
| 10458 CapturingNetLog net_log; | 10458 TestNetLog net_log; |
| 10459 session_deps_.net_log = &net_log; | 10459 session_deps_.net_log = &net_log; |
| 10460 GURL request_url; | 10460 GURL request_url; |
| 10461 { | 10461 { |
| 10462 HttpAuthHandlerMock::Factory* auth_factory = | 10462 HttpAuthHandlerMock::Factory* auth_factory = |
| 10463 new HttpAuthHandlerMock::Factory(); | 10463 new HttpAuthHandlerMock::Factory(); |
| 10464 UrlRecordingHttpAuthHandlerMock* auth_handler = | 10464 UrlRecordingHttpAuthHandlerMock* auth_handler = |
| 10465 new UrlRecordingHttpAuthHandlerMock(&request_url); | 10465 new UrlRecordingHttpAuthHandlerMock(&request_url); |
| 10466 auth_factory->AddMockHandler(auth_handler, HttpAuth::AUTH_PROXY); | 10466 auth_factory->AddMockHandler(auth_handler, HttpAuth::AUTH_PROXY); |
| 10467 auth_factory->set_do_init_from_challenge(true); | 10467 auth_factory->set_do_init_from_challenge(true); |
| 10468 session_deps_.http_auth_handler_factory.reset(auth_factory); | 10468 session_deps_.http_auth_handler_factory.reset(auth_factory); |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10801 TestCompletionCallback callback1; | 10801 TestCompletionCallback callback1; |
| 10802 | 10802 |
| 10803 scoped_ptr<HttpTransaction> trans( | 10803 scoped_ptr<HttpTransaction> trans( |
| 10804 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 10804 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 10805 | 10805 |
| 10806 int rv = trans->Start(&request, callback1.callback(), log.bound()); | 10806 int rv = trans->Start(&request, callback1.callback(), log.bound()); |
| 10807 EXPECT_EQ(ERR_IO_PENDING, rv); | 10807 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 10808 | 10808 |
| 10809 rv = callback1.WaitForResult(); | 10809 rv = callback1.WaitForResult(); |
| 10810 EXPECT_EQ(OK, rv); | 10810 EXPECT_EQ(OK, rv); |
| 10811 net::CapturingNetLog::CapturedEntryList entries; | 10811 net::TestNetLog::CapturedEntryList entries; |
| 10812 log.GetEntries(&entries); | 10812 log.GetEntries(&entries); |
| 10813 size_t pos = ExpectLogContainsSomewhere( | 10813 size_t pos = ExpectLogContainsSomewhere( |
| 10814 entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, | 10814 entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, |
| 10815 NetLog::PHASE_NONE); | 10815 NetLog::PHASE_NONE); |
| 10816 ExpectLogContainsSomewhere( | 10816 ExpectLogContainsSomewhere( |
| 10817 entries, pos, | 10817 entries, pos, |
| 10818 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, | 10818 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, |
| 10819 NetLog::PHASE_NONE); | 10819 NetLog::PHASE_NONE); |
| 10820 | 10820 |
| 10821 const HttpResponseInfo* response = trans->GetResponseInfo(); | 10821 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10873 TestCompletionCallback callback1; | 10873 TestCompletionCallback callback1; |
| 10874 | 10874 |
| 10875 scoped_ptr<HttpTransaction> trans( | 10875 scoped_ptr<HttpTransaction> trans( |
| 10876 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 10876 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 10877 | 10877 |
| 10878 int rv = trans->Start(&request, callback1.callback(), log.bound()); | 10878 int rv = trans->Start(&request, callback1.callback(), log.bound()); |
| 10879 EXPECT_EQ(ERR_IO_PENDING, rv); | 10879 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 10880 | 10880 |
| 10881 rv = callback1.WaitForResult(); | 10881 rv = callback1.WaitForResult(); |
| 10882 EXPECT_EQ(ERR_EMPTY_RESPONSE, rv); | 10882 EXPECT_EQ(ERR_EMPTY_RESPONSE, rv); |
| 10883 net::CapturingNetLog::CapturedEntryList entries; | 10883 net::TestNetLog::CapturedEntryList entries; |
| 10884 log.GetEntries(&entries); | 10884 log.GetEntries(&entries); |
| 10885 size_t pos = ExpectLogContainsSomewhere( | 10885 size_t pos = ExpectLogContainsSomewhere( |
| 10886 entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, | 10886 entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, |
| 10887 NetLog::PHASE_NONE); | 10887 NetLog::PHASE_NONE); |
| 10888 ExpectLogContainsSomewhere( | 10888 ExpectLogContainsSomewhere( |
| 10889 entries, pos, | 10889 entries, pos, |
| 10890 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, | 10890 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, |
| 10891 NetLog::PHASE_NONE); | 10891 NetLog::PHASE_NONE); |
| 10892 } | 10892 } |
| 10893 | 10893 |
| (...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11812 MockRead(ASYNC, ERR_IO_PENDING, 8) | 11812 MockRead(ASYNC, ERR_IO_PENDING, 8) |
| 11813 }; | 11813 }; |
| 11814 | 11814 |
| 11815 DeterministicSocketData data1(reads1, arraysize(reads1), | 11815 DeterministicSocketData data1(reads1, arraysize(reads1), |
| 11816 writes1, arraysize(writes1)); | 11816 writes1, arraysize(writes1)); |
| 11817 MockConnect connect_data1(ASYNC, OK); | 11817 MockConnect connect_data1(ASYNC, OK); |
| 11818 data1.set_connect_data(connect_data1); | 11818 data1.set_connect_data(connect_data1); |
| 11819 | 11819 |
| 11820 session_deps_.proxy_service.reset( | 11820 session_deps_.proxy_service.reset( |
| 11821 ProxyService::CreateFixedFromPacResult("HTTPS proxy:70")); | 11821 ProxyService::CreateFixedFromPacResult("HTTPS proxy:70")); |
| 11822 CapturingNetLog log; | 11822 TestNetLog log; |
| 11823 session_deps_.net_log = &log; | 11823 session_deps_.net_log = &log; |
| 11824 SSLSocketDataProvider ssl1(ASYNC, OK); // to the proxy | 11824 SSLSocketDataProvider ssl1(ASYNC, OK); // to the proxy |
| 11825 ssl1.SetNextProto(GetParam()); | 11825 ssl1.SetNextProto(GetParam()); |
| 11826 session_deps_.deterministic_socket_factory->AddSSLSocketDataProvider(&ssl1); | 11826 session_deps_.deterministic_socket_factory->AddSSLSocketDataProvider(&ssl1); |
| 11827 SSLSocketDataProvider ssl2(ASYNC, OK); // to the server | 11827 SSLSocketDataProvider ssl2(ASYNC, OK); // to the server |
| 11828 ssl2.SetNextProto(GetParam()); | 11828 ssl2.SetNextProto(GetParam()); |
| 11829 session_deps_.deterministic_socket_factory->AddSSLSocketDataProvider(&ssl2); | 11829 session_deps_.deterministic_socket_factory->AddSSLSocketDataProvider(&ssl2); |
| 11830 session_deps_.deterministic_socket_factory->AddSocketDataProvider(&data1); | 11830 session_deps_.deterministic_socket_factory->AddSocketDataProvider(&data1); |
| 11831 | 11831 |
| 11832 scoped_refptr<HttpNetworkSession> session( | 11832 scoped_refptr<HttpNetworkSession> session( |
| (...skipping 1950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13783 ASSERT_TRUE(response); | 13783 ASSERT_TRUE(response); |
| 13784 ASSERT_TRUE(response->headers.get()); | 13784 ASSERT_TRUE(response->headers.get()); |
| 13785 | 13785 |
| 13786 EXPECT_EQ(101, response->headers->response_code()); | 13786 EXPECT_EQ(101, response->headers->response_code()); |
| 13787 | 13787 |
| 13788 trans.reset(); | 13788 trans.reset(); |
| 13789 session->CloseAllConnections(); | 13789 session->CloseAllConnections(); |
| 13790 } | 13790 } |
| 13791 | 13791 |
| 13792 } // namespace net | 13792 } // namespace net |
| OLD | NEW |