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