| 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 <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 2400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2411 // Test the request-challenge-retry sequence for basic auth, over a connection | 2411 // Test the request-challenge-retry sequence for basic auth, over a connection |
| 2412 // that requires a restart when setting up an SSL tunnel. | 2412 // that requires a restart when setting up an SSL tunnel. |
| 2413 TEST_P(HttpNetworkTransactionTest, BasicAuthProxyNoKeepAliveHttp10) { | 2413 TEST_P(HttpNetworkTransactionTest, BasicAuthProxyNoKeepAliveHttp10) { |
| 2414 HttpRequestInfo request; | 2414 HttpRequestInfo request; |
| 2415 request.method = "GET"; | 2415 request.method = "GET"; |
| 2416 request.url = GURL("https://www.example.org/"); | 2416 request.url = GURL("https://www.example.org/"); |
| 2417 // when the no authentication data flag is set. | 2417 // when the no authentication data flag is set. |
| 2418 request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA; | 2418 request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA; |
| 2419 | 2419 |
| 2420 // Configure against proxy server "myproxy:70". | 2420 // Configure against proxy server "myproxy:70". |
| 2421 session_deps_.proxy_service.reset( | 2421 session_deps_.proxy_service = |
| 2422 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); | 2422 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"); |
| 2423 BoundTestNetLog log; | 2423 BoundTestNetLog log; |
| 2424 session_deps_.net_log = log.bound().net_log(); | 2424 session_deps_.net_log = log.bound().net_log(); |
| 2425 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 2425 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 2426 | 2426 |
| 2427 // Since we have proxy, should try to establish tunnel. | 2427 // Since we have proxy, should try to establish tunnel. |
| 2428 MockWrite data_writes1[] = { | 2428 MockWrite data_writes1[] = { |
| 2429 MockWrite("CONNECT www.example.org:443 HTTP/1.1\r\n" | 2429 MockWrite("CONNECT www.example.org:443 HTTP/1.1\r\n" |
| 2430 "Host: www.example.org\r\n" | 2430 "Host: www.example.org\r\n" |
| 2431 "Proxy-Connection: keep-alive\r\n\r\n"), | 2431 "Proxy-Connection: keep-alive\r\n\r\n"), |
| 2432 }; | 2432 }; |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2535 // Test the request-challenge-retry sequence for basic auth, over a connection | 2535 // Test the request-challenge-retry sequence for basic auth, over a connection |
| 2536 // that requires a restart when setting up an SSL tunnel. | 2536 // that requires a restart when setting up an SSL tunnel. |
| 2537 TEST_P(HttpNetworkTransactionTest, BasicAuthProxyNoKeepAliveHttp11) { | 2537 TEST_P(HttpNetworkTransactionTest, BasicAuthProxyNoKeepAliveHttp11) { |
| 2538 HttpRequestInfo request; | 2538 HttpRequestInfo request; |
| 2539 request.method = "GET"; | 2539 request.method = "GET"; |
| 2540 request.url = GURL("https://www.example.org/"); | 2540 request.url = GURL("https://www.example.org/"); |
| 2541 // when the no authentication data flag is set. | 2541 // when the no authentication data flag is set. |
| 2542 request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA; | 2542 request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA; |
| 2543 | 2543 |
| 2544 // Configure against proxy server "myproxy:70". | 2544 // Configure against proxy server "myproxy:70". |
| 2545 session_deps_.proxy_service.reset( | 2545 session_deps_.proxy_service = |
| 2546 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); | 2546 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"); |
| 2547 BoundTestNetLog log; | 2547 BoundTestNetLog log; |
| 2548 session_deps_.net_log = log.bound().net_log(); | 2548 session_deps_.net_log = log.bound().net_log(); |
| 2549 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 2549 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 2550 | 2550 |
| 2551 // Since we have proxy, should try to establish tunnel. | 2551 // Since we have proxy, should try to establish tunnel. |
| 2552 MockWrite data_writes1[] = { | 2552 MockWrite data_writes1[] = { |
| 2553 MockWrite("CONNECT www.example.org:443 HTTP/1.1\r\n" | 2553 MockWrite("CONNECT www.example.org:443 HTTP/1.1\r\n" |
| 2554 "Host: www.example.org\r\n" | 2554 "Host: www.example.org\r\n" |
| 2555 "Proxy-Connection: keep-alive\r\n\r\n"), | 2555 "Proxy-Connection: keep-alive\r\n\r\n"), |
| 2556 }; | 2556 }; |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2660 // proxy connection with HTTP/1.0 responses, when setting up an SSL tunnel. | 2660 // proxy connection with HTTP/1.0 responses, when setting up an SSL tunnel. |
| 2661 TEST_P(HttpNetworkTransactionTest, BasicAuthProxyKeepAliveHttp10) { | 2661 TEST_P(HttpNetworkTransactionTest, BasicAuthProxyKeepAliveHttp10) { |
| 2662 HttpRequestInfo request; | 2662 HttpRequestInfo request; |
| 2663 request.method = "GET"; | 2663 request.method = "GET"; |
| 2664 request.url = GURL("https://www.example.org/"); | 2664 request.url = GURL("https://www.example.org/"); |
| 2665 // Ensure that proxy authentication is attempted even | 2665 // Ensure that proxy authentication is attempted even |
| 2666 // when the no authentication data flag is set. | 2666 // when the no authentication data flag is set. |
| 2667 request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA; | 2667 request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA; |
| 2668 | 2668 |
| 2669 // Configure against proxy server "myproxy:70". | 2669 // Configure against proxy server "myproxy:70". |
| 2670 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); | 2670 session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70"); |
| 2671 BoundTestNetLog log; | 2671 BoundTestNetLog log; |
| 2672 session_deps_.net_log = log.bound().net_log(); | 2672 session_deps_.net_log = log.bound().net_log(); |
| 2673 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 2673 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 2674 | 2674 |
| 2675 scoped_ptr<HttpTransaction> trans( | 2675 scoped_ptr<HttpTransaction> trans( |
| 2676 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 2676 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 2677 | 2677 |
| 2678 // Since we have proxy, should try to establish tunnel. | 2678 // Since we have proxy, should try to establish tunnel. |
| 2679 MockWrite data_writes1[] = { | 2679 MockWrite data_writes1[] = { |
| 2680 MockWrite( | 2680 MockWrite( |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2767 // proxy connection with HTTP/1.1 responses, when setting up an SSL tunnel. | 2767 // proxy connection with HTTP/1.1 responses, when setting up an SSL tunnel. |
| 2768 TEST_P(HttpNetworkTransactionTest, BasicAuthProxyKeepAliveHttp11) { | 2768 TEST_P(HttpNetworkTransactionTest, BasicAuthProxyKeepAliveHttp11) { |
| 2769 HttpRequestInfo request; | 2769 HttpRequestInfo request; |
| 2770 request.method = "GET"; | 2770 request.method = "GET"; |
| 2771 request.url = GURL("https://www.example.org/"); | 2771 request.url = GURL("https://www.example.org/"); |
| 2772 // Ensure that proxy authentication is attempted even | 2772 // Ensure that proxy authentication is attempted even |
| 2773 // when the no authentication data flag is set. | 2773 // when the no authentication data flag is set. |
| 2774 request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA; | 2774 request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA; |
| 2775 | 2775 |
| 2776 // Configure against proxy server "myproxy:70". | 2776 // Configure against proxy server "myproxy:70". |
| 2777 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); | 2777 session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70"); |
| 2778 BoundTestNetLog log; | 2778 BoundTestNetLog log; |
| 2779 session_deps_.net_log = log.bound().net_log(); | 2779 session_deps_.net_log = log.bound().net_log(); |
| 2780 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 2780 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 2781 | 2781 |
| 2782 scoped_ptr<HttpTransaction> trans( | 2782 scoped_ptr<HttpTransaction> trans( |
| 2783 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 2783 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 2784 | 2784 |
| 2785 // Since we have proxy, should try to establish tunnel. | 2785 // Since we have proxy, should try to establish tunnel. |
| 2786 MockWrite data_writes1[] = { | 2786 MockWrite data_writes1[] = { |
| 2787 MockWrite( | 2787 MockWrite( |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2873 // drained. | 2873 // drained. |
| 2874 TEST_P(HttpNetworkTransactionTest, BasicAuthProxyKeepAliveHangupDuringBody) { | 2874 TEST_P(HttpNetworkTransactionTest, BasicAuthProxyKeepAliveHangupDuringBody) { |
| 2875 HttpRequestInfo request; | 2875 HttpRequestInfo request; |
| 2876 request.method = "GET"; | 2876 request.method = "GET"; |
| 2877 request.url = GURL("https://www.example.org/"); | 2877 request.url = GURL("https://www.example.org/"); |
| 2878 // Ensure that proxy authentication is attempted even | 2878 // Ensure that proxy authentication is attempted even |
| 2879 // when the no authentication data flag is set. | 2879 // when the no authentication data flag is set. |
| 2880 request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA; | 2880 request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA; |
| 2881 | 2881 |
| 2882 // Configure against proxy server "myproxy:70". | 2882 // Configure against proxy server "myproxy:70". |
| 2883 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); | 2883 session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70"); |
| 2884 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 2884 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 2885 | 2885 |
| 2886 scoped_ptr<HttpTransaction> trans( | 2886 scoped_ptr<HttpTransaction> trans( |
| 2887 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 2887 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 2888 | 2888 |
| 2889 // Since we have proxy, should try to establish tunnel. | 2889 // Since we have proxy, should try to establish tunnel. |
| 2890 MockWrite data_writes1[] = { | 2890 MockWrite data_writes1[] = { |
| 2891 MockWrite("CONNECT www.example.org:443 HTTP/1.1\r\n" | 2891 MockWrite("CONNECT www.example.org:443 HTTP/1.1\r\n" |
| 2892 "Host: www.example.org\r\n" | 2892 "Host: www.example.org\r\n" |
| 2893 "Proxy-Connection: keep-alive\r\n\r\n"), | 2893 "Proxy-Connection: keep-alive\r\n\r\n"), |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2962 | 2962 |
| 2963 // Test that we don't read the response body when we fail to establish a tunnel, | 2963 // Test that we don't read the response body when we fail to establish a tunnel, |
| 2964 // even if the user cancels the proxy's auth attempt. | 2964 // even if the user cancels the proxy's auth attempt. |
| 2965 TEST_P(HttpNetworkTransactionTest, BasicAuthProxyCancelTunnel) { | 2965 TEST_P(HttpNetworkTransactionTest, BasicAuthProxyCancelTunnel) { |
| 2966 HttpRequestInfo request; | 2966 HttpRequestInfo request; |
| 2967 request.method = "GET"; | 2967 request.method = "GET"; |
| 2968 request.url = GURL("https://www.example.org/"); | 2968 request.url = GURL("https://www.example.org/"); |
| 2969 request.load_flags = 0; | 2969 request.load_flags = 0; |
| 2970 | 2970 |
| 2971 // Configure against proxy server "myproxy:70". | 2971 // Configure against proxy server "myproxy:70". |
| 2972 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); | 2972 session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70"); |
| 2973 | 2973 |
| 2974 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 2974 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 2975 | 2975 |
| 2976 scoped_ptr<HttpTransaction> trans( | 2976 scoped_ptr<HttpTransaction> trans( |
| 2977 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 2977 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 2978 | 2978 |
| 2979 // Since we have proxy, should try to establish tunnel. | 2979 // Since we have proxy, should try to establish tunnel. |
| 2980 MockWrite data_writes[] = { | 2980 MockWrite data_writes[] = { |
| 2981 MockWrite( | 2981 MockWrite( |
| 2982 "CONNECT www.example.org:443 HTTP/1.1\r\n" | 2982 "CONNECT www.example.org:443 HTTP/1.1\r\n" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3022 | 3022 |
| 3023 // Test that we don't pass extraneous headers from the proxy's response to the | 3023 // Test that we don't pass extraneous headers from the proxy's response to the |
| 3024 // caller when the proxy responds to CONNECT with 407. | 3024 // caller when the proxy responds to CONNECT with 407. |
| 3025 TEST_P(HttpNetworkTransactionTest, SanitizeProxyAuthHeaders) { | 3025 TEST_P(HttpNetworkTransactionTest, SanitizeProxyAuthHeaders) { |
| 3026 HttpRequestInfo request; | 3026 HttpRequestInfo request; |
| 3027 request.method = "GET"; | 3027 request.method = "GET"; |
| 3028 request.url = GURL("https://www.example.org/"); | 3028 request.url = GURL("https://www.example.org/"); |
| 3029 request.load_flags = 0; | 3029 request.load_flags = 0; |
| 3030 | 3030 |
| 3031 // Configure against proxy server "myproxy:70". | 3031 // Configure against proxy server "myproxy:70". |
| 3032 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); | 3032 session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70"); |
| 3033 | 3033 |
| 3034 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 3034 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 3035 | 3035 |
| 3036 scoped_ptr<HttpTransaction> trans( | 3036 scoped_ptr<HttpTransaction> trans( |
| 3037 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 3037 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 3038 | 3038 |
| 3039 // Since we have proxy, should try to establish tunnel. | 3039 // Since we have proxy, should try to establish tunnel. |
| 3040 MockWrite data_writes[] = { | 3040 MockWrite data_writes[] = { |
| 3041 MockWrite( | 3041 MockWrite( |
| 3042 "CONNECT www.example.org:443 HTTP/1.1\r\n" | 3042 "CONNECT www.example.org:443 HTTP/1.1\r\n" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3130 // Note that it is impossible to detect if an HTTP server returns a 407 through | 3130 // Note that it is impossible to detect if an HTTP server returns a 407 through |
| 3131 // a non-authenticating proxy - there is nothing to indicate whether the | 3131 // a non-authenticating proxy - there is nothing to indicate whether the |
| 3132 // response came from the proxy or the server, so it is treated as if the proxy | 3132 // response came from the proxy or the server, so it is treated as if the proxy |
| 3133 // issued the challenge. | 3133 // issued the challenge. |
| 3134 TEST_P(HttpNetworkTransactionTest, | 3134 TEST_P(HttpNetworkTransactionTest, |
| 3135 HttpsServerRequestsProxyAuthThroughProxy) { | 3135 HttpsServerRequestsProxyAuthThroughProxy) { |
| 3136 HttpRequestInfo request; | 3136 HttpRequestInfo request; |
| 3137 request.method = "GET"; | 3137 request.method = "GET"; |
| 3138 request.url = GURL("https://www.example.org/"); | 3138 request.url = GURL("https://www.example.org/"); |
| 3139 | 3139 |
| 3140 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); | 3140 session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70"); |
| 3141 BoundTestNetLog log; | 3141 BoundTestNetLog log; |
| 3142 session_deps_.net_log = log.bound().net_log(); | 3142 session_deps_.net_log = log.bound().net_log(); |
| 3143 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 3143 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 3144 | 3144 |
| 3145 // Since we have proxy, should try to establish tunnel. | 3145 // Since we have proxy, should try to establish tunnel. |
| 3146 MockWrite data_writes1[] = { | 3146 MockWrite data_writes1[] = { |
| 3147 MockWrite( | 3147 MockWrite( |
| 3148 "CONNECT www.example.org:443 HTTP/1.1\r\n" | 3148 "CONNECT www.example.org:443 HTTP/1.1\r\n" |
| 3149 "Host: www.example.org\r\n" | 3149 "Host: www.example.org\r\n" |
| 3150 "Proxy-Connection: keep-alive\r\n\r\n"), | 3150 "Proxy-Connection: keep-alive\r\n\r\n"), |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3195 TEST_P(HttpNetworkTransactionTest, HttpProxyLoadTimingNoPacTwoRequests) { | 3195 TEST_P(HttpNetworkTransactionTest, HttpProxyLoadTimingNoPacTwoRequests) { |
| 3196 HttpRequestInfo request1; | 3196 HttpRequestInfo request1; |
| 3197 request1.method = "GET"; | 3197 request1.method = "GET"; |
| 3198 request1.url = GURL("https://www.example.org/1"); | 3198 request1.url = GURL("https://www.example.org/1"); |
| 3199 | 3199 |
| 3200 HttpRequestInfo request2; | 3200 HttpRequestInfo request2; |
| 3201 request2.method = "GET"; | 3201 request2.method = "GET"; |
| 3202 request2.url = GURL("https://www.example.org/2"); | 3202 request2.url = GURL("https://www.example.org/2"); |
| 3203 | 3203 |
| 3204 // Configure against proxy server "myproxy:70". | 3204 // Configure against proxy server "myproxy:70". |
| 3205 session_deps_.proxy_service.reset( | 3205 session_deps_.proxy_service = ProxyService::CreateFixed("PROXY myproxy:70"); |
| 3206 ProxyService::CreateFixed("PROXY myproxy:70")); | |
| 3207 BoundTestNetLog log; | 3206 BoundTestNetLog log; |
| 3208 session_deps_.net_log = log.bound().net_log(); | 3207 session_deps_.net_log = log.bound().net_log(); |
| 3209 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 3208 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 3210 | 3209 |
| 3211 // Since we have proxy, should try to establish tunnel. | 3210 // Since we have proxy, should try to establish tunnel. |
| 3212 MockWrite data_writes1[] = { | 3211 MockWrite data_writes1[] = { |
| 3213 MockWrite( | 3212 MockWrite( |
| 3214 "CONNECT www.example.org:443 HTTP/1.1\r\n" | 3213 "CONNECT www.example.org:443 HTTP/1.1\r\n" |
| 3215 "Host: www.example.org\r\n" | 3214 "Host: www.example.org\r\n" |
| 3216 "Proxy-Connection: keep-alive\r\n\r\n"), | 3215 "Proxy-Connection: keep-alive\r\n\r\n"), |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3296 TEST_P(HttpNetworkTransactionTest, HttpProxyLoadTimingWithPacTwoRequests) { | 3295 TEST_P(HttpNetworkTransactionTest, HttpProxyLoadTimingWithPacTwoRequests) { |
| 3297 HttpRequestInfo request1; | 3296 HttpRequestInfo request1; |
| 3298 request1.method = "GET"; | 3297 request1.method = "GET"; |
| 3299 request1.url = GURL("https://www.example.org/1"); | 3298 request1.url = GURL("https://www.example.org/1"); |
| 3300 | 3299 |
| 3301 HttpRequestInfo request2; | 3300 HttpRequestInfo request2; |
| 3302 request2.method = "GET"; | 3301 request2.method = "GET"; |
| 3303 request2.url = GURL("https://www.example.org/2"); | 3302 request2.url = GURL("https://www.example.org/2"); |
| 3304 | 3303 |
| 3305 // Configure against proxy server "myproxy:70". | 3304 // Configure against proxy server "myproxy:70". |
| 3306 session_deps_.proxy_service.reset( | 3305 session_deps_.proxy_service = |
| 3307 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); | 3306 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"); |
| 3308 BoundTestNetLog log; | 3307 BoundTestNetLog log; |
| 3309 session_deps_.net_log = log.bound().net_log(); | 3308 session_deps_.net_log = log.bound().net_log(); |
| 3310 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 3309 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 3311 | 3310 |
| 3312 // Since we have proxy, should try to establish tunnel. | 3311 // Since we have proxy, should try to establish tunnel. |
| 3313 MockWrite data_writes1[] = { | 3312 MockWrite data_writes1[] = { |
| 3314 MockWrite( | 3313 MockWrite( |
| 3315 "CONNECT www.example.org:443 HTTP/1.1\r\n" | 3314 "CONNECT www.example.org:443 HTTP/1.1\r\n" |
| 3316 "Host: www.example.org\r\n" | 3315 "Host: www.example.org\r\n" |
| 3317 "Proxy-Connection: keep-alive\r\n\r\n"), | 3316 "Proxy-Connection: keep-alive\r\n\r\n"), |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3394 session->CloseAllConnections(); | 3393 session->CloseAllConnections(); |
| 3395 } | 3394 } |
| 3396 | 3395 |
| 3397 // Test a simple get through an HTTPS Proxy. | 3396 // Test a simple get through an HTTPS Proxy. |
| 3398 TEST_P(HttpNetworkTransactionTest, HttpsProxyGet) { | 3397 TEST_P(HttpNetworkTransactionTest, HttpsProxyGet) { |
| 3399 HttpRequestInfo request; | 3398 HttpRequestInfo request; |
| 3400 request.method = "GET"; | 3399 request.method = "GET"; |
| 3401 request.url = GURL("http://www.example.org/"); | 3400 request.url = GURL("http://www.example.org/"); |
| 3402 | 3401 |
| 3403 // Configure against https proxy server "proxy:70". | 3402 // Configure against https proxy server "proxy:70". |
| 3404 session_deps_.proxy_service.reset(ProxyService::CreateFixed( | 3403 session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70"); |
| 3405 "https://proxy:70")); | |
| 3406 BoundTestNetLog log; | 3404 BoundTestNetLog log; |
| 3407 session_deps_.net_log = log.bound().net_log(); | 3405 session_deps_.net_log = log.bound().net_log(); |
| 3408 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 3406 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 3409 | 3407 |
| 3410 // Since we have proxy, should use full url | 3408 // Since we have proxy, should use full url |
| 3411 MockWrite data_writes1[] = { | 3409 MockWrite data_writes1[] = { |
| 3412 MockWrite( | 3410 MockWrite( |
| 3413 "GET http://www.example.org/ HTTP/1.1\r\n" | 3411 "GET http://www.example.org/ HTTP/1.1\r\n" |
| 3414 "Host: www.example.org\r\n" | 3412 "Host: www.example.org\r\n" |
| 3415 "Proxy-Connection: keep-alive\r\n\r\n"), | 3413 "Proxy-Connection: keep-alive\r\n\r\n"), |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3457 } | 3455 } |
| 3458 | 3456 |
| 3459 // Test a SPDY get through an HTTPS Proxy. | 3457 // Test a SPDY get through an HTTPS Proxy. |
| 3460 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyGet) { | 3458 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyGet) { |
| 3461 HttpRequestInfo request; | 3459 HttpRequestInfo request; |
| 3462 request.method = "GET"; | 3460 request.method = "GET"; |
| 3463 request.url = GURL("http://www.example.org/"); | 3461 request.url = GURL("http://www.example.org/"); |
| 3464 request.load_flags = 0; | 3462 request.load_flags = 0; |
| 3465 | 3463 |
| 3466 // Configure against https proxy server "proxy:70". | 3464 // Configure against https proxy server "proxy:70". |
| 3467 session_deps_.proxy_service.reset(ProxyService::CreateFixed( | 3465 session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70"); |
| 3468 "https://proxy:70")); | |
| 3469 BoundTestNetLog log; | 3466 BoundTestNetLog log; |
| 3470 session_deps_.net_log = log.bound().net_log(); | 3467 session_deps_.net_log = log.bound().net_log(); |
| 3471 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 3468 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 3472 | 3469 |
| 3473 // fetch http://www.example.org/ via SPDY | 3470 // fetch http://www.example.org/ via SPDY |
| 3474 scoped_ptr<SpdyFrame> req( | 3471 scoped_ptr<SpdyFrame> req( |
| 3475 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, false)); | 3472 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, false)); |
| 3476 MockWrite spdy_writes[] = {CreateMockWrite(*req, 0)}; | 3473 MockWrite spdy_writes[] = {CreateMockWrite(*req, 0)}; |
| 3477 | 3474 |
| 3478 scoped_ptr<SpdyFrame> resp(spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1)); | 3475 scoped_ptr<SpdyFrame> resp(spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1)); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3518 // Verifies that a session which races and wins against the owning transaction | 3515 // Verifies that a session which races and wins against the owning transaction |
| 3519 // (completing prior to host resolution), doesn't fail the transaction. | 3516 // (completing prior to host resolution), doesn't fail the transaction. |
| 3520 // Regression test for crbug.com/334413. | 3517 // Regression test for crbug.com/334413. |
| 3521 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyGetWithSessionRace) { | 3518 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyGetWithSessionRace) { |
| 3522 HttpRequestInfo request; | 3519 HttpRequestInfo request; |
| 3523 request.method = "GET"; | 3520 request.method = "GET"; |
| 3524 request.url = GURL("http://www.example.org/"); | 3521 request.url = GURL("http://www.example.org/"); |
| 3525 request.load_flags = 0; | 3522 request.load_flags = 0; |
| 3526 | 3523 |
| 3527 // Configure SPDY proxy server "proxy:70". | 3524 // Configure SPDY proxy server "proxy:70". |
| 3528 session_deps_.proxy_service.reset( | 3525 session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70"); |
| 3529 ProxyService::CreateFixed("https://proxy:70")); | |
| 3530 BoundTestNetLog log; | 3526 BoundTestNetLog log; |
| 3531 session_deps_.net_log = log.bound().net_log(); | 3527 session_deps_.net_log = log.bound().net_log(); |
| 3532 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 3528 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 3533 | 3529 |
| 3534 // Fetch http://www.example.org/ through the SPDY proxy. | 3530 // Fetch http://www.example.org/ through the SPDY proxy. |
| 3535 scoped_ptr<SpdyFrame> req( | 3531 scoped_ptr<SpdyFrame> req( |
| 3536 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, false)); | 3532 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, false)); |
| 3537 MockWrite spdy_writes[] = {CreateMockWrite(*req, 0)}; | 3533 MockWrite spdy_writes[] = {CreateMockWrite(*req, 0)}; |
| 3538 | 3534 |
| 3539 scoped_ptr<SpdyFrame> resp(spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1)); | 3535 scoped_ptr<SpdyFrame> resp(spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1)); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3588 } | 3584 } |
| 3589 | 3585 |
| 3590 // Test a SPDY get through an HTTPS Proxy. | 3586 // Test a SPDY get through an HTTPS Proxy. |
| 3591 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyGetWithProxyAuth) { | 3587 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyGetWithProxyAuth) { |
| 3592 HttpRequestInfo request; | 3588 HttpRequestInfo request; |
| 3593 request.method = "GET"; | 3589 request.method = "GET"; |
| 3594 request.url = GURL("http://www.example.org/"); | 3590 request.url = GURL("http://www.example.org/"); |
| 3595 request.load_flags = 0; | 3591 request.load_flags = 0; |
| 3596 | 3592 |
| 3597 // Configure against https proxy server "myproxy:70". | 3593 // Configure against https proxy server "myproxy:70". |
| 3598 session_deps_.proxy_service.reset( | 3594 session_deps_.proxy_service = ProxyService::CreateFixed("https://myproxy:70"); |
| 3599 ProxyService::CreateFixed("https://myproxy:70")); | |
| 3600 BoundTestNetLog log; | 3595 BoundTestNetLog log; |
| 3601 session_deps_.net_log = log.bound().net_log(); | 3596 session_deps_.net_log = log.bound().net_log(); |
| 3602 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 3597 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 3603 | 3598 |
| 3604 // The first request will be a bare GET, the second request will be a | 3599 // The first request will be a bare GET, the second request will be a |
| 3605 // GET with a Proxy-Authorization header. | 3600 // GET with a Proxy-Authorization header. |
| 3606 scoped_ptr<SpdyFrame> req_get( | 3601 scoped_ptr<SpdyFrame> req_get( |
| 3607 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, false)); | 3602 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, false)); |
| 3608 const char* const kExtraAuthorizationHeaders[] = { | 3603 const char* const kExtraAuthorizationHeaders[] = { |
| 3609 "proxy-authorization", "Basic Zm9vOmJhcg==" | 3604 "proxy-authorization", "Basic Zm9vOmJhcg==" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3689 } | 3684 } |
| 3690 | 3685 |
| 3691 // Test a SPDY CONNECT through an HTTPS Proxy to an HTTPS (non-SPDY) Server. | 3686 // Test a SPDY CONNECT through an HTTPS Proxy to an HTTPS (non-SPDY) Server. |
| 3692 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyConnectHttps) { | 3687 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyConnectHttps) { |
| 3693 HttpRequestInfo request; | 3688 HttpRequestInfo request; |
| 3694 request.method = "GET"; | 3689 request.method = "GET"; |
| 3695 request.url = GURL("https://www.example.org/"); | 3690 request.url = GURL("https://www.example.org/"); |
| 3696 request.load_flags = 0; | 3691 request.load_flags = 0; |
| 3697 | 3692 |
| 3698 // Configure against https proxy server "proxy:70". | 3693 // Configure against https proxy server "proxy:70". |
| 3699 session_deps_.proxy_service.reset(ProxyService::CreateFixed( | 3694 session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70"); |
| 3700 "https://proxy:70")); | |
| 3701 BoundTestNetLog log; | 3695 BoundTestNetLog log; |
| 3702 session_deps_.net_log = log.bound().net_log(); | 3696 session_deps_.net_log = log.bound().net_log(); |
| 3703 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 3697 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 3704 | 3698 |
| 3705 scoped_ptr<HttpTransaction> trans( | 3699 scoped_ptr<HttpTransaction> trans( |
| 3706 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 3700 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 3707 | 3701 |
| 3708 // CONNECT to www.example.org:443 via SPDY | 3702 // CONNECT to www.example.org:443 via SPDY |
| 3709 scoped_ptr<SpdyFrame> connect(spdy_util_.ConstructSpdyConnect( | 3703 scoped_ptr<SpdyFrame> connect(spdy_util_.ConstructSpdyConnect( |
| 3710 NULL, 0, 1, LOWEST, HostPortPair("www.example.org", 443))); | 3704 NULL, 0, 1, LOWEST, HostPortPair("www.example.org", 443))); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3774 } | 3768 } |
| 3775 | 3769 |
| 3776 // Test a SPDY CONNECT through an HTTPS Proxy to a SPDY server. | 3770 // Test a SPDY CONNECT through an HTTPS Proxy to a SPDY server. |
| 3777 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyConnectSpdy) { | 3771 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyConnectSpdy) { |
| 3778 HttpRequestInfo request; | 3772 HttpRequestInfo request; |
| 3779 request.method = "GET"; | 3773 request.method = "GET"; |
| 3780 request.url = GURL("https://www.example.org/"); | 3774 request.url = GURL("https://www.example.org/"); |
| 3781 request.load_flags = 0; | 3775 request.load_flags = 0; |
| 3782 | 3776 |
| 3783 // Configure against https proxy server "proxy:70". | 3777 // Configure against https proxy server "proxy:70". |
| 3784 session_deps_.proxy_service.reset(ProxyService::CreateFixed( | 3778 session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70"); |
| 3785 "https://proxy:70")); | |
| 3786 BoundTestNetLog log; | 3779 BoundTestNetLog log; |
| 3787 session_deps_.net_log = log.bound().net_log(); | 3780 session_deps_.net_log = log.bound().net_log(); |
| 3788 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 3781 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 3789 | 3782 |
| 3790 scoped_ptr<HttpTransaction> trans( | 3783 scoped_ptr<HttpTransaction> trans( |
| 3791 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 3784 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 3792 | 3785 |
| 3793 // CONNECT to www.example.org:443 via SPDY | 3786 // CONNECT to www.example.org:443 via SPDY |
| 3794 scoped_ptr<SpdyFrame> connect(spdy_util_.ConstructSpdyConnect( | 3787 scoped_ptr<SpdyFrame> connect(spdy_util_.ConstructSpdyConnect( |
| 3795 NULL, 0, 1, LOWEST, HostPortPair("www.example.org", 443))); | 3788 NULL, 0, 1, LOWEST, HostPortPair("www.example.org", 443))); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3866 } | 3859 } |
| 3867 | 3860 |
| 3868 // Test a SPDY CONNECT failure through an HTTPS Proxy. | 3861 // Test a SPDY CONNECT failure through an HTTPS Proxy. |
| 3869 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyConnectFailure) { | 3862 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyConnectFailure) { |
| 3870 HttpRequestInfo request; | 3863 HttpRequestInfo request; |
| 3871 request.method = "GET"; | 3864 request.method = "GET"; |
| 3872 request.url = GURL("https://www.example.org/"); | 3865 request.url = GURL("https://www.example.org/"); |
| 3873 request.load_flags = 0; | 3866 request.load_flags = 0; |
| 3874 | 3867 |
| 3875 // Configure against https proxy server "proxy:70". | 3868 // Configure against https proxy server "proxy:70". |
| 3876 session_deps_.proxy_service.reset(ProxyService::CreateFixed( | 3869 session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70"); |
| 3877 "https://proxy:70")); | |
| 3878 BoundTestNetLog log; | 3870 BoundTestNetLog log; |
| 3879 session_deps_.net_log = log.bound().net_log(); | 3871 session_deps_.net_log = log.bound().net_log(); |
| 3880 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 3872 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 3881 | 3873 |
| 3882 scoped_ptr<HttpTransaction> trans( | 3874 scoped_ptr<HttpTransaction> trans( |
| 3883 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 3875 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 3884 | 3876 |
| 3885 // CONNECT to www.example.org:443 via SPDY | 3877 // CONNECT to www.example.org:443 via SPDY |
| 3886 scoped_ptr<SpdyFrame> connect(spdy_util_.ConstructSpdyConnect( | 3878 scoped_ptr<SpdyFrame> connect(spdy_util_.ConstructSpdyConnect( |
| 3887 NULL, 0, 1, LOWEST, HostPortPair("www.example.org", 443))); | 3879 NULL, 0, 1, LOWEST, HostPortPair("www.example.org", 443))); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 3918 EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, rv); | 3910 EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, rv); |
| 3919 | 3911 |
| 3920 // TODO(ttuttle): Anything else to check here? | 3912 // TODO(ttuttle): Anything else to check here? |
| 3921 } | 3913 } |
| 3922 | 3914 |
| 3923 // Test load timing in the case of two HTTPS (non-SPDY) requests through a SPDY | 3915 // Test load timing in the case of two HTTPS (non-SPDY) requests through a SPDY |
| 3924 // HTTPS Proxy to different servers. | 3916 // HTTPS Proxy to different servers. |
| 3925 TEST_P(HttpNetworkTransactionTest, | 3917 TEST_P(HttpNetworkTransactionTest, |
| 3926 HttpsProxySpdyConnectHttpsLoadTimingTwoRequestsTwoServers) { | 3918 HttpsProxySpdyConnectHttpsLoadTimingTwoRequestsTwoServers) { |
| 3927 // Configure against https proxy server "proxy:70". | 3919 // Configure against https proxy server "proxy:70". |
| 3928 session_deps_.proxy_service.reset(ProxyService::CreateFixed( | 3920 session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70"); |
| 3929 "https://proxy:70")); | |
| 3930 BoundTestNetLog log; | 3921 BoundTestNetLog log; |
| 3931 session_deps_.net_log = log.bound().net_log(); | 3922 session_deps_.net_log = log.bound().net_log(); |
| 3932 scoped_refptr<HttpNetworkSession> session( | 3923 scoped_refptr<HttpNetworkSession> session( |
| 3933 SpdySessionDependencies::SpdyCreateSession(&session_deps_)); | 3924 SpdySessionDependencies::SpdyCreateSession(&session_deps_)); |
| 3934 | 3925 |
| 3935 HttpRequestInfo request1; | 3926 HttpRequestInfo request1; |
| 3936 request1.method = "GET"; | 3927 request1.method = "GET"; |
| 3937 request1.url = GURL("https://www.example.org/"); | 3928 request1.url = GURL("https://www.example.org/"); |
| 3938 request1.load_flags = 0; | 3929 request1.load_flags = 0; |
| 3939 | 3930 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4061 | 4052 |
| 4062 rv = trans2->Read(buf.get(), 256, callback.callback()); | 4053 rv = trans2->Read(buf.get(), 256, callback.callback()); |
| 4063 EXPECT_EQ(2, callback.GetResult(rv)); | 4054 EXPECT_EQ(2, callback.GetResult(rv)); |
| 4064 } | 4055 } |
| 4065 | 4056 |
| 4066 // Test load timing in the case of two HTTPS (non-SPDY) requests through a SPDY | 4057 // Test load timing in the case of two HTTPS (non-SPDY) requests through a SPDY |
| 4067 // HTTPS Proxy to the same server. | 4058 // HTTPS Proxy to the same server. |
| 4068 TEST_P(HttpNetworkTransactionTest, | 4059 TEST_P(HttpNetworkTransactionTest, |
| 4069 HttpsProxySpdyConnectHttpsLoadTimingTwoRequestsSameServer) { | 4060 HttpsProxySpdyConnectHttpsLoadTimingTwoRequestsSameServer) { |
| 4070 // Configure against https proxy server "proxy:70". | 4061 // Configure against https proxy server "proxy:70". |
| 4071 session_deps_.proxy_service.reset(ProxyService::CreateFixed( | 4062 session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70"); |
| 4072 "https://proxy:70")); | |
| 4073 BoundTestNetLog log; | 4063 BoundTestNetLog log; |
| 4074 session_deps_.net_log = log.bound().net_log(); | 4064 session_deps_.net_log = log.bound().net_log(); |
| 4075 scoped_refptr<HttpNetworkSession> session( | 4065 scoped_refptr<HttpNetworkSession> session( |
| 4076 SpdySessionDependencies::SpdyCreateSession(&session_deps_)); | 4066 SpdySessionDependencies::SpdyCreateSession(&session_deps_)); |
| 4077 | 4067 |
| 4078 HttpRequestInfo request1; | 4068 HttpRequestInfo request1; |
| 4079 request1.method = "GET"; | 4069 request1.method = "GET"; |
| 4080 request1.url = GURL("https://www.example.org/"); | 4070 request1.url = GURL("https://www.example.org/"); |
| 4081 request1.load_flags = 0; | 4071 request1.load_flags = 0; |
| 4082 | 4072 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4185 // The requests should have the same ID. | 4175 // The requests should have the same ID. |
| 4186 EXPECT_EQ(load_timing_info.socket_log_id, load_timing_info2.socket_log_id); | 4176 EXPECT_EQ(load_timing_info.socket_log_id, load_timing_info2.socket_log_id); |
| 4187 | 4177 |
| 4188 EXPECT_EQ(2, trans2->Read(buf.get(), 256, callback.callback())); | 4178 EXPECT_EQ(2, trans2->Read(buf.get(), 256, callback.callback())); |
| 4189 } | 4179 } |
| 4190 | 4180 |
| 4191 // Test load timing in the case of of two HTTP requests through a SPDY HTTPS | 4181 // Test load timing in the case of of two HTTP requests through a SPDY HTTPS |
| 4192 // Proxy to different servers. | 4182 // Proxy to different servers. |
| 4193 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyLoadTimingTwoHttpRequests) { | 4183 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyLoadTimingTwoHttpRequests) { |
| 4194 // Configure against https proxy server "proxy:70". | 4184 // Configure against https proxy server "proxy:70". |
| 4195 session_deps_.proxy_service.reset(ProxyService::CreateFixed( | 4185 session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70"); |
| 4196 "https://proxy:70")); | |
| 4197 BoundTestNetLog log; | 4186 BoundTestNetLog log; |
| 4198 session_deps_.net_log = log.bound().net_log(); | 4187 session_deps_.net_log = log.bound().net_log(); |
| 4199 scoped_refptr<HttpNetworkSession> session( | 4188 scoped_refptr<HttpNetworkSession> session( |
| 4200 SpdySessionDependencies::SpdyCreateSession(&session_deps_)); | 4189 SpdySessionDependencies::SpdyCreateSession(&session_deps_)); |
| 4201 | 4190 |
| 4202 HttpRequestInfo request1; | 4191 HttpRequestInfo request1; |
| 4203 request1.method = "GET"; | 4192 request1.method = "GET"; |
| 4204 request1.url = GURL("http://www.example.org/"); | 4193 request1.url = GURL("http://www.example.org/"); |
| 4205 request1.load_flags = 0; | 4194 request1.load_flags = 0; |
| 4206 | 4195 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4292 | 4281 |
| 4293 // Test the challenge-response-retry sequence through an HTTPS Proxy | 4282 // Test the challenge-response-retry sequence through an HTTPS Proxy |
| 4294 TEST_P(HttpNetworkTransactionTest, HttpsProxyAuthRetry) { | 4283 TEST_P(HttpNetworkTransactionTest, HttpsProxyAuthRetry) { |
| 4295 HttpRequestInfo request; | 4284 HttpRequestInfo request; |
| 4296 request.method = "GET"; | 4285 request.method = "GET"; |
| 4297 request.url = GURL("http://www.example.org/"); | 4286 request.url = GURL("http://www.example.org/"); |
| 4298 // when the no authentication data flag is set. | 4287 // when the no authentication data flag is set. |
| 4299 request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA; | 4288 request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA; |
| 4300 | 4289 |
| 4301 // Configure against https proxy server "myproxy:70". | 4290 // Configure against https proxy server "myproxy:70". |
| 4302 session_deps_.proxy_service.reset( | 4291 session_deps_.proxy_service = ProxyService::CreateFixed("https://myproxy:70"); |
| 4303 ProxyService::CreateFixed("https://myproxy:70")); | |
| 4304 BoundTestNetLog log; | 4292 BoundTestNetLog log; |
| 4305 session_deps_.net_log = log.bound().net_log(); | 4293 session_deps_.net_log = log.bound().net_log(); |
| 4306 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 4294 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 4307 | 4295 |
| 4308 // Since we have proxy, should use full url | 4296 // Since we have proxy, should use full url |
| 4309 MockWrite data_writes1[] = { | 4297 MockWrite data_writes1[] = { |
| 4310 MockWrite( | 4298 MockWrite( |
| 4311 "GET http://www.example.org/ HTTP/1.1\r\n" | 4299 "GET http://www.example.org/ HTTP/1.1\r\n" |
| 4312 "Host: www.example.org\r\n" | 4300 "Host: www.example.org\r\n" |
| 4313 "Proxy-Connection: keep-alive\r\n\r\n"), | 4301 "Proxy-Connection: keep-alive\r\n\r\n"), |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4392 } | 4380 } |
| 4393 | 4381 |
| 4394 void HttpNetworkTransactionTest::ConnectStatusHelperWithExpectedStatus( | 4382 void HttpNetworkTransactionTest::ConnectStatusHelperWithExpectedStatus( |
| 4395 const MockRead& status, int expected_status) { | 4383 const MockRead& status, int expected_status) { |
| 4396 HttpRequestInfo request; | 4384 HttpRequestInfo request; |
| 4397 request.method = "GET"; | 4385 request.method = "GET"; |
| 4398 request.url = GURL("https://www.example.org/"); | 4386 request.url = GURL("https://www.example.org/"); |
| 4399 request.load_flags = 0; | 4387 request.load_flags = 0; |
| 4400 | 4388 |
| 4401 // Configure against proxy server "myproxy:70". | 4389 // Configure against proxy server "myproxy:70". |
| 4402 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); | 4390 session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70"); |
| 4403 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 4391 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 4404 | 4392 |
| 4405 // Since we have proxy, should try to establish tunnel. | 4393 // Since we have proxy, should try to establish tunnel. |
| 4406 MockWrite data_writes[] = { | 4394 MockWrite data_writes[] = { |
| 4407 MockWrite( | 4395 MockWrite( |
| 4408 "CONNECT www.example.org:443 HTTP/1.1\r\n" | 4396 "CONNECT www.example.org:443 HTTP/1.1\r\n" |
| 4409 "Host: www.example.org\r\n" | 4397 "Host: www.example.org\r\n" |
| 4410 "Proxy-Connection: keep-alive\r\n\r\n"), | 4398 "Proxy-Connection: keep-alive\r\n\r\n"), |
| 4411 }; | 4399 }; |
| 4412 | 4400 |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4610 // Test the flow when both the proxy server AND origin server require | 4598 // Test the flow when both the proxy server AND origin server require |
| 4611 // authentication. Again, this uses basic auth for both since that is | 4599 // authentication. Again, this uses basic auth for both since that is |
| 4612 // the simplest to mock. | 4600 // the simplest to mock. |
| 4613 TEST_P(HttpNetworkTransactionTest, BasicAuthProxyThenServer) { | 4601 TEST_P(HttpNetworkTransactionTest, BasicAuthProxyThenServer) { |
| 4614 HttpRequestInfo request; | 4602 HttpRequestInfo request; |
| 4615 request.method = "GET"; | 4603 request.method = "GET"; |
| 4616 request.url = GURL("http://www.example.org/"); | 4604 request.url = GURL("http://www.example.org/"); |
| 4617 request.load_flags = 0; | 4605 request.load_flags = 0; |
| 4618 | 4606 |
| 4619 // Configure against proxy server "myproxy:70". | 4607 // Configure against proxy server "myproxy:70". |
| 4620 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); | 4608 session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70"); |
| 4621 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 4609 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 4622 | 4610 |
| 4623 scoped_ptr<HttpTransaction> trans( | 4611 scoped_ptr<HttpTransaction> trans( |
| 4624 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 4612 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 4625 | 4613 |
| 4626 MockWrite data_writes1[] = { | 4614 MockWrite data_writes1[] = { |
| 4627 MockWrite( | 4615 MockWrite( |
| 4628 "GET http://www.example.org/ HTTP/1.1\r\n" | 4616 "GET http://www.example.org/ HTTP/1.1\r\n" |
| 4629 "Host: www.example.org\r\n" | 4617 "Host: www.example.org\r\n" |
| 4630 "Proxy-Connection: keep-alive\r\n\r\n"), | 4618 "Proxy-Connection: keep-alive\r\n\r\n"), |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5113 // establish tunnel. | 5101 // establish tunnel. |
| 5114 // http://code.google.com/p/chromium/issues/detail?id=3772 | 5102 // http://code.google.com/p/chromium/issues/detail?id=3772 |
| 5115 TEST_P(HttpNetworkTransactionTest, | 5103 TEST_P(HttpNetworkTransactionTest, |
| 5116 DontRecycleTransportSocketForSSLTunnel) { | 5104 DontRecycleTransportSocketForSSLTunnel) { |
| 5117 HttpRequestInfo request; | 5105 HttpRequestInfo request; |
| 5118 request.method = "GET"; | 5106 request.method = "GET"; |
| 5119 request.url = GURL("https://www.example.org/"); | 5107 request.url = GURL("https://www.example.org/"); |
| 5120 request.load_flags = 0; | 5108 request.load_flags = 0; |
| 5121 | 5109 |
| 5122 // Configure against proxy server "myproxy:70". | 5110 // Configure against proxy server "myproxy:70". |
| 5123 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); | 5111 session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70"); |
| 5124 | 5112 |
| 5125 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 5113 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 5126 | 5114 |
| 5127 scoped_ptr<HttpTransaction> trans( | 5115 scoped_ptr<HttpTransaction> trans( |
| 5128 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 5116 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 5129 | 5117 |
| 5130 // Since we have proxy, should try to establish tunnel. | 5118 // Since we have proxy, should try to establish tunnel. |
| 5131 MockWrite data_writes1[] = { | 5119 MockWrite data_writes1[] = { |
| 5132 MockWrite( | 5120 MockWrite( |
| 5133 "CONNECT www.example.org:443 HTTP/1.1\r\n" | 5121 "CONNECT www.example.org:443 HTTP/1.1\r\n" |
| (...skipping 1295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6429 | 6417 |
| 6430 const HttpResponseInfo* response = trans->GetResponseInfo(); | 6418 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 6431 | 6419 |
| 6432 ASSERT_TRUE(response != NULL); | 6420 ASSERT_TRUE(response != NULL); |
| 6433 EXPECT_EQ(100, response->headers->GetContentLength()); | 6421 EXPECT_EQ(100, response->headers->GetContentLength()); |
| 6434 } | 6422 } |
| 6435 | 6423 |
| 6436 // Test HTTPS connections to a site with a bad certificate, going through a | 6424 // Test HTTPS connections to a site with a bad certificate, going through a |
| 6437 // proxy | 6425 // proxy |
| 6438 TEST_P(HttpNetworkTransactionTest, HTTPSBadCertificateViaProxy) { | 6426 TEST_P(HttpNetworkTransactionTest, HTTPSBadCertificateViaProxy) { |
| 6439 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); | 6427 session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70"); |
| 6440 | 6428 |
| 6441 HttpRequestInfo request; | 6429 HttpRequestInfo request; |
| 6442 request.method = "GET"; | 6430 request.method = "GET"; |
| 6443 request.url = GURL("https://www.example.org/"); | 6431 request.url = GURL("https://www.example.org/"); |
| 6444 request.load_flags = 0; | 6432 request.load_flags = 0; |
| 6445 | 6433 |
| 6446 MockWrite proxy_writes[] = { | 6434 MockWrite proxy_writes[] = { |
| 6447 MockWrite( | 6435 MockWrite( |
| 6448 "CONNECT www.example.org:443 HTTP/1.1\r\n" | 6436 "CONNECT www.example.org:443 HTTP/1.1\r\n" |
| 6449 "Host: www.example.org\r\n" | 6437 "Host: www.example.org\r\n" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6511 const HttpResponseInfo* response = trans->GetResponseInfo(); | 6499 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 6512 | 6500 |
| 6513 ASSERT_TRUE(response != NULL); | 6501 ASSERT_TRUE(response != NULL); |
| 6514 EXPECT_EQ(100, response->headers->GetContentLength()); | 6502 EXPECT_EQ(100, response->headers->GetContentLength()); |
| 6515 } | 6503 } |
| 6516 } | 6504 } |
| 6517 | 6505 |
| 6518 | 6506 |
| 6519 // Test HTTPS connections to a site, going through an HTTPS proxy | 6507 // Test HTTPS connections to a site, going through an HTTPS proxy |
| 6520 TEST_P(HttpNetworkTransactionTest, HTTPSViaHttpsProxy) { | 6508 TEST_P(HttpNetworkTransactionTest, HTTPSViaHttpsProxy) { |
| 6521 session_deps_.proxy_service.reset( | 6509 session_deps_.proxy_service = |
| 6522 ProxyService::CreateFixedFromPacResult("HTTPS proxy:70")); | 6510 ProxyService::CreateFixedFromPacResult("HTTPS proxy:70"); |
| 6523 TestNetLog net_log; | 6511 TestNetLog net_log; |
| 6524 session_deps_.net_log = &net_log; | 6512 session_deps_.net_log = &net_log; |
| 6525 | 6513 |
| 6526 HttpRequestInfo request; | 6514 HttpRequestInfo request; |
| 6527 request.method = "GET"; | 6515 request.method = "GET"; |
| 6528 request.url = GURL("https://www.example.org/"); | 6516 request.url = GURL("https://www.example.org/"); |
| 6529 request.load_flags = 0; | 6517 request.load_flags = 0; |
| 6530 | 6518 |
| 6531 MockWrite data_writes[] = { | 6519 MockWrite data_writes[] = { |
| 6532 MockWrite( | 6520 MockWrite( |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6577 EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion()); | 6565 EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion()); |
| 6578 | 6566 |
| 6579 LoadTimingInfo load_timing_info; | 6567 LoadTimingInfo load_timing_info; |
| 6580 EXPECT_TRUE(trans->GetLoadTimingInfo(&load_timing_info)); | 6568 EXPECT_TRUE(trans->GetLoadTimingInfo(&load_timing_info)); |
| 6581 TestLoadTimingNotReusedWithPac(load_timing_info, | 6569 TestLoadTimingNotReusedWithPac(load_timing_info, |
| 6582 CONNECT_TIMING_HAS_SSL_TIMES); | 6570 CONNECT_TIMING_HAS_SSL_TIMES); |
| 6583 } | 6571 } |
| 6584 | 6572 |
| 6585 // Test an HTTPS Proxy's ability to redirect a CONNECT request | 6573 // Test an HTTPS Proxy's ability to redirect a CONNECT request |
| 6586 TEST_P(HttpNetworkTransactionTest, RedirectOfHttpsConnectViaHttpsProxy) { | 6574 TEST_P(HttpNetworkTransactionTest, RedirectOfHttpsConnectViaHttpsProxy) { |
| 6587 session_deps_.proxy_service.reset( | 6575 session_deps_.proxy_service = |
| 6588 ProxyService::CreateFixedFromPacResult("HTTPS proxy:70")); | 6576 ProxyService::CreateFixedFromPacResult("HTTPS proxy:70"); |
| 6589 TestNetLog net_log; | 6577 TestNetLog net_log; |
| 6590 session_deps_.net_log = &net_log; | 6578 session_deps_.net_log = &net_log; |
| 6591 | 6579 |
| 6592 HttpRequestInfo request; | 6580 HttpRequestInfo request; |
| 6593 request.method = "GET"; | 6581 request.method = "GET"; |
| 6594 request.url = GURL("https://www.example.org/"); | 6582 request.url = GURL("https://www.example.org/"); |
| 6595 request.load_flags = 0; | 6583 request.load_flags = 0; |
| 6596 | 6584 |
| 6597 MockWrite data_writes[] = { | 6585 MockWrite data_writes[] = { |
| 6598 MockWrite( | 6586 MockWrite( |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6654 load_timing_info.connect_timing, | 6642 load_timing_info.connect_timing, |
| 6655 CONNECT_TIMING_HAS_DNS_TIMES | CONNECT_TIMING_HAS_SSL_TIMES); | 6643 CONNECT_TIMING_HAS_DNS_TIMES | CONNECT_TIMING_HAS_SSL_TIMES); |
| 6656 | 6644 |
| 6657 EXPECT_TRUE(load_timing_info.send_start.is_null()); | 6645 EXPECT_TRUE(load_timing_info.send_start.is_null()); |
| 6658 EXPECT_TRUE(load_timing_info.send_end.is_null()); | 6646 EXPECT_TRUE(load_timing_info.send_end.is_null()); |
| 6659 EXPECT_TRUE(load_timing_info.receive_headers_end.is_null()); | 6647 EXPECT_TRUE(load_timing_info.receive_headers_end.is_null()); |
| 6660 } | 6648 } |
| 6661 | 6649 |
| 6662 // Test an HTTPS (SPDY) Proxy's ability to redirect a CONNECT request | 6650 // Test an HTTPS (SPDY) Proxy's ability to redirect a CONNECT request |
| 6663 TEST_P(HttpNetworkTransactionTest, RedirectOfHttpsConnectViaSpdyProxy) { | 6651 TEST_P(HttpNetworkTransactionTest, RedirectOfHttpsConnectViaSpdyProxy) { |
| 6664 session_deps_.proxy_service.reset( | 6652 session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70"); |
| 6665 ProxyService::CreateFixed("https://proxy:70")); | |
| 6666 | 6653 |
| 6667 HttpRequestInfo request; | 6654 HttpRequestInfo request; |
| 6668 request.method = "GET"; | 6655 request.method = "GET"; |
| 6669 request.url = GURL("https://www.example.org/"); | 6656 request.url = GURL("https://www.example.org/"); |
| 6670 request.load_flags = 0; | 6657 request.load_flags = 0; |
| 6671 | 6658 |
| 6672 scoped_ptr<SpdyFrame> conn(spdy_util_.ConstructSpdyConnect( | 6659 scoped_ptr<SpdyFrame> conn(spdy_util_.ConstructSpdyConnect( |
| 6673 NULL, 0, 1, LOWEST, HostPortPair("www.example.org", 443))); | 6660 NULL, 0, 1, LOWEST, HostPortPair("www.example.org", 443))); |
| 6674 scoped_ptr<SpdyFrame> goaway( | 6661 scoped_ptr<SpdyFrame> goaway( |
| 6675 spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); | 6662 spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6714 | 6701 |
| 6715 EXPECT_EQ(302, response->headers->response_code()); | 6702 EXPECT_EQ(302, response->headers->response_code()); |
| 6716 std::string url; | 6703 std::string url; |
| 6717 EXPECT_TRUE(response->headers->IsRedirect(&url)); | 6704 EXPECT_TRUE(response->headers->IsRedirect(&url)); |
| 6718 EXPECT_EQ("http://login.example.com/", url); | 6705 EXPECT_EQ("http://login.example.com/", url); |
| 6719 } | 6706 } |
| 6720 | 6707 |
| 6721 // Test that an HTTPS proxy's response to a CONNECT request is filtered. | 6708 // Test that an HTTPS proxy's response to a CONNECT request is filtered. |
| 6722 TEST_P(HttpNetworkTransactionTest, | 6709 TEST_P(HttpNetworkTransactionTest, |
| 6723 ErrorResponseToHttpsConnectViaHttpsProxy) { | 6710 ErrorResponseToHttpsConnectViaHttpsProxy) { |
| 6724 session_deps_.proxy_service.reset( | 6711 session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70"); |
| 6725 ProxyService::CreateFixed("https://proxy:70")); | |
| 6726 | 6712 |
| 6727 HttpRequestInfo request; | 6713 HttpRequestInfo request; |
| 6728 request.method = "GET"; | 6714 request.method = "GET"; |
| 6729 request.url = GURL("https://www.example.org/"); | 6715 request.url = GURL("https://www.example.org/"); |
| 6730 request.load_flags = 0; | 6716 request.load_flags = 0; |
| 6731 | 6717 |
| 6732 MockWrite data_writes[] = { | 6718 MockWrite data_writes[] = { |
| 6733 MockWrite( | 6719 MockWrite( |
| 6734 "CONNECT www.example.org:443 HTTP/1.1\r\n" | 6720 "CONNECT www.example.org:443 HTTP/1.1\r\n" |
| 6735 "Host: www.example.org\r\n" | 6721 "Host: www.example.org\r\n" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 6761 | 6747 |
| 6762 rv = callback.WaitForResult(); | 6748 rv = callback.WaitForResult(); |
| 6763 EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, rv); | 6749 EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, rv); |
| 6764 | 6750 |
| 6765 // TODO(ttuttle): Anything else to check here? | 6751 // TODO(ttuttle): Anything else to check here? |
| 6766 } | 6752 } |
| 6767 | 6753 |
| 6768 // Test that a SPDY proxy's response to a CONNECT request is filtered. | 6754 // Test that a SPDY proxy's response to a CONNECT request is filtered. |
| 6769 TEST_P(HttpNetworkTransactionTest, | 6755 TEST_P(HttpNetworkTransactionTest, |
| 6770 ErrorResponseToHttpsConnectViaSpdyProxy) { | 6756 ErrorResponseToHttpsConnectViaSpdyProxy) { |
| 6771 session_deps_.proxy_service.reset( | 6757 session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70"); |
| 6772 ProxyService::CreateFixed("https://proxy:70")); | |
| 6773 | 6758 |
| 6774 HttpRequestInfo request; | 6759 HttpRequestInfo request; |
| 6775 request.method = "GET"; | 6760 request.method = "GET"; |
| 6776 request.url = GURL("https://www.example.org/"); | 6761 request.url = GURL("https://www.example.org/"); |
| 6777 request.load_flags = 0; | 6762 request.load_flags = 0; |
| 6778 | 6763 |
| 6779 scoped_ptr<SpdyFrame> conn(spdy_util_.ConstructSpdyConnect( | 6764 scoped_ptr<SpdyFrame> conn(spdy_util_.ConstructSpdyConnect( |
| 6780 NULL, 0, 1, LOWEST, HostPortPair("www.example.org", 443))); | 6765 NULL, 0, 1, LOWEST, HostPortPair("www.example.org", 443))); |
| 6781 scoped_ptr<SpdyFrame> rst( | 6766 scoped_ptr<SpdyFrame> rst( |
| 6782 spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); | 6767 spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6826 // Test the request-challenge-retry sequence for basic auth, through | 6811 // Test the request-challenge-retry sequence for basic auth, through |
| 6827 // a SPDY proxy over a single SPDY session. | 6812 // a SPDY proxy over a single SPDY session. |
| 6828 TEST_P(HttpNetworkTransactionTest, BasicAuthSpdyProxy) { | 6813 TEST_P(HttpNetworkTransactionTest, BasicAuthSpdyProxy) { |
| 6829 HttpRequestInfo request; | 6814 HttpRequestInfo request; |
| 6830 request.method = "GET"; | 6815 request.method = "GET"; |
| 6831 request.url = GURL("https://www.example.org/"); | 6816 request.url = GURL("https://www.example.org/"); |
| 6832 // when the no authentication data flag is set. | 6817 // when the no authentication data flag is set. |
| 6833 request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA; | 6818 request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA; |
| 6834 | 6819 |
| 6835 // Configure against https proxy server "myproxy:70". | 6820 // Configure against https proxy server "myproxy:70". |
| 6836 session_deps_.proxy_service.reset( | 6821 session_deps_.proxy_service = |
| 6837 ProxyService::CreateFixedFromPacResult("HTTPS myproxy:70")); | 6822 ProxyService::CreateFixedFromPacResult("HTTPS myproxy:70"); |
| 6838 BoundTestNetLog log; | 6823 BoundTestNetLog log; |
| 6839 session_deps_.net_log = log.bound().net_log(); | 6824 session_deps_.net_log = log.bound().net_log(); |
| 6840 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 6825 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 6841 | 6826 |
| 6842 // Since we have proxy, should try to establish tunnel. | 6827 // Since we have proxy, should try to establish tunnel. |
| 6843 scoped_ptr<SpdyFrame> req(spdy_util_.ConstructSpdyConnect( | 6828 scoped_ptr<SpdyFrame> req(spdy_util_.ConstructSpdyConnect( |
| 6844 NULL, 0, 1, LOWEST, HostPortPair("www.example.org", 443))); | 6829 NULL, 0, 1, LOWEST, HostPortPair("www.example.org", 443))); |
| 6845 scoped_ptr<SpdyFrame> rst( | 6830 scoped_ptr<SpdyFrame> rst( |
| 6846 spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); | 6831 spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); |
| 6847 | 6832 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6967 TEST_P(HttpNetworkTransactionTest, CrossOriginProxyPush) { | 6952 TEST_P(HttpNetworkTransactionTest, CrossOriginProxyPush) { |
| 6968 HttpRequestInfo request; | 6953 HttpRequestInfo request; |
| 6969 HttpRequestInfo push_request; | 6954 HttpRequestInfo push_request; |
| 6970 | 6955 |
| 6971 request.method = "GET"; | 6956 request.method = "GET"; |
| 6972 request.url = GURL("http://www.example.org/"); | 6957 request.url = GURL("http://www.example.org/"); |
| 6973 push_request.method = "GET"; | 6958 push_request.method = "GET"; |
| 6974 push_request.url = GURL("http://www.another-origin.com/foo.dat"); | 6959 push_request.url = GURL("http://www.another-origin.com/foo.dat"); |
| 6975 | 6960 |
| 6976 // Configure against https proxy server "myproxy:70". | 6961 // Configure against https proxy server "myproxy:70". |
| 6977 session_deps_.proxy_service.reset( | 6962 session_deps_.proxy_service = |
| 6978 ProxyService::CreateFixedFromPacResult("HTTPS myproxy:70")); | 6963 ProxyService::CreateFixedFromPacResult("HTTPS myproxy:70"); |
| 6979 BoundTestNetLog log; | 6964 BoundTestNetLog log; |
| 6980 session_deps_.net_log = log.bound().net_log(); | 6965 session_deps_.net_log = log.bound().net_log(); |
| 6981 | 6966 |
| 6982 // Enable cross-origin push. | 6967 // Enable cross-origin push. |
| 6983 session_deps_.trusted_spdy_proxy = "myproxy:70"; | 6968 session_deps_.trusted_spdy_proxy = "myproxy:70"; |
| 6984 | 6969 |
| 6985 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 6970 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 6986 | 6971 |
| 6987 scoped_ptr<SpdyFrame> stream1_syn( | 6972 scoped_ptr<SpdyFrame> stream1_syn( |
| 6988 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, false)); | 6973 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, false)); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7081 } | 7066 } |
| 7082 | 7067 |
| 7083 // Test that an explicitly trusted SPDY proxy cannot push HTTPS content. | 7068 // Test that an explicitly trusted SPDY proxy cannot push HTTPS content. |
| 7084 TEST_P(HttpNetworkTransactionTest, CrossOriginProxyPushCorrectness) { | 7069 TEST_P(HttpNetworkTransactionTest, CrossOriginProxyPushCorrectness) { |
| 7085 HttpRequestInfo request; | 7070 HttpRequestInfo request; |
| 7086 | 7071 |
| 7087 request.method = "GET"; | 7072 request.method = "GET"; |
| 7088 request.url = GURL("http://www.example.org/"); | 7073 request.url = GURL("http://www.example.org/"); |
| 7089 | 7074 |
| 7090 // Configure against https proxy server "myproxy:70". | 7075 // Configure against https proxy server "myproxy:70". |
| 7091 session_deps_.proxy_service.reset( | 7076 session_deps_.proxy_service = ProxyService::CreateFixed("https://myproxy:70"); |
| 7092 ProxyService::CreateFixed("https://myproxy:70")); | |
| 7093 BoundTestNetLog log; | 7077 BoundTestNetLog log; |
| 7094 session_deps_.net_log = log.bound().net_log(); | 7078 session_deps_.net_log = log.bound().net_log(); |
| 7095 | 7079 |
| 7096 // Enable cross-origin push. | 7080 // Enable cross-origin push. |
| 7097 session_deps_.trusted_spdy_proxy = "myproxy:70"; | 7081 session_deps_.trusted_spdy_proxy = "myproxy:70"; |
| 7098 | 7082 |
| 7099 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 7083 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 7100 | 7084 |
| 7101 scoped_ptr<SpdyFrame> stream1_syn( | 7085 scoped_ptr<SpdyFrame> stream1_syn( |
| 7102 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, false)); | 7086 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, false)); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7157 EXPECT_EQ(OK, rv); | 7141 EXPECT_EQ(OK, rv); |
| 7158 EXPECT_EQ("hello!", response_data); | 7142 EXPECT_EQ("hello!", response_data); |
| 7159 | 7143 |
| 7160 trans.reset(); | 7144 trans.reset(); |
| 7161 session->CloseAllConnections(); | 7145 session->CloseAllConnections(); |
| 7162 } | 7146 } |
| 7163 | 7147 |
| 7164 // Test HTTPS connections to a site with a bad certificate, going through an | 7148 // Test HTTPS connections to a site with a bad certificate, going through an |
| 7165 // HTTPS proxy | 7149 // HTTPS proxy |
| 7166 TEST_P(HttpNetworkTransactionTest, HTTPSBadCertificateViaHttpsProxy) { | 7150 TEST_P(HttpNetworkTransactionTest, HTTPSBadCertificateViaHttpsProxy) { |
| 7167 session_deps_.proxy_service.reset(ProxyService::CreateFixed( | 7151 session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70"); |
| 7168 "https://proxy:70")); | |
| 7169 | 7152 |
| 7170 HttpRequestInfo request; | 7153 HttpRequestInfo request; |
| 7171 request.method = "GET"; | 7154 request.method = "GET"; |
| 7172 request.url = GURL("https://www.example.org/"); | 7155 request.url = GURL("https://www.example.org/"); |
| 7173 request.load_flags = 0; | 7156 request.load_flags = 0; |
| 7174 | 7157 |
| 7175 // Attempt to fetch the URL from a server with a bad cert | 7158 // Attempt to fetch the URL from a server with a bad cert |
| 7176 MockWrite bad_cert_writes[] = { | 7159 MockWrite bad_cert_writes[] = { |
| 7177 MockWrite( | 7160 MockWrite( |
| 7178 "CONNECT www.example.org:443 HTTP/1.1\r\n" | 7161 "CONNECT www.example.org:443 HTTP/1.1\r\n" |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7287 EXPECT_EQ(OK, rv); | 7270 EXPECT_EQ(OK, rv); |
| 7288 } | 7271 } |
| 7289 | 7272 |
| 7290 TEST_P(HttpNetworkTransactionTest, BuildRequest_UserAgentOverTunnel) { | 7273 TEST_P(HttpNetworkTransactionTest, BuildRequest_UserAgentOverTunnel) { |
| 7291 HttpRequestInfo request; | 7274 HttpRequestInfo request; |
| 7292 request.method = "GET"; | 7275 request.method = "GET"; |
| 7293 request.url = GURL("https://www.example.org/"); | 7276 request.url = GURL("https://www.example.org/"); |
| 7294 request.extra_headers.SetHeader(HttpRequestHeaders::kUserAgent, | 7277 request.extra_headers.SetHeader(HttpRequestHeaders::kUserAgent, |
| 7295 "Chromium Ultra Awesome X Edition"); | 7278 "Chromium Ultra Awesome X Edition"); |
| 7296 | 7279 |
| 7297 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); | 7280 session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70"); |
| 7298 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 7281 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 7299 scoped_ptr<HttpTransaction> trans( | 7282 scoped_ptr<HttpTransaction> trans( |
| 7300 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 7283 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 7301 | 7284 |
| 7302 MockWrite data_writes[] = { | 7285 MockWrite data_writes[] = { |
| 7303 MockWrite( | 7286 MockWrite( |
| 7304 "CONNECT www.example.org:443 HTTP/1.1\r\n" | 7287 "CONNECT www.example.org:443 HTTP/1.1\r\n" |
| 7305 "Host: www.example.org\r\n" | 7288 "Host: www.example.org\r\n" |
| 7306 "Proxy-Connection: keep-alive\r\n" | 7289 "Proxy-Connection: keep-alive\r\n" |
| 7307 "User-Agent: Chromium Ultra Awesome X Edition\r\n\r\n"), | 7290 "User-Agent: Chromium Ultra Awesome X Edition\r\n\r\n"), |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7641 rv = callback.WaitForResult(); | 7624 rv = callback.WaitForResult(); |
| 7642 EXPECT_EQ(OK, rv); | 7625 EXPECT_EQ(OK, rv); |
| 7643 } | 7626 } |
| 7644 | 7627 |
| 7645 TEST_P(HttpNetworkTransactionTest, SOCKS4_HTTP_GET) { | 7628 TEST_P(HttpNetworkTransactionTest, SOCKS4_HTTP_GET) { |
| 7646 HttpRequestInfo request; | 7629 HttpRequestInfo request; |
| 7647 request.method = "GET"; | 7630 request.method = "GET"; |
| 7648 request.url = GURL("http://www.example.org/"); | 7631 request.url = GURL("http://www.example.org/"); |
| 7649 request.load_flags = 0; | 7632 request.load_flags = 0; |
| 7650 | 7633 |
| 7651 session_deps_.proxy_service.reset( | 7634 session_deps_.proxy_service = |
| 7652 ProxyService::CreateFixedFromPacResult("SOCKS myproxy:1080")); | 7635 ProxyService::CreateFixedFromPacResult("SOCKS myproxy:1080"); |
| 7653 TestNetLog net_log; | 7636 TestNetLog net_log; |
| 7654 session_deps_.net_log = &net_log; | 7637 session_deps_.net_log = &net_log; |
| 7655 | 7638 |
| 7656 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 7639 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 7657 scoped_ptr<HttpTransaction> trans( | 7640 scoped_ptr<HttpTransaction> trans( |
| 7658 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 7641 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 7659 | 7642 |
| 7660 char write_buffer[] = { 0x04, 0x01, 0x00, 0x50, 127, 0, 0, 1, 0 }; | 7643 char write_buffer[] = { 0x04, 0x01, 0x00, 0x50, 127, 0, 0, 1, 0 }; |
| 7661 char read_buffer[] = { 0x00, 0x5A, 0x00, 0x00, 0, 0, 0, 0 }; | 7644 char read_buffer[] = { 0x00, 0x5A, 0x00, 0x00, 0, 0, 0, 0 }; |
| 7662 | 7645 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7700 EXPECT_EQ(OK, rv); | 7683 EXPECT_EQ(OK, rv); |
| 7701 EXPECT_EQ("Payload", response_text); | 7684 EXPECT_EQ("Payload", response_text); |
| 7702 } | 7685 } |
| 7703 | 7686 |
| 7704 TEST_P(HttpNetworkTransactionTest, SOCKS4_SSL_GET) { | 7687 TEST_P(HttpNetworkTransactionTest, SOCKS4_SSL_GET) { |
| 7705 HttpRequestInfo request; | 7688 HttpRequestInfo request; |
| 7706 request.method = "GET"; | 7689 request.method = "GET"; |
| 7707 request.url = GURL("https://www.example.org/"); | 7690 request.url = GURL("https://www.example.org/"); |
| 7708 request.load_flags = 0; | 7691 request.load_flags = 0; |
| 7709 | 7692 |
| 7710 session_deps_.proxy_service.reset( | 7693 session_deps_.proxy_service = |
| 7711 ProxyService::CreateFixedFromPacResult("SOCKS myproxy:1080")); | 7694 ProxyService::CreateFixedFromPacResult("SOCKS myproxy:1080"); |
| 7712 TestNetLog net_log; | 7695 TestNetLog net_log; |
| 7713 session_deps_.net_log = &net_log; | 7696 session_deps_.net_log = &net_log; |
| 7714 | 7697 |
| 7715 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 7698 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 7716 scoped_ptr<HttpTransaction> trans( | 7699 scoped_ptr<HttpTransaction> trans( |
| 7717 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 7700 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 7718 | 7701 |
| 7719 unsigned char write_buffer[] = { 0x04, 0x01, 0x01, 0xBB, 127, 0, 0, 1, 0 }; | 7702 unsigned char write_buffer[] = { 0x04, 0x01, 0x01, 0xBB, 127, 0, 0, 1, 0 }; |
| 7720 unsigned char read_buffer[] = { 0x00, 0x5A, 0x00, 0x00, 0, 0, 0, 0 }; | 7703 unsigned char read_buffer[] = { 0x00, 0x5A, 0x00, 0x00, 0, 0, 0, 0 }; |
| 7721 | 7704 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7764 EXPECT_EQ(OK, rv); | 7747 EXPECT_EQ(OK, rv); |
| 7765 EXPECT_EQ("Payload", response_text); | 7748 EXPECT_EQ("Payload", response_text); |
| 7766 } | 7749 } |
| 7767 | 7750 |
| 7768 TEST_P(HttpNetworkTransactionTest, SOCKS4_HTTP_GET_no_PAC) { | 7751 TEST_P(HttpNetworkTransactionTest, SOCKS4_HTTP_GET_no_PAC) { |
| 7769 HttpRequestInfo request; | 7752 HttpRequestInfo request; |
| 7770 request.method = "GET"; | 7753 request.method = "GET"; |
| 7771 request.url = GURL("http://www.example.org/"); | 7754 request.url = GURL("http://www.example.org/"); |
| 7772 request.load_flags = 0; | 7755 request.load_flags = 0; |
| 7773 | 7756 |
| 7774 session_deps_.proxy_service.reset( | 7757 session_deps_.proxy_service = |
| 7775 ProxyService::CreateFixed("socks4://myproxy:1080")); | 7758 ProxyService::CreateFixed("socks4://myproxy:1080"); |
| 7776 TestNetLog net_log; | 7759 TestNetLog net_log; |
| 7777 session_deps_.net_log = &net_log; | 7760 session_deps_.net_log = &net_log; |
| 7778 | 7761 |
| 7779 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 7762 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 7780 scoped_ptr<HttpTransaction> trans( | 7763 scoped_ptr<HttpTransaction> trans( |
| 7781 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 7764 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 7782 | 7765 |
| 7783 char write_buffer[] = { 0x04, 0x01, 0x00, 0x50, 127, 0, 0, 1, 0 }; | 7766 char write_buffer[] = { 0x04, 0x01, 0x00, 0x50, 127, 0, 0, 1, 0 }; |
| 7784 char read_buffer[] = { 0x00, 0x5A, 0x00, 0x00, 0, 0, 0, 0 }; | 7767 char read_buffer[] = { 0x00, 0x5A, 0x00, 0x00, 0, 0, 0, 0 }; |
| 7785 | 7768 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7823 EXPECT_EQ(OK, rv); | 7806 EXPECT_EQ(OK, rv); |
| 7824 EXPECT_EQ("Payload", response_text); | 7807 EXPECT_EQ("Payload", response_text); |
| 7825 } | 7808 } |
| 7826 | 7809 |
| 7827 TEST_P(HttpNetworkTransactionTest, SOCKS5_HTTP_GET) { | 7810 TEST_P(HttpNetworkTransactionTest, SOCKS5_HTTP_GET) { |
| 7828 HttpRequestInfo request; | 7811 HttpRequestInfo request; |
| 7829 request.method = "GET"; | 7812 request.method = "GET"; |
| 7830 request.url = GURL("http://www.example.org/"); | 7813 request.url = GURL("http://www.example.org/"); |
| 7831 request.load_flags = 0; | 7814 request.load_flags = 0; |
| 7832 | 7815 |
| 7833 session_deps_.proxy_service.reset( | 7816 session_deps_.proxy_service = |
| 7834 ProxyService::CreateFixedFromPacResult("SOCKS5 myproxy:1080")); | 7817 ProxyService::CreateFixedFromPacResult("SOCKS5 myproxy:1080"); |
| 7835 TestNetLog net_log; | 7818 TestNetLog net_log; |
| 7836 session_deps_.net_log = &net_log; | 7819 session_deps_.net_log = &net_log; |
| 7837 | 7820 |
| 7838 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 7821 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 7839 scoped_ptr<HttpTransaction> trans( | 7822 scoped_ptr<HttpTransaction> trans( |
| 7840 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 7823 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 7841 | 7824 |
| 7842 const char kSOCKS5GreetRequest[] = { 0x05, 0x01, 0x00 }; | 7825 const char kSOCKS5GreetRequest[] = { 0x05, 0x01, 0x00 }; |
| 7843 const char kSOCKS5GreetResponse[] = { 0x05, 0x00 }; | 7826 const char kSOCKS5GreetResponse[] = { 0x05, 0x00 }; |
| 7844 const char kSOCKS5OkRequest[] = { | 7827 const char kSOCKS5OkRequest[] = { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7895 EXPECT_EQ(OK, rv); | 7878 EXPECT_EQ(OK, rv); |
| 7896 EXPECT_EQ("Payload", response_text); | 7879 EXPECT_EQ("Payload", response_text); |
| 7897 } | 7880 } |
| 7898 | 7881 |
| 7899 TEST_P(HttpNetworkTransactionTest, SOCKS5_SSL_GET) { | 7882 TEST_P(HttpNetworkTransactionTest, SOCKS5_SSL_GET) { |
| 7900 HttpRequestInfo request; | 7883 HttpRequestInfo request; |
| 7901 request.method = "GET"; | 7884 request.method = "GET"; |
| 7902 request.url = GURL("https://www.example.org/"); | 7885 request.url = GURL("https://www.example.org/"); |
| 7903 request.load_flags = 0; | 7886 request.load_flags = 0; |
| 7904 | 7887 |
| 7905 session_deps_.proxy_service.reset( | 7888 session_deps_.proxy_service = |
| 7906 ProxyService::CreateFixedFromPacResult("SOCKS5 myproxy:1080")); | 7889 ProxyService::CreateFixedFromPacResult("SOCKS5 myproxy:1080"); |
| 7907 TestNetLog net_log; | 7890 TestNetLog net_log; |
| 7908 session_deps_.net_log = &net_log; | 7891 session_deps_.net_log = &net_log; |
| 7909 | 7892 |
| 7910 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 7893 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 7911 scoped_ptr<HttpTransaction> trans( | 7894 scoped_ptr<HttpTransaction> trans( |
| 7912 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 7895 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 7913 | 7896 |
| 7914 const char kSOCKS5GreetRequest[] = { 0x05, 0x01, 0x00 }; | 7897 const char kSOCKS5GreetRequest[] = { 0x05, 0x01, 0x00 }; |
| 7915 const char kSOCKS5GreetResponse[] = { 0x05, 0x00 }; | 7898 const char kSOCKS5GreetResponse[] = { 0x05, 0x00 }; |
| 7916 const unsigned char kSOCKS5OkRequest[] = { | 7899 const unsigned char kSOCKS5OkRequest[] = { |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8052 "", // unused | 8035 "", // unused |
| 8053 "http://host.with.alternate/direct", | 8036 "http://host.with.alternate/direct", |
| 8054 "ssl/host.with.alternate:443", | 8037 "ssl/host.with.alternate:443", |
| 8055 true, | 8038 true, |
| 8056 }, | 8039 }, |
| 8057 }; | 8040 }; |
| 8058 | 8041 |
| 8059 session_deps_.use_alternative_services = true; | 8042 session_deps_.use_alternative_services = true; |
| 8060 | 8043 |
| 8061 for (size_t i = 0; i < arraysize(tests); ++i) { | 8044 for (size_t i = 0; i < arraysize(tests); ++i) { |
| 8062 session_deps_.proxy_service.reset( | 8045 session_deps_.proxy_service = |
| 8063 ProxyService::CreateFixed(tests[i].proxy_server)); | 8046 ProxyService::CreateFixed(tests[i].proxy_server); |
| 8064 scoped_refptr<HttpNetworkSession> session( | 8047 scoped_refptr<HttpNetworkSession> session( |
| 8065 SetupSessionForGroupNameTests(GetParam(), &session_deps_)); | 8048 SetupSessionForGroupNameTests(GetParam(), &session_deps_)); |
| 8066 | 8049 |
| 8067 HttpNetworkSessionPeer peer(session); | 8050 HttpNetworkSessionPeer peer(session); |
| 8068 CaptureGroupNameTransportSocketPool* transport_conn_pool = | 8051 CaptureGroupNameTransportSocketPool* transport_conn_pool = |
| 8069 new CaptureGroupNameTransportSocketPool(NULL, NULL); | 8052 new CaptureGroupNameTransportSocketPool(NULL, NULL); |
| 8070 CaptureGroupNameSSLSocketPool* ssl_conn_pool = | 8053 CaptureGroupNameSSLSocketPool* ssl_conn_pool = |
| 8071 new CaptureGroupNameSSLSocketPool(NULL, NULL); | 8054 new CaptureGroupNameSSLSocketPool(NULL, NULL); |
| 8072 scoped_ptr<MockClientSocketPoolManager> mock_pool_manager( | 8055 scoped_ptr<MockClientSocketPoolManager> mock_pool_manager( |
| 8073 new MockClientSocketPoolManager); | 8056 new MockClientSocketPoolManager); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8114 "http_proxy", | 8097 "http_proxy", |
| 8115 "ftp://ftp.google.com/http_proxy_normal", | 8098 "ftp://ftp.google.com/http_proxy_normal", |
| 8116 "ftp/ftp.google.com:21", | 8099 "ftp/ftp.google.com:21", |
| 8117 false, | 8100 false, |
| 8118 }, | 8101 }, |
| 8119 }; | 8102 }; |
| 8120 | 8103 |
| 8121 session_deps_.use_alternative_services = true; | 8104 session_deps_.use_alternative_services = true; |
| 8122 | 8105 |
| 8123 for (size_t i = 0; i < arraysize(tests); ++i) { | 8106 for (size_t i = 0; i < arraysize(tests); ++i) { |
| 8124 session_deps_.proxy_service.reset( | 8107 session_deps_.proxy_service = |
| 8125 ProxyService::CreateFixed(tests[i].proxy_server)); | 8108 ProxyService::CreateFixed(tests[i].proxy_server); |
| 8126 scoped_refptr<HttpNetworkSession> session( | 8109 scoped_refptr<HttpNetworkSession> session( |
| 8127 SetupSessionForGroupNameTests(GetParam(), &session_deps_)); | 8110 SetupSessionForGroupNameTests(GetParam(), &session_deps_)); |
| 8128 | 8111 |
| 8129 HttpNetworkSessionPeer peer(session); | 8112 HttpNetworkSessionPeer peer(session); |
| 8130 | 8113 |
| 8131 HostPortPair proxy_host("http_proxy", 80); | 8114 HostPortPair proxy_host("http_proxy", 80); |
| 8132 CaptureGroupNameHttpProxySocketPool* http_proxy_pool = | 8115 CaptureGroupNameHttpProxySocketPool* http_proxy_pool = |
| 8133 new CaptureGroupNameHttpProxySocketPool(NULL, NULL); | 8116 new CaptureGroupNameHttpProxySocketPool(NULL, NULL); |
| 8134 CaptureGroupNameSSLSocketPool* ssl_conn_pool = | 8117 CaptureGroupNameSSLSocketPool* ssl_conn_pool = |
| 8135 new CaptureGroupNameSSLSocketPool(NULL, NULL); | 8118 new CaptureGroupNameSSLSocketPool(NULL, NULL); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8184 "socks4://socks_proxy:1080", | 8167 "socks4://socks_proxy:1080", |
| 8185 "http://host.with.alternate/direct", | 8168 "http://host.with.alternate/direct", |
| 8186 "socks4/ssl/host.with.alternate:443", | 8169 "socks4/ssl/host.with.alternate:443", |
| 8187 true, | 8170 true, |
| 8188 }, | 8171 }, |
| 8189 }; | 8172 }; |
| 8190 | 8173 |
| 8191 session_deps_.use_alternative_services = true; | 8174 session_deps_.use_alternative_services = true; |
| 8192 | 8175 |
| 8193 for (size_t i = 0; i < arraysize(tests); ++i) { | 8176 for (size_t i = 0; i < arraysize(tests); ++i) { |
| 8194 session_deps_.proxy_service.reset( | 8177 session_deps_.proxy_service = |
| 8195 ProxyService::CreateFixed(tests[i].proxy_server)); | 8178 ProxyService::CreateFixed(tests[i].proxy_server); |
| 8196 scoped_refptr<HttpNetworkSession> session( | 8179 scoped_refptr<HttpNetworkSession> session( |
| 8197 SetupSessionForGroupNameTests(GetParam(), &session_deps_)); | 8180 SetupSessionForGroupNameTests(GetParam(), &session_deps_)); |
| 8198 | 8181 |
| 8199 HttpNetworkSessionPeer peer(session); | 8182 HttpNetworkSessionPeer peer(session); |
| 8200 | 8183 |
| 8201 HostPortPair proxy_host("socks_proxy", 1080); | 8184 HostPortPair proxy_host("socks_proxy", 1080); |
| 8202 CaptureGroupNameSOCKSSocketPool* socks_conn_pool = | 8185 CaptureGroupNameSOCKSSocketPool* socks_conn_pool = |
| 8203 new CaptureGroupNameSOCKSSocketPool(NULL, NULL); | 8186 new CaptureGroupNameSOCKSSocketPool(NULL, NULL); |
| 8204 CaptureGroupNameSSLSocketPool* ssl_conn_pool = | 8187 CaptureGroupNameSSLSocketPool* ssl_conn_pool = |
| 8205 new CaptureGroupNameSSLSocketPool(NULL, NULL); | 8188 new CaptureGroupNameSSLSocketPool(NULL, NULL); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 8222 EXPECT_EQ(tests[i].expected_group_name, | 8205 EXPECT_EQ(tests[i].expected_group_name, |
| 8223 socks_conn_pool->last_group_name_received()); | 8206 socks_conn_pool->last_group_name_received()); |
| 8224 } | 8207 } |
| 8225 } | 8208 } |
| 8226 | 8209 |
| 8227 TEST_P(HttpNetworkTransactionTest, ReconsiderProxyAfterFailedConnection) { | 8210 TEST_P(HttpNetworkTransactionTest, ReconsiderProxyAfterFailedConnection) { |
| 8228 HttpRequestInfo request; | 8211 HttpRequestInfo request; |
| 8229 request.method = "GET"; | 8212 request.method = "GET"; |
| 8230 request.url = GURL("http://www.example.org/"); | 8213 request.url = GURL("http://www.example.org/"); |
| 8231 | 8214 |
| 8232 session_deps_.proxy_service.reset( | 8215 session_deps_.proxy_service = |
| 8233 ProxyService::CreateFixed("myproxy:70;foobar:80")); | 8216 ProxyService::CreateFixed("myproxy:70;foobar:80"); |
| 8234 | 8217 |
| 8235 // This simulates failure resolving all hostnames; that means we will fail | 8218 // This simulates failure resolving all hostnames; that means we will fail |
| 8236 // connecting to both proxies (myproxy:70 and foobar:80). | 8219 // connecting to both proxies (myproxy:70 and foobar:80). |
| 8237 session_deps_.host_resolver->rules()->AddSimulatedFailure("*"); | 8220 session_deps_.host_resolver->rules()->AddSimulatedFailure("*"); |
| 8238 | 8221 |
| 8239 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 8222 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 8240 scoped_ptr<HttpTransaction> trans( | 8223 scoped_ptr<HttpTransaction> trans( |
| 8241 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 8224 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 8242 | 8225 |
| 8243 TestCompletionCallback callback; | 8226 TestCompletionCallback callback; |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8460 EXPECT_EQ(OK, rv); | 8443 EXPECT_EQ(OK, rv); |
| 8461 | 8444 |
| 8462 response = trans->GetResponseInfo(); | 8445 response = trans->GetResponseInfo(); |
| 8463 ASSERT_TRUE(response != NULL); | 8446 ASSERT_TRUE(response != NULL); |
| 8464 EXPECT_TRUE(response->auth_challenge.get() == NULL); | 8447 EXPECT_TRUE(response->auth_challenge.get() == NULL); |
| 8465 EXPECT_EQ(100, response->headers->GetContentLength()); | 8448 EXPECT_EQ(100, response->headers->GetContentLength()); |
| 8466 } | 8449 } |
| 8467 | 8450 |
| 8468 // Test HTTPS connections going through a proxy that sends extra data. | 8451 // Test HTTPS connections going through a proxy that sends extra data. |
| 8469 TEST_P(HttpNetworkTransactionTest, HTTPSViaProxyWithExtraData) { | 8452 TEST_P(HttpNetworkTransactionTest, HTTPSViaProxyWithExtraData) { |
| 8470 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); | 8453 session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70"); |
| 8471 | 8454 |
| 8472 HttpRequestInfo request; | 8455 HttpRequestInfo request; |
| 8473 request.method = "GET"; | 8456 request.method = "GET"; |
| 8474 request.url = GURL("https://www.example.org/"); | 8457 request.url = GURL("https://www.example.org/"); |
| 8475 request.load_flags = 0; | 8458 request.load_flags = 0; |
| 8476 | 8459 |
| 8477 MockRead proxy_reads[] = { | 8460 MockRead proxy_reads[] = { |
| 8478 MockRead("HTTP/1.0 200 Connected\r\n\r\nExtra data"), | 8461 MockRead("HTTP/1.0 200 Connected\r\n\r\nExtra data"), |
| 8479 MockRead(SYNCHRONOUS, OK) | 8462 MockRead(SYNCHRONOUS, OK) |
| 8480 }; | 8463 }; |
| (...skipping 2027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10508 HttpAuthChallengeTokenizer tokenizer(auth_challenge.begin(), | 10491 HttpAuthChallengeTokenizer tokenizer(auth_challenge.begin(), |
| 10509 auth_challenge.end()); | 10492 auth_challenge.end()); |
| 10510 auth_handler->InitFromChallenge(&tokenizer, HttpAuth::AUTH_SERVER, | 10493 auth_handler->InitFromChallenge(&tokenizer, HttpAuth::AUTH_SERVER, |
| 10511 origin, BoundNetLog()); | 10494 origin, BoundNetLog()); |
| 10512 auth_handler->SetGenerateExpectation( | 10495 auth_handler->SetGenerateExpectation( |
| 10513 test_config.server_auth_timing == AUTH_ASYNC, | 10496 test_config.server_auth_timing == AUTH_ASYNC, |
| 10514 test_config.server_auth_rv); | 10497 test_config.server_auth_rv); |
| 10515 auth_factory->AddMockHandler(auth_handler, HttpAuth::AUTH_SERVER); | 10498 auth_factory->AddMockHandler(auth_handler, HttpAuth::AUTH_SERVER); |
| 10516 } | 10499 } |
| 10517 if (test_config.proxy_url) { | 10500 if (test_config.proxy_url) { |
| 10518 session_deps_.proxy_service.reset( | 10501 session_deps_.proxy_service = |
| 10519 ProxyService::CreateFixed(test_config.proxy_url)); | 10502 ProxyService::CreateFixed(test_config.proxy_url); |
| 10520 } else { | 10503 } else { |
| 10521 session_deps_.proxy_service.reset(ProxyService::CreateDirect()); | 10504 session_deps_.proxy_service = ProxyService::CreateDirect(); |
| 10522 } | 10505 } |
| 10523 | 10506 |
| 10524 HttpRequestInfo request; | 10507 HttpRequestInfo request; |
| 10525 request.method = "GET"; | 10508 request.method = "GET"; |
| 10526 request.url = GURL(test_config.server_url); | 10509 request.url = GURL(test_config.server_url); |
| 10527 request.load_flags = 0; | 10510 request.load_flags = 0; |
| 10528 | 10511 |
| 10529 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 10512 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 10530 HttpNetworkTransaction trans(DEFAULT_PRIORITY, session.get()); | 10513 HttpNetworkTransaction trans(DEFAULT_PRIORITY, session.get()); |
| 10531 | 10514 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10597 } | 10580 } |
| 10598 } | 10581 } |
| 10599 } | 10582 } |
| 10600 } | 10583 } |
| 10601 | 10584 |
| 10602 TEST_P(HttpNetworkTransactionTest, MultiRoundAuth) { | 10585 TEST_P(HttpNetworkTransactionTest, MultiRoundAuth) { |
| 10603 // Do multi-round authentication and make sure it works correctly. | 10586 // Do multi-round authentication and make sure it works correctly. |
| 10604 HttpAuthHandlerMock::Factory* auth_factory( | 10587 HttpAuthHandlerMock::Factory* auth_factory( |
| 10605 new HttpAuthHandlerMock::Factory()); | 10588 new HttpAuthHandlerMock::Factory()); |
| 10606 session_deps_.http_auth_handler_factory.reset(auth_factory); | 10589 session_deps_.http_auth_handler_factory.reset(auth_factory); |
| 10607 session_deps_.proxy_service.reset(ProxyService::CreateDirect()); | 10590 session_deps_.proxy_service = ProxyService::CreateDirect(); |
| 10608 session_deps_.host_resolver->rules()->AddRule("www.example.com", "10.0.0.1"); | 10591 session_deps_.host_resolver->rules()->AddRule("www.example.com", "10.0.0.1"); |
| 10609 session_deps_.host_resolver->set_synchronous_mode(true); | 10592 session_deps_.host_resolver->set_synchronous_mode(true); |
| 10610 | 10593 |
| 10611 HttpAuthHandlerMock* auth_handler(new HttpAuthHandlerMock()); | 10594 HttpAuthHandlerMock* auth_handler(new HttpAuthHandlerMock()); |
| 10612 auth_handler->set_connection_based(true); | 10595 auth_handler->set_connection_based(true); |
| 10613 std::string auth_challenge = "Mock realm=server"; | 10596 std::string auth_challenge = "Mock realm=server"; |
| 10614 GURL origin("http://www.example.com"); | 10597 GURL origin("http://www.example.com"); |
| 10615 HttpAuthChallengeTokenizer tokenizer(auth_challenge.begin(), | 10598 HttpAuthChallengeTokenizer tokenizer(auth_challenge.begin(), |
| 10616 auth_challenge.end()); | 10599 auth_challenge.end()); |
| 10617 auth_handler->InitFromChallenge(&tokenizer, HttpAuth::AUTH_SERVER, | 10600 auth_handler->InitFromChallenge(&tokenizer, HttpAuth::AUTH_SERVER, |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10908 private: | 10891 private: |
| 10909 GURL* url_; | 10892 GURL* url_; |
| 10910 }; | 10893 }; |
| 10911 | 10894 |
| 10912 // This test ensures that the URL passed into the proxy is upgraded to https | 10895 // This test ensures that the URL passed into the proxy is upgraded to https |
| 10913 // when doing an Alternate Protocol upgrade. | 10896 // when doing an Alternate Protocol upgrade. |
| 10914 TEST_P(HttpNetworkTransactionTest, SpdyAlternateProtocolThroughProxy) { | 10897 TEST_P(HttpNetworkTransactionTest, SpdyAlternateProtocolThroughProxy) { |
| 10915 session_deps_.use_alternative_services = true; | 10898 session_deps_.use_alternative_services = true; |
| 10916 session_deps_.next_protos = SpdyNextProtos(); | 10899 session_deps_.next_protos = SpdyNextProtos(); |
| 10917 | 10900 |
| 10918 session_deps_.proxy_service.reset( | 10901 session_deps_.proxy_service = |
| 10919 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); | 10902 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"); |
| 10920 TestNetLog net_log; | 10903 TestNetLog net_log; |
| 10921 session_deps_.net_log = &net_log; | 10904 session_deps_.net_log = &net_log; |
| 10922 GURL request_url; | 10905 GURL request_url; |
| 10923 { | 10906 { |
| 10924 HttpAuthHandlerMock::Factory* auth_factory = | 10907 HttpAuthHandlerMock::Factory* auth_factory = |
| 10925 new HttpAuthHandlerMock::Factory(); | 10908 new HttpAuthHandlerMock::Factory(); |
| 10926 UrlRecordingHttpAuthHandlerMock* auth_handler = | 10909 UrlRecordingHttpAuthHandlerMock* auth_handler = |
| 10927 new UrlRecordingHttpAuthHandlerMock(&request_url); | 10910 new UrlRecordingHttpAuthHandlerMock(&request_url); |
| 10928 auth_factory->AddMockHandler(auth_handler, HttpAuth::AUTH_PROXY); | 10911 auth_factory->AddMockHandler(auth_handler, HttpAuth::AUTH_PROXY); |
| 10929 auth_factory->set_do_init_from_challenge(true); | 10912 auth_factory->set_do_init_from_challenge(true); |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11154 | 11137 |
| 11155 // Let the HttpResponseBodyDrainer drain the socket. | 11138 // Let the HttpResponseBodyDrainer drain the socket. |
| 11156 base::MessageLoop::current()->RunUntilIdle(); | 11139 base::MessageLoop::current()->RunUntilIdle(); |
| 11157 | 11140 |
| 11158 // Socket should now be idle, waiting to be reused. | 11141 // Socket should now be idle, waiting to be reused. |
| 11159 EXPECT_EQ(1, GetIdleSocketCountInTransportSocketPool(session.get())); | 11142 EXPECT_EQ(1, GetIdleSocketCountInTransportSocketPool(session.get())); |
| 11160 } | 11143 } |
| 11161 | 11144 |
| 11162 // Test a basic GET request through a proxy. | 11145 // Test a basic GET request through a proxy. |
| 11163 TEST_P(HttpNetworkTransactionTest, ProxyGet) { | 11146 TEST_P(HttpNetworkTransactionTest, ProxyGet) { |
| 11164 session_deps_.proxy_service.reset( | 11147 session_deps_.proxy_service = |
| 11165 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); | 11148 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"); |
| 11166 BoundTestNetLog log; | 11149 BoundTestNetLog log; |
| 11167 session_deps_.net_log = log.bound().net_log(); | 11150 session_deps_.net_log = log.bound().net_log(); |
| 11168 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 11151 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 11169 | 11152 |
| 11170 HttpRequestInfo request; | 11153 HttpRequestInfo request; |
| 11171 request.method = "GET"; | 11154 request.method = "GET"; |
| 11172 request.url = GURL("http://www.example.org/"); | 11155 request.url = GURL("http://www.example.org/"); |
| 11173 | 11156 |
| 11174 MockWrite data_writes1[] = { | 11157 MockWrite data_writes1[] = { |
| 11175 MockWrite( | 11158 MockWrite( |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11218 EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion()); | 11201 EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion()); |
| 11219 | 11202 |
| 11220 LoadTimingInfo load_timing_info; | 11203 LoadTimingInfo load_timing_info; |
| 11221 EXPECT_TRUE(trans->GetLoadTimingInfo(&load_timing_info)); | 11204 EXPECT_TRUE(trans->GetLoadTimingInfo(&load_timing_info)); |
| 11222 TestLoadTimingNotReusedWithPac(load_timing_info, | 11205 TestLoadTimingNotReusedWithPac(load_timing_info, |
| 11223 CONNECT_TIMING_HAS_CONNECT_TIMES_ONLY); | 11206 CONNECT_TIMING_HAS_CONNECT_TIMES_ONLY); |
| 11224 } | 11207 } |
| 11225 | 11208 |
| 11226 // Test a basic HTTPS GET request through a proxy. | 11209 // Test a basic HTTPS GET request through a proxy. |
| 11227 TEST_P(HttpNetworkTransactionTest, ProxyTunnelGet) { | 11210 TEST_P(HttpNetworkTransactionTest, ProxyTunnelGet) { |
| 11228 session_deps_.proxy_service.reset( | 11211 session_deps_.proxy_service = |
| 11229 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); | 11212 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"); |
| 11230 BoundTestNetLog log; | 11213 BoundTestNetLog log; |
| 11231 session_deps_.net_log = log.bound().net_log(); | 11214 session_deps_.net_log = log.bound().net_log(); |
| 11232 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 11215 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 11233 | 11216 |
| 11234 HttpRequestInfo request; | 11217 HttpRequestInfo request; |
| 11235 request.method = "GET"; | 11218 request.method = "GET"; |
| 11236 request.url = GURL("https://www.example.org/"); | 11219 request.url = GURL("https://www.example.org/"); |
| 11237 | 11220 |
| 11238 // Since we have proxy, should try to establish tunnel. | 11221 // Since we have proxy, should try to establish tunnel. |
| 11239 MockWrite data_writes1[] = { | 11222 MockWrite data_writes1[] = { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11296 | 11279 |
| 11297 LoadTimingInfo load_timing_info; | 11280 LoadTimingInfo load_timing_info; |
| 11298 EXPECT_TRUE(trans->GetLoadTimingInfo(&load_timing_info)); | 11281 EXPECT_TRUE(trans->GetLoadTimingInfo(&load_timing_info)); |
| 11299 TestLoadTimingNotReusedWithPac(load_timing_info, | 11282 TestLoadTimingNotReusedWithPac(load_timing_info, |
| 11300 CONNECT_TIMING_HAS_SSL_TIMES); | 11283 CONNECT_TIMING_HAS_SSL_TIMES); |
| 11301 } | 11284 } |
| 11302 | 11285 |
| 11303 // Test a basic HTTPS GET request through a proxy, but the server hangs up | 11286 // Test a basic HTTPS GET request through a proxy, but the server hangs up |
| 11304 // while establishing the tunnel. | 11287 // while establishing the tunnel. |
| 11305 TEST_P(HttpNetworkTransactionTest, ProxyTunnelGetHangup) { | 11288 TEST_P(HttpNetworkTransactionTest, ProxyTunnelGetHangup) { |
| 11306 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); | 11289 session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70"); |
| 11307 BoundTestNetLog log; | 11290 BoundTestNetLog log; |
| 11308 session_deps_.net_log = log.bound().net_log(); | 11291 session_deps_.net_log = log.bound().net_log(); |
| 11309 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 11292 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 11310 | 11293 |
| 11311 HttpRequestInfo request; | 11294 HttpRequestInfo request; |
| 11312 request.method = "GET"; | 11295 request.method = "GET"; |
| 11313 request.url = GURL("https://www.example.org/"); | 11296 request.url = GURL("https://www.example.org/"); |
| 11314 | 11297 |
| 11315 // Since we have proxy, should try to establish tunnel. | 11298 // Since we have proxy, should try to establish tunnel. |
| 11316 MockWrite data_writes1[] = { | 11299 MockWrite data_writes1[] = { |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11667 | 11650 |
| 11668 // Ensure that a client certificate is removed from the SSL client auth | 11651 // Ensure that a client certificate is removed from the SSL client auth |
| 11669 // cache when: | 11652 // cache when: |
| 11670 // 1) An HTTPS proxy is involved. | 11653 // 1) An HTTPS proxy is involved. |
| 11671 // 3) The HTTPS proxy requests a client certificate. | 11654 // 3) The HTTPS proxy requests a client certificate. |
| 11672 // 4) The client supplies an invalid/unacceptable certificate for the | 11655 // 4) The client supplies an invalid/unacceptable certificate for the |
| 11673 // proxy. | 11656 // proxy. |
| 11674 // The test is repeated twice, first for connecting to an HTTPS endpoint, | 11657 // The test is repeated twice, first for connecting to an HTTPS endpoint, |
| 11675 // then for connecting to an HTTP endpoint. | 11658 // then for connecting to an HTTP endpoint. |
| 11676 TEST_P(HttpNetworkTransactionTest, ClientAuthCertCache_Proxy_Fail) { | 11659 TEST_P(HttpNetworkTransactionTest, ClientAuthCertCache_Proxy_Fail) { |
| 11677 session_deps_.proxy_service.reset( | 11660 session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70"); |
| 11678 ProxyService::CreateFixed("https://proxy:70")); | |
| 11679 BoundTestNetLog log; | 11661 BoundTestNetLog log; |
| 11680 session_deps_.net_log = log.bound().net_log(); | 11662 session_deps_.net_log = log.bound().net_log(); |
| 11681 | 11663 |
| 11682 scoped_refptr<SSLCertRequestInfo> cert_request(new SSLCertRequestInfo()); | 11664 scoped_refptr<SSLCertRequestInfo> cert_request(new SSLCertRequestInfo()); |
| 11683 cert_request->host_and_port = HostPortPair("proxy", 70); | 11665 cert_request->host_and_port = HostPortPair("proxy", 70); |
| 11684 | 11666 |
| 11685 // See ClientAuthCertCache_Direct_NoFalseStart for the explanation of | 11667 // See ClientAuthCertCache_Direct_NoFalseStart for the explanation of |
| 11686 // [ssl_]data[1-3]. Rather than represending the endpoint | 11668 // [ssl_]data[1-3]. Rather than represending the endpoint |
| 11687 // (www.example.com:443), they represent failures with the HTTPS proxy | 11669 // (www.example.com:443), they represent failures with the HTTPS proxy |
| 11688 // (proxy:70). | 11670 // (proxy:70). |
| (...skipping 964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12653 CreateMockRead(*resp2, 6), | 12635 CreateMockRead(*resp2, 6), |
| 12654 CreateMockRead(*body2, 7), | 12636 CreateMockRead(*body2, 7), |
| 12655 MockRead(ASYNC, ERR_IO_PENDING, 8) | 12637 MockRead(ASYNC, ERR_IO_PENDING, 8) |
| 12656 }; | 12638 }; |
| 12657 | 12639 |
| 12658 DeterministicSocketData data1(reads1, arraysize(reads1), | 12640 DeterministicSocketData data1(reads1, arraysize(reads1), |
| 12659 writes1, arraysize(writes1)); | 12641 writes1, arraysize(writes1)); |
| 12660 MockConnect connect_data1(ASYNC, OK); | 12642 MockConnect connect_data1(ASYNC, OK); |
| 12661 data1.set_connect_data(connect_data1); | 12643 data1.set_connect_data(connect_data1); |
| 12662 | 12644 |
| 12663 session_deps_.proxy_service.reset( | 12645 session_deps_.proxy_service = |
| 12664 ProxyService::CreateFixedFromPacResult("HTTPS proxy:70")); | 12646 ProxyService::CreateFixedFromPacResult("HTTPS proxy:70"); |
| 12665 TestNetLog log; | 12647 TestNetLog log; |
| 12666 session_deps_.net_log = &log; | 12648 session_deps_.net_log = &log; |
| 12667 SSLSocketDataProvider ssl1(ASYNC, OK); // to the proxy | 12649 SSLSocketDataProvider ssl1(ASYNC, OK); // to the proxy |
| 12668 ssl1.SetNextProto(GetParam()); | 12650 ssl1.SetNextProto(GetParam()); |
| 12669 session_deps_.deterministic_socket_factory->AddSSLSocketDataProvider(&ssl1); | 12651 session_deps_.deterministic_socket_factory->AddSSLSocketDataProvider(&ssl1); |
| 12670 SSLSocketDataProvider ssl2(ASYNC, OK); // to the server | 12652 SSLSocketDataProvider ssl2(ASYNC, OK); // to the server |
| 12671 ssl2.SetNextProto(GetParam()); | 12653 ssl2.SetNextProto(GetParam()); |
| 12672 session_deps_.deterministic_socket_factory->AddSSLSocketDataProvider(&ssl2); | 12654 session_deps_.deterministic_socket_factory->AddSSLSocketDataProvider(&ssl2); |
| 12673 session_deps_.deterministic_socket_factory->AddSocketDataProvider(&data1); | 12655 session_deps_.deterministic_socket_factory->AddSocketDataProvider(&data1); |
| 12674 | 12656 |
| (...skipping 1745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14420 | 14402 |
| 14421 // Verify that proxy headers are not sent to the destination server when | 14403 // Verify that proxy headers are not sent to the destination server when |
| 14422 // establishing a tunnel for a secure WebSocket connection. | 14404 // establishing a tunnel for a secure WebSocket connection. |
| 14423 TEST_P(HttpNetworkTransactionTest, ProxyHeadersNotSentOverWssTunnel) { | 14405 TEST_P(HttpNetworkTransactionTest, ProxyHeadersNotSentOverWssTunnel) { |
| 14424 HttpRequestInfo request; | 14406 HttpRequestInfo request; |
| 14425 request.method = "GET"; | 14407 request.method = "GET"; |
| 14426 request.url = GURL("wss://www.example.org/"); | 14408 request.url = GURL("wss://www.example.org/"); |
| 14427 AddWebSocketHeaders(&request.extra_headers); | 14409 AddWebSocketHeaders(&request.extra_headers); |
| 14428 | 14410 |
| 14429 // Configure against proxy server "myproxy:70". | 14411 // Configure against proxy server "myproxy:70". |
| 14430 session_deps_.proxy_service.reset( | 14412 session_deps_.proxy_service = |
| 14431 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); | 14413 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"); |
| 14432 | 14414 |
| 14433 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 14415 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 14434 | 14416 |
| 14435 // Since a proxy is configured, try to establish a tunnel. | 14417 // Since a proxy is configured, try to establish a tunnel. |
| 14436 MockWrite data_writes[] = { | 14418 MockWrite data_writes[] = { |
| 14437 MockWrite( | 14419 MockWrite( |
| 14438 "CONNECT www.example.org:443 HTTP/1.1\r\n" | 14420 "CONNECT www.example.org:443 HTTP/1.1\r\n" |
| 14439 "Host: www.example.org\r\n" | 14421 "Host: www.example.org\r\n" |
| 14440 "Proxy-Connection: keep-alive\r\n\r\n"), | 14422 "Proxy-Connection: keep-alive\r\n\r\n"), |
| 14441 | 14423 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14527 // This requires the authentication info to be injected into the auth cache | 14509 // This requires the authentication info to be injected into the auth cache |
| 14528 // due to crbug.com/395064 | 14510 // due to crbug.com/395064 |
| 14529 // TODO(ricea): Change to use a 407 response once issue 395064 is fixed. | 14511 // TODO(ricea): Change to use a 407 response once issue 395064 is fixed. |
| 14530 TEST_P(HttpNetworkTransactionTest, ProxyHeadersNotSentOverWsTunnel) { | 14512 TEST_P(HttpNetworkTransactionTest, ProxyHeadersNotSentOverWsTunnel) { |
| 14531 HttpRequestInfo request; | 14513 HttpRequestInfo request; |
| 14532 request.method = "GET"; | 14514 request.method = "GET"; |
| 14533 request.url = GURL("ws://www.example.org/"); | 14515 request.url = GURL("ws://www.example.org/"); |
| 14534 AddWebSocketHeaders(&request.extra_headers); | 14516 AddWebSocketHeaders(&request.extra_headers); |
| 14535 | 14517 |
| 14536 // Configure against proxy server "myproxy:70". | 14518 // Configure against proxy server "myproxy:70". |
| 14537 session_deps_.proxy_service.reset( | 14519 session_deps_.proxy_service = |
| 14538 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); | 14520 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"); |
| 14539 | 14521 |
| 14540 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 14522 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 14541 | 14523 |
| 14542 MockWrite data_writes[] = { | 14524 MockWrite data_writes[] = { |
| 14543 // Try to establish a tunnel for the WebSocket connection, with | 14525 // Try to establish a tunnel for the WebSocket connection, with |
| 14544 // credentials. Because WebSockets have a separate set of socket pools, | 14526 // credentials. Because WebSockets have a separate set of socket pools, |
| 14545 // they cannot and will not use the same TCP/IP connection as the | 14527 // they cannot and will not use the same TCP/IP connection as the |
| 14546 // preflight HTTP request. | 14528 // preflight HTTP request. |
| 14547 MockWrite( | 14529 MockWrite( |
| 14548 "CONNECT www.example.org:80 HTTP/1.1\r\n" | 14530 "CONNECT www.example.org:80 HTTP/1.1\r\n" |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14738 std::string response_data; | 14720 std::string response_data; |
| 14739 EXPECT_EQ(OK, ReadTransaction(trans.get(), &response_data)); | 14721 EXPECT_EQ(OK, ReadTransaction(trans.get(), &response_data)); |
| 14740 | 14722 |
| 14741 EXPECT_EQ(CountWriteBytes(data_writes, arraysize(data_writes)), | 14723 EXPECT_EQ(CountWriteBytes(data_writes, arraysize(data_writes)), |
| 14742 trans->GetTotalSentBytes()); | 14724 trans->GetTotalSentBytes()); |
| 14743 EXPECT_EQ(CountReadBytes(data_reads, arraysize(data_reads)), | 14725 EXPECT_EQ(CountReadBytes(data_reads, arraysize(data_reads)), |
| 14744 trans->GetTotalReceivedBytes()); | 14726 trans->GetTotalReceivedBytes()); |
| 14745 } | 14727 } |
| 14746 | 14728 |
| 14747 } // namespace net | 14729 } // namespace net |
| OLD | NEW |