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 2354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2365 EXPECT_EQ(OK, rv); | 2365 EXPECT_EQ(OK, rv); |
2366 | 2366 |
2367 response = trans->GetResponseInfo(); | 2367 response = trans->GetResponseInfo(); |
2368 ASSERT_TRUE(response != NULL); | 2368 ASSERT_TRUE(response != NULL); |
2369 EXPECT_TRUE(response->auth_challenge.get() == NULL); | 2369 EXPECT_TRUE(response->auth_challenge.get() == NULL); |
2370 EXPECT_EQ(5, response->headers->GetContentLength()); | 2370 EXPECT_EQ(5, response->headers->GetContentLength()); |
2371 } | 2371 } |
2372 | 2372 |
2373 // Test the request-challenge-retry sequence for basic auth, over a connection | 2373 // Test the request-challenge-retry sequence for basic auth, over a connection |
2374 // that requires a restart when setting up an SSL tunnel. | 2374 // that requires a restart when setting up an SSL tunnel. |
2375 TEST_P(HttpNetworkTransactionTest, BasicAuthProxyNoKeepAlive) { | 2375 TEST_P(HttpNetworkTransactionTest, BasicAuthProxyNoKeepAliveHttp10) { |
2376 HttpRequestInfo request; | 2376 HttpRequestInfo request; |
2377 request.method = "GET"; | 2377 request.method = "GET"; |
2378 request.url = GURL("https://www.google.com/"); | 2378 request.url = GURL("https://www.google.com/"); |
| 2379 // when the no authentication data flag is set. |
| 2380 request.load_flags = net::LOAD_DO_NOT_SEND_AUTH_DATA; |
| 2381 |
| 2382 // Configure against proxy server "myproxy:70". |
| 2383 session_deps_.proxy_service.reset( |
| 2384 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); |
| 2385 CapturingBoundNetLog log; |
| 2386 session_deps_.net_log = log.bound().net_log(); |
| 2387 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 2388 |
| 2389 // Since we have proxy, should try to establish tunnel. |
| 2390 MockWrite data_writes1[] = { |
| 2391 MockWrite( |
| 2392 "CONNECT www.google.com:443 HTTP/1.1\r\n" |
| 2393 "Host: www.google.com\r\n" |
| 2394 "Proxy-Connection: keep-alive\r\n\r\n"), |
| 2395 |
| 2396 // After calling trans->RestartWithAuth(), this is the request we should |
| 2397 // be issuing -- the final header line contains the credentials. |
| 2398 MockWrite( |
| 2399 "CONNECT www.google.com:443 HTTP/1.1\r\n" |
| 2400 "Host: www.google.com\r\n" |
| 2401 "Proxy-Connection: keep-alive\r\n" |
| 2402 "Proxy-Authorization: Basic Zm9vOmJhcg==\r\n\r\n"), |
| 2403 |
| 2404 MockWrite( |
| 2405 "GET / HTTP/1.1\r\n" |
| 2406 "Host: www.google.com\r\n" |
| 2407 "Connection: keep-alive\r\n\r\n"), |
| 2408 }; |
| 2409 |
| 2410 // The proxy responds to the connect with a 407, using a persistent |
| 2411 // connection. |
| 2412 MockRead data_reads1[] = { |
| 2413 // No credentials. |
| 2414 MockRead("HTTP/1.0 407 Proxy Authentication Required\r\n"), |
| 2415 MockRead("Proxy-Authenticate: Basic realm=\"MyRealm1\"\r\n\r\n"), |
| 2416 |
| 2417 MockRead("HTTP/1.0 200 Connection Established\r\n\r\n"), |
| 2418 |
| 2419 MockRead("HTTP/1.1 200 OK\r\n"), |
| 2420 MockRead("Content-Type: text/html; charset=iso-8859-1\r\n"), |
| 2421 MockRead("Content-Length: 5\r\n\r\n"), |
| 2422 MockRead(SYNCHRONOUS, "hello"), |
| 2423 }; |
| 2424 |
| 2425 StaticSocketDataProvider data1(data_reads1, arraysize(data_reads1), |
| 2426 data_writes1, arraysize(data_writes1)); |
| 2427 session_deps_.socket_factory->AddSocketDataProvider(&data1); |
| 2428 SSLSocketDataProvider ssl(ASYNC, OK); |
| 2429 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); |
| 2430 |
| 2431 TestCompletionCallback callback1; |
| 2432 |
| 2433 scoped_ptr<HttpTransaction> trans( |
| 2434 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 2435 |
| 2436 int rv = trans->Start(&request, callback1.callback(), log.bound()); |
| 2437 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 2438 |
| 2439 rv = callback1.WaitForResult(); |
| 2440 EXPECT_EQ(OK, rv); |
| 2441 net::CapturingNetLog::CapturedEntryList entries; |
| 2442 log.GetEntries(&entries); |
| 2443 size_t pos = ExpectLogContainsSomewhere( |
| 2444 entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, |
| 2445 NetLog::PHASE_NONE); |
| 2446 ExpectLogContainsSomewhere( |
| 2447 entries, pos, NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, |
| 2448 NetLog::PHASE_NONE); |
| 2449 |
| 2450 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 2451 ASSERT_TRUE(response != NULL); |
| 2452 EXPECT_FALSE(response->headers->IsKeepAlive()); |
| 2453 ASSERT_FALSE(response->headers.get() == NULL); |
| 2454 EXPECT_EQ(407, response->headers->response_code()); |
| 2455 EXPECT_TRUE(HttpVersion(1, 0) == response->headers->GetHttpVersion()); |
| 2456 EXPECT_TRUE(CheckBasicProxyAuth(response->auth_challenge.get())); |
| 2457 |
| 2458 LoadTimingInfo load_timing_info; |
| 2459 // CONNECT requests and responses are handled at the connect job level, so |
| 2460 // the transaction does not yet have a connection. |
| 2461 EXPECT_FALSE(trans->GetLoadTimingInfo(&load_timing_info)); |
| 2462 |
| 2463 TestCompletionCallback callback2; |
| 2464 |
| 2465 rv = |
| 2466 trans->RestartWithAuth(AuthCredentials(kFoo, kBar), callback2.callback()); |
| 2467 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 2468 |
| 2469 rv = callback2.WaitForResult(); |
| 2470 EXPECT_EQ(OK, rv); |
| 2471 |
| 2472 response = trans->GetResponseInfo(); |
| 2473 ASSERT_TRUE(response != NULL); |
| 2474 |
| 2475 EXPECT_TRUE(response->headers->IsKeepAlive()); |
| 2476 EXPECT_EQ(200, response->headers->response_code()); |
| 2477 EXPECT_EQ(5, response->headers->GetContentLength()); |
| 2478 EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion()); |
| 2479 |
| 2480 // The password prompt info should not be set. |
| 2481 EXPECT_TRUE(response->auth_challenge.get() == NULL); |
| 2482 |
| 2483 EXPECT_TRUE(trans->GetLoadTimingInfo(&load_timing_info)); |
| 2484 TestLoadTimingNotReusedWithPac(load_timing_info, |
| 2485 CONNECT_TIMING_HAS_SSL_TIMES); |
| 2486 |
| 2487 trans.reset(); |
| 2488 session->CloseAllConnections(); |
| 2489 } |
| 2490 |
| 2491 // Test the request-challenge-retry sequence for basic auth, over a connection |
| 2492 // that requires a restart when setting up an SSL tunnel. |
| 2493 TEST_P(HttpNetworkTransactionTest, BasicAuthProxyNoKeepAliveHttp11) { |
| 2494 HttpRequestInfo request; |
| 2495 request.method = "GET"; |
| 2496 request.url = GURL("https://www.google.com/"); |
2379 // when the no authentication data flag is set. | 2497 // when the no authentication data flag is set. |
2380 request.load_flags = net::LOAD_DO_NOT_SEND_AUTH_DATA; | 2498 request.load_flags = net::LOAD_DO_NOT_SEND_AUTH_DATA; |
2381 | 2499 |
2382 // Configure against proxy server "myproxy:70". | 2500 // Configure against proxy server "myproxy:70". |
2383 session_deps_.proxy_service.reset( | 2501 session_deps_.proxy_service.reset( |
2384 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); | 2502 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); |
2385 CapturingBoundNetLog log; | 2503 CapturingBoundNetLog log; |
2386 session_deps_.net_log = log.bound().net_log(); | 2504 session_deps_.net_log = log.bound().net_log(); |
2387 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 2505 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
2388 | 2506 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2441 size_t pos = ExpectLogContainsSomewhere( | 2559 size_t pos = ExpectLogContainsSomewhere( |
2442 entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, | 2560 entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, |
2443 NetLog::PHASE_NONE); | 2561 NetLog::PHASE_NONE); |
2444 ExpectLogContainsSomewhere( | 2562 ExpectLogContainsSomewhere( |
2445 entries, pos, | 2563 entries, pos, |
2446 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, | 2564 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, |
2447 NetLog::PHASE_NONE); | 2565 NetLog::PHASE_NONE); |
2448 | 2566 |
2449 const HttpResponseInfo* response = trans->GetResponseInfo(); | 2567 const HttpResponseInfo* response = trans->GetResponseInfo(); |
2450 ASSERT_TRUE(response != NULL); | 2568 ASSERT_TRUE(response != NULL); |
| 2569 EXPECT_FALSE(response->headers->IsKeepAlive()); |
2451 ASSERT_FALSE(response->headers.get() == NULL); | 2570 ASSERT_FALSE(response->headers.get() == NULL); |
2452 EXPECT_EQ(407, response->headers->response_code()); | 2571 EXPECT_EQ(407, response->headers->response_code()); |
2453 EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion()); | 2572 EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion()); |
2454 EXPECT_TRUE(CheckBasicProxyAuth(response->auth_challenge.get())); | 2573 EXPECT_TRUE(CheckBasicProxyAuth(response->auth_challenge.get())); |
2455 | 2574 |
2456 LoadTimingInfo load_timing_info; | 2575 LoadTimingInfo load_timing_info; |
2457 // CONNECT requests and responses are handled at the connect job level, so | 2576 // CONNECT requests and responses are handled at the connect job level, so |
2458 // the transaction does not yet have a connection. | 2577 // the transaction does not yet have a connection. |
2459 EXPECT_FALSE(trans->GetLoadTimingInfo(&load_timing_info)); | 2578 EXPECT_FALSE(trans->GetLoadTimingInfo(&load_timing_info)); |
2460 | 2579 |
(...skipping 19 matching lines...) Expand all Loading... |
2480 | 2599 |
2481 EXPECT_TRUE(trans->GetLoadTimingInfo(&load_timing_info)); | 2600 EXPECT_TRUE(trans->GetLoadTimingInfo(&load_timing_info)); |
2482 TestLoadTimingNotReusedWithPac(load_timing_info, | 2601 TestLoadTimingNotReusedWithPac(load_timing_info, |
2483 CONNECT_TIMING_HAS_SSL_TIMES); | 2602 CONNECT_TIMING_HAS_SSL_TIMES); |
2484 | 2603 |
2485 trans.reset(); | 2604 trans.reset(); |
2486 session->CloseAllConnections(); | 2605 session->CloseAllConnections(); |
2487 } | 2606 } |
2488 | 2607 |
2489 // Test the request-challenge-retry sequence for basic auth, over a keep-alive | 2608 // Test the request-challenge-retry sequence for basic auth, over a keep-alive |
2490 // proxy connection, when setting up an SSL tunnel. | 2609 // proxy connection with HTTP/1.0 responses, when setting up an SSL tunnel. |
2491 TEST_P(HttpNetworkTransactionTest, BasicAuthProxyKeepAlive) { | 2610 TEST_P(HttpNetworkTransactionTest, BasicAuthProxyKeepAliveHttp10) { |
2492 HttpRequestInfo request; | 2611 HttpRequestInfo request; |
2493 request.method = "GET"; | 2612 request.method = "GET"; |
2494 request.url = GURL("https://www.google.com/"); | 2613 request.url = GURL("https://www.google.com/"); |
| 2614 // Ensure that proxy authentication is attempted even |
| 2615 // when the no authentication data flag is set. |
| 2616 request.load_flags = net::LOAD_DO_NOT_SEND_AUTH_DATA; |
| 2617 |
| 2618 // Configure against proxy server "myproxy:70". |
| 2619 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); |
| 2620 CapturingBoundNetLog log; |
| 2621 session_deps_.net_log = log.bound().net_log(); |
| 2622 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 2623 |
| 2624 scoped_ptr<HttpTransaction> trans( |
| 2625 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 2626 |
| 2627 // Since we have proxy, should try to establish tunnel. |
| 2628 MockWrite data_writes1[] = { |
| 2629 MockWrite( |
| 2630 "CONNECT www.google.com:443 HTTP/1.1\r\n" |
| 2631 "Host: www.google.com\r\n" |
| 2632 "Proxy-Connection: keep-alive\r\n\r\n"), |
| 2633 |
| 2634 // After calling trans->RestartWithAuth(), this is the request we should |
| 2635 // be issuing -- the final header line contains the credentials. |
| 2636 MockWrite( |
| 2637 "CONNECT www.google.com:443 HTTP/1.1\r\n" |
| 2638 "Host: www.google.com\r\n" |
| 2639 "Proxy-Connection: keep-alive\r\n" |
| 2640 "Proxy-Authorization: Basic Zm9vOmJheg==\r\n\r\n"), |
| 2641 }; |
| 2642 |
| 2643 // The proxy responds to the connect with a 407, using a persistent |
| 2644 // connection. (Since it's HTTP/1.0, keep-alive has to be explicit.) |
| 2645 MockRead data_reads1[] = { |
| 2646 // No credentials. |
| 2647 MockRead("HTTP/1.0 407 Proxy Authentication Required\r\n"), |
| 2648 MockRead("Proxy-Authenticate: Basic realm=\"MyRealm1\"\r\n"), |
| 2649 MockRead("Proxy-Connection: keep-alive\r\n"), |
| 2650 MockRead("Content-Length: 10\r\n\r\n"), |
| 2651 MockRead("0123456789"), |
| 2652 |
| 2653 // Wrong credentials (wrong password). |
| 2654 MockRead("HTTP/1.0 407 Proxy Authentication Required\r\n"), |
| 2655 MockRead("Proxy-Authenticate: Basic realm=\"MyRealm1\"\r\n"), |
| 2656 MockRead("Proxy-Connection: keep-alive\r\n"), |
| 2657 MockRead("Content-Length: 10\r\n\r\n"), |
| 2658 // No response body because the test stops reading here. |
| 2659 MockRead(SYNCHRONOUS, ERR_UNEXPECTED), // Should not be reached. |
| 2660 }; |
| 2661 |
| 2662 StaticSocketDataProvider data1(data_reads1, arraysize(data_reads1), |
| 2663 data_writes1, arraysize(data_writes1)); |
| 2664 session_deps_.socket_factory->AddSocketDataProvider(&data1); |
| 2665 |
| 2666 TestCompletionCallback callback1; |
| 2667 |
| 2668 int rv = trans->Start(&request, callback1.callback(), log.bound()); |
| 2669 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 2670 |
| 2671 rv = callback1.WaitForResult(); |
| 2672 EXPECT_EQ(OK, rv); |
| 2673 net::CapturingNetLog::CapturedEntryList entries; |
| 2674 log.GetEntries(&entries); |
| 2675 size_t pos = ExpectLogContainsSomewhere( |
| 2676 entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, |
| 2677 NetLog::PHASE_NONE); |
| 2678 ExpectLogContainsSomewhere( |
| 2679 entries, pos, NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, |
| 2680 NetLog::PHASE_NONE); |
| 2681 |
| 2682 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 2683 ASSERT_TRUE(response); |
| 2684 ASSERT_TRUE(response->headers); |
| 2685 EXPECT_TRUE(response->headers->IsKeepAlive()); |
| 2686 EXPECT_EQ(407, response->headers->response_code()); |
| 2687 EXPECT_EQ(10, response->headers->GetContentLength()); |
| 2688 EXPECT_TRUE(HttpVersion(1, 0) == response->headers->GetHttpVersion()); |
| 2689 EXPECT_TRUE(CheckBasicProxyAuth(response->auth_challenge.get())); |
| 2690 |
| 2691 TestCompletionCallback callback2; |
| 2692 |
| 2693 // Wrong password (should be "bar"). |
| 2694 rv = |
| 2695 trans->RestartWithAuth(AuthCredentials(kFoo, kBaz), callback2.callback()); |
| 2696 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 2697 |
| 2698 rv = callback2.WaitForResult(); |
| 2699 EXPECT_EQ(OK, rv); |
| 2700 |
| 2701 response = trans->GetResponseInfo(); |
| 2702 ASSERT_TRUE(response); |
| 2703 ASSERT_TRUE(response->headers); |
| 2704 EXPECT_TRUE(response->headers->IsKeepAlive()); |
| 2705 EXPECT_EQ(407, response->headers->response_code()); |
| 2706 EXPECT_EQ(10, response->headers->GetContentLength()); |
| 2707 EXPECT_TRUE(HttpVersion(1, 0) == response->headers->GetHttpVersion()); |
| 2708 EXPECT_TRUE(CheckBasicProxyAuth(response->auth_challenge.get())); |
| 2709 |
| 2710 // Flush the idle socket before the NetLog and HttpNetworkTransaction go |
| 2711 // out of scope. |
| 2712 session->CloseAllConnections(); |
| 2713 } |
| 2714 |
| 2715 // Test the request-challenge-retry sequence for basic auth, over a keep-alive |
| 2716 // proxy connection with HTTP/1.1 responses, when setting up an SSL tunnel. |
| 2717 TEST_P(HttpNetworkTransactionTest, BasicAuthProxyKeepAliveHttp11) { |
| 2718 HttpRequestInfo request; |
| 2719 request.method = "GET"; |
| 2720 request.url = GURL("https://www.google.com/"); |
2495 // Ensure that proxy authentication is attempted even | 2721 // Ensure that proxy authentication is attempted even |
2496 // when the no authentication data flag is set. | 2722 // when the no authentication data flag is set. |
2497 request.load_flags = net::LOAD_DO_NOT_SEND_AUTH_DATA; | 2723 request.load_flags = net::LOAD_DO_NOT_SEND_AUTH_DATA; |
2498 | 2724 |
2499 // Configure against proxy server "myproxy:70". | 2725 // Configure against proxy server "myproxy:70". |
2500 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); | 2726 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); |
2501 CapturingBoundNetLog log; | 2727 CapturingBoundNetLog log; |
2502 session_deps_.net_log = log.bound().net_log(); | 2728 session_deps_.net_log = log.bound().net_log(); |
2503 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 2729 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
2504 | 2730 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2555 ExpectLogContainsSomewhere( | 2781 ExpectLogContainsSomewhere( |
2556 entries, pos, | 2782 entries, pos, |
2557 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, | 2783 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, |
2558 NetLog::PHASE_NONE); | 2784 NetLog::PHASE_NONE); |
2559 | 2785 |
2560 const HttpResponseInfo* response = trans->GetResponseInfo(); | 2786 const HttpResponseInfo* response = trans->GetResponseInfo(); |
2561 ASSERT_TRUE(response); | 2787 ASSERT_TRUE(response); |
2562 ASSERT_TRUE(response->headers); | 2788 ASSERT_TRUE(response->headers); |
2563 EXPECT_TRUE(response->headers->IsKeepAlive()); | 2789 EXPECT_TRUE(response->headers->IsKeepAlive()); |
2564 EXPECT_EQ(407, response->headers->response_code()); | 2790 EXPECT_EQ(407, response->headers->response_code()); |
2565 EXPECT_EQ(-1, response->headers->GetContentLength()); | 2791 EXPECT_EQ(10, response->headers->GetContentLength()); |
2566 EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion()); | 2792 EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion()); |
2567 EXPECT_TRUE(CheckBasicProxyAuth(response->auth_challenge.get())); | 2793 EXPECT_TRUE(CheckBasicProxyAuth(response->auth_challenge.get())); |
2568 | 2794 |
2569 TestCompletionCallback callback2; | 2795 TestCompletionCallback callback2; |
2570 | 2796 |
2571 // Wrong password (should be "bar"). | 2797 // Wrong password (should be "bar"). |
2572 rv = trans->RestartWithAuth( | 2798 rv = trans->RestartWithAuth( |
2573 AuthCredentials(kFoo, kBaz), callback2.callback()); | 2799 AuthCredentials(kFoo, kBaz), callback2.callback()); |
2574 EXPECT_EQ(ERR_IO_PENDING, rv); | 2800 EXPECT_EQ(ERR_IO_PENDING, rv); |
2575 | 2801 |
2576 rv = callback2.WaitForResult(); | 2802 rv = callback2.WaitForResult(); |
2577 EXPECT_EQ(OK, rv); | 2803 EXPECT_EQ(OK, rv); |
2578 | 2804 |
2579 response = trans->GetResponseInfo(); | 2805 response = trans->GetResponseInfo(); |
2580 ASSERT_TRUE(response); | 2806 ASSERT_TRUE(response); |
2581 ASSERT_TRUE(response->headers); | 2807 ASSERT_TRUE(response->headers); |
2582 EXPECT_TRUE(response->headers->IsKeepAlive()); | 2808 EXPECT_TRUE(response->headers->IsKeepAlive()); |
2583 EXPECT_EQ(407, response->headers->response_code()); | 2809 EXPECT_EQ(407, response->headers->response_code()); |
2584 EXPECT_EQ(-1, response->headers->GetContentLength()); | 2810 EXPECT_EQ(10, response->headers->GetContentLength()); |
2585 EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion()); | 2811 EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion()); |
2586 EXPECT_TRUE(CheckBasicProxyAuth(response->auth_challenge.get())); | 2812 EXPECT_TRUE(CheckBasicProxyAuth(response->auth_challenge.get())); |
2587 | 2813 |
2588 // Flush the idle socket before the NetLog and HttpNetworkTransaction go | 2814 // Flush the idle socket before the NetLog and HttpNetworkTransaction go |
2589 // out of scope. | 2815 // out of scope. |
2590 session->CloseAllConnections(); | 2816 session->CloseAllConnections(); |
2591 } | 2817 } |
2592 | 2818 |
2593 // Test that we don't read the response body when we fail to establish a tunnel, | 2819 // Test that we don't read the response body when we fail to establish a tunnel, |
2594 // even if the user cancels the proxy's auth attempt. | 2820 // even if the user cancels the proxy's auth attempt. |
(...skipping 10958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13553 ASSERT_TRUE(response); | 13779 ASSERT_TRUE(response); |
13554 ASSERT_TRUE(response->headers.get()); | 13780 ASSERT_TRUE(response->headers.get()); |
13555 | 13781 |
13556 EXPECT_EQ(101, response->headers->response_code()); | 13782 EXPECT_EQ(101, response->headers->response_code()); |
13557 | 13783 |
13558 trans.reset(); | 13784 trans.reset(); |
13559 session->CloseAllConnections(); | 13785 session->CloseAllConnections(); |
13560 } | 13786 } |
13561 | 13787 |
13562 } // namespace net | 13788 } // namespace net |
OLD | NEW |