OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/http/http_network_transaction.h" | 5 #include "net/http/http_network_transaction.h" |
6 | 6 |
7 #include <math.h> // ceil | 7 #include <math.h> // ceil |
8 #include <stdarg.h> | 8 #include <stdarg.h> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 2380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2391 // Test the request-challenge-retry sequence for basic auth, over a connection | 2391 // Test the request-challenge-retry sequence for basic auth, over a connection |
2392 // that requires a restart when setting up an SSL tunnel. | 2392 // that requires a restart when setting up an SSL tunnel. |
2393 TEST_P(HttpNetworkTransactionTest, BasicAuthProxyNoKeepAliveHttp10) { | 2393 TEST_P(HttpNetworkTransactionTest, BasicAuthProxyNoKeepAliveHttp10) { |
2394 HttpRequestInfo request; | 2394 HttpRequestInfo request; |
2395 request.method = "GET"; | 2395 request.method = "GET"; |
2396 request.url = GURL("https://www.example.org/"); | 2396 request.url = GURL("https://www.example.org/"); |
2397 // when the no authentication data flag is set. | 2397 // when the no authentication data flag is set. |
2398 request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA; | 2398 request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA; |
2399 | 2399 |
2400 // Configure against proxy server "myproxy:70". | 2400 // Configure against proxy server "myproxy:70". |
2401 session_deps_.proxy_service.reset( | 2401 session_deps_.proxy_service = |
2402 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); | 2402 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"); |
2403 BoundTestNetLog log; | 2403 BoundTestNetLog log; |
2404 session_deps_.net_log = log.bound().net_log(); | 2404 session_deps_.net_log = log.bound().net_log(); |
2405 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 2405 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
2406 | 2406 |
2407 // Since we have proxy, should try to establish tunnel. | 2407 // Since we have proxy, should try to establish tunnel. |
2408 MockWrite data_writes1[] = { | 2408 MockWrite data_writes1[] = { |
2409 MockWrite( | 2409 MockWrite( |
2410 "CONNECT www.example.org:443 HTTP/1.1\r\n" | 2410 "CONNECT www.example.org:443 HTTP/1.1\r\n" |
2411 "Host: www.example.org\r\n" | 2411 "Host: www.example.org\r\n" |
2412 "Proxy-Connection: keep-alive\r\n\r\n"), | 2412 "Proxy-Connection: keep-alive\r\n\r\n"), |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2509 // Test the request-challenge-retry sequence for basic auth, over a connection | 2509 // Test the request-challenge-retry sequence for basic auth, over a connection |
2510 // that requires a restart when setting up an SSL tunnel. | 2510 // that requires a restart when setting up an SSL tunnel. |
2511 TEST_P(HttpNetworkTransactionTest, BasicAuthProxyNoKeepAliveHttp11) { | 2511 TEST_P(HttpNetworkTransactionTest, BasicAuthProxyNoKeepAliveHttp11) { |
2512 HttpRequestInfo request; | 2512 HttpRequestInfo request; |
2513 request.method = "GET"; | 2513 request.method = "GET"; |
2514 request.url = GURL("https://www.example.org/"); | 2514 request.url = GURL("https://www.example.org/"); |
2515 // when the no authentication data flag is set. | 2515 // when the no authentication data flag is set. |
2516 request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA; | 2516 request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA; |
2517 | 2517 |
2518 // Configure against proxy server "myproxy:70". | 2518 // Configure against proxy server "myproxy:70". |
2519 session_deps_.proxy_service.reset( | 2519 session_deps_.proxy_service = |
2520 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); | 2520 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"); |
2521 BoundTestNetLog log; | 2521 BoundTestNetLog log; |
2522 session_deps_.net_log = log.bound().net_log(); | 2522 session_deps_.net_log = log.bound().net_log(); |
2523 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 2523 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
2524 | 2524 |
2525 // Since we have proxy, should try to establish tunnel. | 2525 // Since we have proxy, should try to establish tunnel. |
2526 MockWrite data_writes1[] = { | 2526 MockWrite data_writes1[] = { |
2527 MockWrite( | 2527 MockWrite( |
2528 "CONNECT www.example.org:443 HTTP/1.1\r\n" | 2528 "CONNECT www.example.org:443 HTTP/1.1\r\n" |
2529 "Host: www.example.org\r\n" | 2529 "Host: www.example.org\r\n" |
2530 "Proxy-Connection: keep-alive\r\n\r\n"), | 2530 "Proxy-Connection: keep-alive\r\n\r\n"), |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2630 // proxy connection with HTTP/1.0 responses, when setting up an SSL tunnel. | 2630 // proxy connection with HTTP/1.0 responses, when setting up an SSL tunnel. |
2631 TEST_P(HttpNetworkTransactionTest, BasicAuthProxyKeepAliveHttp10) { | 2631 TEST_P(HttpNetworkTransactionTest, BasicAuthProxyKeepAliveHttp10) { |
2632 HttpRequestInfo request; | 2632 HttpRequestInfo request; |
2633 request.method = "GET"; | 2633 request.method = "GET"; |
2634 request.url = GURL("https://www.example.org/"); | 2634 request.url = GURL("https://www.example.org/"); |
2635 // Ensure that proxy authentication is attempted even | 2635 // Ensure that proxy authentication is attempted even |
2636 // when the no authentication data flag is set. | 2636 // when the no authentication data flag is set. |
2637 request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA; | 2637 request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA; |
2638 | 2638 |
2639 // Configure against proxy server "myproxy:70". | 2639 // Configure against proxy server "myproxy:70". |
2640 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); | 2640 session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70"); |
2641 BoundTestNetLog log; | 2641 BoundTestNetLog log; |
2642 session_deps_.net_log = log.bound().net_log(); | 2642 session_deps_.net_log = log.bound().net_log(); |
2643 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 2643 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
2644 | 2644 |
2645 scoped_ptr<HttpTransaction> trans( | 2645 scoped_ptr<HttpTransaction> trans( |
2646 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 2646 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
2647 | 2647 |
2648 // Since we have proxy, should try to establish tunnel. | 2648 // Since we have proxy, should try to establish tunnel. |
2649 MockWrite data_writes1[] = { | 2649 MockWrite data_writes1[] = { |
2650 MockWrite( | 2650 MockWrite( |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2737 // proxy connection with HTTP/1.1 responses, when setting up an SSL tunnel. | 2737 // proxy connection with HTTP/1.1 responses, when setting up an SSL tunnel. |
2738 TEST_P(HttpNetworkTransactionTest, BasicAuthProxyKeepAliveHttp11) { | 2738 TEST_P(HttpNetworkTransactionTest, BasicAuthProxyKeepAliveHttp11) { |
2739 HttpRequestInfo request; | 2739 HttpRequestInfo request; |
2740 request.method = "GET"; | 2740 request.method = "GET"; |
2741 request.url = GURL("https://www.example.org/"); | 2741 request.url = GURL("https://www.example.org/"); |
2742 // Ensure that proxy authentication is attempted even | 2742 // Ensure that proxy authentication is attempted even |
2743 // when the no authentication data flag is set. | 2743 // when the no authentication data flag is set. |
2744 request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA; | 2744 request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA; |
2745 | 2745 |
2746 // Configure against proxy server "myproxy:70". | 2746 // Configure against proxy server "myproxy:70". |
2747 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); | 2747 session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70"); |
2748 BoundTestNetLog log; | 2748 BoundTestNetLog log; |
2749 session_deps_.net_log = log.bound().net_log(); | 2749 session_deps_.net_log = log.bound().net_log(); |
2750 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 2750 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
2751 | 2751 |
2752 scoped_ptr<HttpTransaction> trans( | 2752 scoped_ptr<HttpTransaction> trans( |
2753 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 2753 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
2754 | 2754 |
2755 // Since we have proxy, should try to establish tunnel. | 2755 // Since we have proxy, should try to establish tunnel. |
2756 MockWrite data_writes1[] = { | 2756 MockWrite data_writes1[] = { |
2757 MockWrite( | 2757 MockWrite( |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2841 | 2841 |
2842 // Test that we don't read the response body when we fail to establish a tunnel, | 2842 // Test that we don't read the response body when we fail to establish a tunnel, |
2843 // even if the user cancels the proxy's auth attempt. | 2843 // even if the user cancels the proxy's auth attempt. |
2844 TEST_P(HttpNetworkTransactionTest, BasicAuthProxyCancelTunnel) { | 2844 TEST_P(HttpNetworkTransactionTest, BasicAuthProxyCancelTunnel) { |
2845 HttpRequestInfo request; | 2845 HttpRequestInfo request; |
2846 request.method = "GET"; | 2846 request.method = "GET"; |
2847 request.url = GURL("https://www.example.org/"); | 2847 request.url = GURL("https://www.example.org/"); |
2848 request.load_flags = 0; | 2848 request.load_flags = 0; |
2849 | 2849 |
2850 // Configure against proxy server "myproxy:70". | 2850 // Configure against proxy server "myproxy:70". |
2851 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); | 2851 session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70"); |
2852 | 2852 |
2853 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 2853 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
2854 | 2854 |
2855 scoped_ptr<HttpTransaction> trans( | 2855 scoped_ptr<HttpTransaction> trans( |
2856 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 2856 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
2857 | 2857 |
2858 // Since we have proxy, should try to establish tunnel. | 2858 // Since we have proxy, should try to establish tunnel. |
2859 MockWrite data_writes[] = { | 2859 MockWrite data_writes[] = { |
2860 MockWrite( | 2860 MockWrite( |
2861 "CONNECT www.example.org:443 HTTP/1.1\r\n" | 2861 "CONNECT www.example.org:443 HTTP/1.1\r\n" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2901 | 2901 |
2902 // Test that we don't pass extraneous headers from the proxy's response to the | 2902 // Test that we don't pass extraneous headers from the proxy's response to the |
2903 // caller when the proxy responds to CONNECT with 407. | 2903 // caller when the proxy responds to CONNECT with 407. |
2904 TEST_P(HttpNetworkTransactionTest, SanitizeProxyAuthHeaders) { | 2904 TEST_P(HttpNetworkTransactionTest, SanitizeProxyAuthHeaders) { |
2905 HttpRequestInfo request; | 2905 HttpRequestInfo request; |
2906 request.method = "GET"; | 2906 request.method = "GET"; |
2907 request.url = GURL("https://www.example.org/"); | 2907 request.url = GURL("https://www.example.org/"); |
2908 request.load_flags = 0; | 2908 request.load_flags = 0; |
2909 | 2909 |
2910 // Configure against proxy server "myproxy:70". | 2910 // Configure against proxy server "myproxy:70". |
2911 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); | 2911 session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70"); |
2912 | 2912 |
2913 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 2913 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
2914 | 2914 |
2915 scoped_ptr<HttpTransaction> trans( | 2915 scoped_ptr<HttpTransaction> trans( |
2916 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 2916 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
2917 | 2917 |
2918 // Since we have proxy, should try to establish tunnel. | 2918 // Since we have proxy, should try to establish tunnel. |
2919 MockWrite data_writes[] = { | 2919 MockWrite data_writes[] = { |
2920 MockWrite( | 2920 MockWrite( |
2921 "CONNECT www.example.org:443 HTTP/1.1\r\n" | 2921 "CONNECT www.example.org:443 HTTP/1.1\r\n" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3009 // Note that it is impossible to detect if an HTTP server returns a 407 through | 3009 // Note that it is impossible to detect if an HTTP server returns a 407 through |
3010 // a non-authenticating proxy - there is nothing to indicate whether the | 3010 // a non-authenticating proxy - there is nothing to indicate whether the |
3011 // response came from the proxy or the server, so it is treated as if the proxy | 3011 // response came from the proxy or the server, so it is treated as if the proxy |
3012 // issued the challenge. | 3012 // issued the challenge. |
3013 TEST_P(HttpNetworkTransactionTest, | 3013 TEST_P(HttpNetworkTransactionTest, |
3014 HttpsServerRequestsProxyAuthThroughProxy) { | 3014 HttpsServerRequestsProxyAuthThroughProxy) { |
3015 HttpRequestInfo request; | 3015 HttpRequestInfo request; |
3016 request.method = "GET"; | 3016 request.method = "GET"; |
3017 request.url = GURL("https://www.example.org/"); | 3017 request.url = GURL("https://www.example.org/"); |
3018 | 3018 |
3019 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); | 3019 session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70"); |
3020 BoundTestNetLog log; | 3020 BoundTestNetLog log; |
3021 session_deps_.net_log = log.bound().net_log(); | 3021 session_deps_.net_log = log.bound().net_log(); |
3022 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 3022 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
3023 | 3023 |
3024 // Since we have proxy, should try to establish tunnel. | 3024 // Since we have proxy, should try to establish tunnel. |
3025 MockWrite data_writes1[] = { | 3025 MockWrite data_writes1[] = { |
3026 MockWrite( | 3026 MockWrite( |
3027 "CONNECT www.example.org:443 HTTP/1.1\r\n" | 3027 "CONNECT www.example.org:443 HTTP/1.1\r\n" |
3028 "Host: www.example.org\r\n" | 3028 "Host: www.example.org\r\n" |
3029 "Proxy-Connection: keep-alive\r\n\r\n"), | 3029 "Proxy-Connection: keep-alive\r\n\r\n"), |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3074 TEST_P(HttpNetworkTransactionTest, HttpProxyLoadTimingNoPacTwoRequests) { | 3074 TEST_P(HttpNetworkTransactionTest, HttpProxyLoadTimingNoPacTwoRequests) { |
3075 HttpRequestInfo request1; | 3075 HttpRequestInfo request1; |
3076 request1.method = "GET"; | 3076 request1.method = "GET"; |
3077 request1.url = GURL("https://www.example.org/1"); | 3077 request1.url = GURL("https://www.example.org/1"); |
3078 | 3078 |
3079 HttpRequestInfo request2; | 3079 HttpRequestInfo request2; |
3080 request2.method = "GET"; | 3080 request2.method = "GET"; |
3081 request2.url = GURL("https://www.example.org/2"); | 3081 request2.url = GURL("https://www.example.org/2"); |
3082 | 3082 |
3083 // Configure against proxy server "myproxy:70". | 3083 // Configure against proxy server "myproxy:70". |
3084 session_deps_.proxy_service.reset( | 3084 session_deps_.proxy_service = ProxyService::CreateFixed("PROXY myproxy:70"); |
3085 ProxyService::CreateFixed("PROXY myproxy:70")); | |
3086 BoundTestNetLog log; | 3085 BoundTestNetLog log; |
3087 session_deps_.net_log = log.bound().net_log(); | 3086 session_deps_.net_log = log.bound().net_log(); |
3088 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 3087 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
3089 | 3088 |
3090 // Since we have proxy, should try to establish tunnel. | 3089 // Since we have proxy, should try to establish tunnel. |
3091 MockWrite data_writes1[] = { | 3090 MockWrite data_writes1[] = { |
3092 MockWrite( | 3091 MockWrite( |
3093 "CONNECT www.example.org:443 HTTP/1.1\r\n" | 3092 "CONNECT www.example.org:443 HTTP/1.1\r\n" |
3094 "Host: www.example.org\r\n" | 3093 "Host: www.example.org\r\n" |
3095 "Proxy-Connection: keep-alive\r\n\r\n"), | 3094 "Proxy-Connection: keep-alive\r\n\r\n"), |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3175 TEST_P(HttpNetworkTransactionTest, HttpProxyLoadTimingWithPacTwoRequests) { | 3174 TEST_P(HttpNetworkTransactionTest, HttpProxyLoadTimingWithPacTwoRequests) { |
3176 HttpRequestInfo request1; | 3175 HttpRequestInfo request1; |
3177 request1.method = "GET"; | 3176 request1.method = "GET"; |
3178 request1.url = GURL("https://www.example.org/1"); | 3177 request1.url = GURL("https://www.example.org/1"); |
3179 | 3178 |
3180 HttpRequestInfo request2; | 3179 HttpRequestInfo request2; |
3181 request2.method = "GET"; | 3180 request2.method = "GET"; |
3182 request2.url = GURL("https://www.example.org/2"); | 3181 request2.url = GURL("https://www.example.org/2"); |
3183 | 3182 |
3184 // Configure against proxy server "myproxy:70". | 3183 // Configure against proxy server "myproxy:70". |
3185 session_deps_.proxy_service.reset( | 3184 session_deps_.proxy_service = |
3186 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); | 3185 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"); |
3187 BoundTestNetLog log; | 3186 BoundTestNetLog log; |
3188 session_deps_.net_log = log.bound().net_log(); | 3187 session_deps_.net_log = log.bound().net_log(); |
3189 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 3188 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
3190 | 3189 |
3191 // Since we have proxy, should try to establish tunnel. | 3190 // Since we have proxy, should try to establish tunnel. |
3192 MockWrite data_writes1[] = { | 3191 MockWrite data_writes1[] = { |
3193 MockWrite( | 3192 MockWrite( |
3194 "CONNECT www.example.org:443 HTTP/1.1\r\n" | 3193 "CONNECT www.example.org:443 HTTP/1.1\r\n" |
3195 "Host: www.example.org\r\n" | 3194 "Host: www.example.org\r\n" |
3196 "Proxy-Connection: keep-alive\r\n\r\n"), | 3195 "Proxy-Connection: keep-alive\r\n\r\n"), |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3273 session->CloseAllConnections(); | 3272 session->CloseAllConnections(); |
3274 } | 3273 } |
3275 | 3274 |
3276 // Test a simple get through an HTTPS Proxy. | 3275 // Test a simple get through an HTTPS Proxy. |
3277 TEST_P(HttpNetworkTransactionTest, HttpsProxyGet) { | 3276 TEST_P(HttpNetworkTransactionTest, HttpsProxyGet) { |
3278 HttpRequestInfo request; | 3277 HttpRequestInfo request; |
3279 request.method = "GET"; | 3278 request.method = "GET"; |
3280 request.url = GURL("http://www.example.org/"); | 3279 request.url = GURL("http://www.example.org/"); |
3281 | 3280 |
3282 // Configure against https proxy server "proxy:70". | 3281 // Configure against https proxy server "proxy:70". |
3283 session_deps_.proxy_service.reset(ProxyService::CreateFixed( | 3282 session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70"); |
3284 "https://proxy:70")); | |
3285 BoundTestNetLog log; | 3283 BoundTestNetLog log; |
3286 session_deps_.net_log = log.bound().net_log(); | 3284 session_deps_.net_log = log.bound().net_log(); |
3287 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 3285 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
3288 | 3286 |
3289 // Since we have proxy, should use full url | 3287 // Since we have proxy, should use full url |
3290 MockWrite data_writes1[] = { | 3288 MockWrite data_writes1[] = { |
3291 MockWrite( | 3289 MockWrite( |
3292 "GET http://www.example.org/ HTTP/1.1\r\n" | 3290 "GET http://www.example.org/ HTTP/1.1\r\n" |
3293 "Host: www.example.org\r\n" | 3291 "Host: www.example.org\r\n" |
3294 "Proxy-Connection: keep-alive\r\n\r\n"), | 3292 "Proxy-Connection: keep-alive\r\n\r\n"), |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3336 } | 3334 } |
3337 | 3335 |
3338 // Test a SPDY get through an HTTPS Proxy. | 3336 // Test a SPDY get through an HTTPS Proxy. |
3339 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyGet) { | 3337 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyGet) { |
3340 HttpRequestInfo request; | 3338 HttpRequestInfo request; |
3341 request.method = "GET"; | 3339 request.method = "GET"; |
3342 request.url = GURL("http://www.example.org/"); | 3340 request.url = GURL("http://www.example.org/"); |
3343 request.load_flags = 0; | 3341 request.load_flags = 0; |
3344 | 3342 |
3345 // Configure against https proxy server "proxy:70". | 3343 // Configure against https proxy server "proxy:70". |
3346 session_deps_.proxy_service.reset(ProxyService::CreateFixed( | 3344 session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70"); |
3347 "https://proxy:70")); | |
3348 BoundTestNetLog log; | 3345 BoundTestNetLog log; |
3349 session_deps_.net_log = log.bound().net_log(); | 3346 session_deps_.net_log = log.bound().net_log(); |
3350 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 3347 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
3351 | 3348 |
3352 // fetch http://www.example.org/ via SPDY | 3349 // fetch http://www.example.org/ via SPDY |
3353 scoped_ptr<SpdyFrame> req( | 3350 scoped_ptr<SpdyFrame> req( |
3354 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, false)); | 3351 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, false)); |
3355 MockWrite spdy_writes[] = {CreateMockWrite(*req, 0)}; | 3352 MockWrite spdy_writes[] = {CreateMockWrite(*req, 0)}; |
3356 | 3353 |
3357 scoped_ptr<SpdyFrame> resp(spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1)); | 3354 scoped_ptr<SpdyFrame> resp(spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1)); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3397 // Verifies that a session which races and wins against the owning transaction | 3394 // Verifies that a session which races and wins against the owning transaction |
3398 // (completing prior to host resolution), doesn't fail the transaction. | 3395 // (completing prior to host resolution), doesn't fail the transaction. |
3399 // Regression test for crbug.com/334413. | 3396 // Regression test for crbug.com/334413. |
3400 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyGetWithSessionRace) { | 3397 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyGetWithSessionRace) { |
3401 HttpRequestInfo request; | 3398 HttpRequestInfo request; |
3402 request.method = "GET"; | 3399 request.method = "GET"; |
3403 request.url = GURL("http://www.example.org/"); | 3400 request.url = GURL("http://www.example.org/"); |
3404 request.load_flags = 0; | 3401 request.load_flags = 0; |
3405 | 3402 |
3406 // Configure SPDY proxy server "proxy:70". | 3403 // Configure SPDY proxy server "proxy:70". |
3407 session_deps_.proxy_service.reset( | 3404 session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70"); |
3408 ProxyService::CreateFixed("https://proxy:70")); | |
3409 BoundTestNetLog log; | 3405 BoundTestNetLog log; |
3410 session_deps_.net_log = log.bound().net_log(); | 3406 session_deps_.net_log = log.bound().net_log(); |
3411 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 3407 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
3412 | 3408 |
3413 // Fetch http://www.example.org/ through the SPDY proxy. | 3409 // Fetch http://www.example.org/ through the SPDY proxy. |
3414 scoped_ptr<SpdyFrame> req( | 3410 scoped_ptr<SpdyFrame> req( |
3415 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, false)); | 3411 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, false)); |
3416 MockWrite spdy_writes[] = {CreateMockWrite(*req, 0)}; | 3412 MockWrite spdy_writes[] = {CreateMockWrite(*req, 0)}; |
3417 | 3413 |
3418 scoped_ptr<SpdyFrame> resp(spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1)); | 3414 scoped_ptr<SpdyFrame> resp(spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1)); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3467 } | 3463 } |
3468 | 3464 |
3469 // Test a SPDY get through an HTTPS Proxy. | 3465 // Test a SPDY get through an HTTPS Proxy. |
3470 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyGetWithProxyAuth) { | 3466 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyGetWithProxyAuth) { |
3471 HttpRequestInfo request; | 3467 HttpRequestInfo request; |
3472 request.method = "GET"; | 3468 request.method = "GET"; |
3473 request.url = GURL("http://www.example.org/"); | 3469 request.url = GURL("http://www.example.org/"); |
3474 request.load_flags = 0; | 3470 request.load_flags = 0; |
3475 | 3471 |
3476 // Configure against https proxy server "myproxy:70". | 3472 // Configure against https proxy server "myproxy:70". |
3477 session_deps_.proxy_service.reset( | 3473 session_deps_.proxy_service = ProxyService::CreateFixed("https://myproxy:70"); |
3478 ProxyService::CreateFixed("https://myproxy:70")); | |
3479 BoundTestNetLog log; | 3474 BoundTestNetLog log; |
3480 session_deps_.net_log = log.bound().net_log(); | 3475 session_deps_.net_log = log.bound().net_log(); |
3481 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 3476 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
3482 | 3477 |
3483 // The first request will be a bare GET, the second request will be a | 3478 // The first request will be a bare GET, the second request will be a |
3484 // GET with a Proxy-Authorization header. | 3479 // GET with a Proxy-Authorization header. |
3485 scoped_ptr<SpdyFrame> req_get( | 3480 scoped_ptr<SpdyFrame> req_get( |
3486 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, false)); | 3481 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, false)); |
3487 const char* const kExtraAuthorizationHeaders[] = { | 3482 const char* const kExtraAuthorizationHeaders[] = { |
3488 "proxy-authorization", "Basic Zm9vOmJhcg==" | 3483 "proxy-authorization", "Basic Zm9vOmJhcg==" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3568 } | 3563 } |
3569 | 3564 |
3570 // Test a SPDY CONNECT through an HTTPS Proxy to an HTTPS (non-SPDY) Server. | 3565 // Test a SPDY CONNECT through an HTTPS Proxy to an HTTPS (non-SPDY) Server. |
3571 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyConnectHttps) { | 3566 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyConnectHttps) { |
3572 HttpRequestInfo request; | 3567 HttpRequestInfo request; |
3573 request.method = "GET"; | 3568 request.method = "GET"; |
3574 request.url = GURL("https://www.example.org/"); | 3569 request.url = GURL("https://www.example.org/"); |
3575 request.load_flags = 0; | 3570 request.load_flags = 0; |
3576 | 3571 |
3577 // Configure against https proxy server "proxy:70". | 3572 // Configure against https proxy server "proxy:70". |
3578 session_deps_.proxy_service.reset(ProxyService::CreateFixed( | 3573 session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70"); |
3579 "https://proxy:70")); | |
3580 BoundTestNetLog log; | 3574 BoundTestNetLog log; |
3581 session_deps_.net_log = log.bound().net_log(); | 3575 session_deps_.net_log = log.bound().net_log(); |
3582 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 3576 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
3583 | 3577 |
3584 scoped_ptr<HttpTransaction> trans( | 3578 scoped_ptr<HttpTransaction> trans( |
3585 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 3579 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
3586 | 3580 |
3587 // CONNECT to www.example.org:443 via SPDY | 3581 // CONNECT to www.example.org:443 via SPDY |
3588 scoped_ptr<SpdyFrame> connect(spdy_util_.ConstructSpdyConnect( | 3582 scoped_ptr<SpdyFrame> connect(spdy_util_.ConstructSpdyConnect( |
3589 NULL, 0, 1, LOWEST, HostPortPair("www.example.org", 443))); | 3583 NULL, 0, 1, LOWEST, HostPortPair("www.example.org", 443))); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3653 } | 3647 } |
3654 | 3648 |
3655 // Test a SPDY CONNECT through an HTTPS Proxy to a SPDY server. | 3649 // Test a SPDY CONNECT through an HTTPS Proxy to a SPDY server. |
3656 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyConnectSpdy) { | 3650 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyConnectSpdy) { |
3657 HttpRequestInfo request; | 3651 HttpRequestInfo request; |
3658 request.method = "GET"; | 3652 request.method = "GET"; |
3659 request.url = GURL("https://www.example.org/"); | 3653 request.url = GURL("https://www.example.org/"); |
3660 request.load_flags = 0; | 3654 request.load_flags = 0; |
3661 | 3655 |
3662 // Configure against https proxy server "proxy:70". | 3656 // Configure against https proxy server "proxy:70". |
3663 session_deps_.proxy_service.reset(ProxyService::CreateFixed( | 3657 session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70"); |
3664 "https://proxy:70")); | |
3665 BoundTestNetLog log; | 3658 BoundTestNetLog log; |
3666 session_deps_.net_log = log.bound().net_log(); | 3659 session_deps_.net_log = log.bound().net_log(); |
3667 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 3660 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
3668 | 3661 |
3669 scoped_ptr<HttpTransaction> trans( | 3662 scoped_ptr<HttpTransaction> trans( |
3670 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 3663 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
3671 | 3664 |
3672 // CONNECT to www.example.org:443 via SPDY | 3665 // CONNECT to www.example.org:443 via SPDY |
3673 scoped_ptr<SpdyFrame> connect(spdy_util_.ConstructSpdyConnect( | 3666 scoped_ptr<SpdyFrame> connect(spdy_util_.ConstructSpdyConnect( |
3674 NULL, 0, 1, LOWEST, HostPortPair("www.example.org", 443))); | 3667 NULL, 0, 1, LOWEST, HostPortPair("www.example.org", 443))); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3745 } | 3738 } |
3746 | 3739 |
3747 // Test a SPDY CONNECT failure through an HTTPS Proxy. | 3740 // Test a SPDY CONNECT failure through an HTTPS Proxy. |
3748 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyConnectFailure) { | 3741 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyConnectFailure) { |
3749 HttpRequestInfo request; | 3742 HttpRequestInfo request; |
3750 request.method = "GET"; | 3743 request.method = "GET"; |
3751 request.url = GURL("https://www.example.org/"); | 3744 request.url = GURL("https://www.example.org/"); |
3752 request.load_flags = 0; | 3745 request.load_flags = 0; |
3753 | 3746 |
3754 // Configure against https proxy server "proxy:70". | 3747 // Configure against https proxy server "proxy:70". |
3755 session_deps_.proxy_service.reset(ProxyService::CreateFixed( | 3748 session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70"); |
3756 "https://proxy:70")); | |
3757 BoundTestNetLog log; | 3749 BoundTestNetLog log; |
3758 session_deps_.net_log = log.bound().net_log(); | 3750 session_deps_.net_log = log.bound().net_log(); |
3759 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 3751 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
3760 | 3752 |
3761 scoped_ptr<HttpTransaction> trans( | 3753 scoped_ptr<HttpTransaction> trans( |
3762 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 3754 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
3763 | 3755 |
3764 // CONNECT to www.example.org:443 via SPDY | 3756 // CONNECT to www.example.org:443 via SPDY |
3765 scoped_ptr<SpdyFrame> connect(spdy_util_.ConstructSpdyConnect( | 3757 scoped_ptr<SpdyFrame> connect(spdy_util_.ConstructSpdyConnect( |
3766 NULL, 0, 1, LOWEST, HostPortPair("www.example.org", 443))); | 3758 NULL, 0, 1, LOWEST, HostPortPair("www.example.org", 443))); |
(...skipping 30 matching lines...) Expand all Loading... |
3797 EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, rv); | 3789 EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, rv); |
3798 | 3790 |
3799 // TODO(ttuttle): Anything else to check here? | 3791 // TODO(ttuttle): Anything else to check here? |
3800 } | 3792 } |
3801 | 3793 |
3802 // Test load timing in the case of two HTTPS (non-SPDY) requests through a SPDY | 3794 // Test load timing in the case of two HTTPS (non-SPDY) requests through a SPDY |
3803 // HTTPS Proxy to different servers. | 3795 // HTTPS Proxy to different servers. |
3804 TEST_P(HttpNetworkTransactionTest, | 3796 TEST_P(HttpNetworkTransactionTest, |
3805 HttpsProxySpdyConnectHttpsLoadTimingTwoRequestsTwoServers) { | 3797 HttpsProxySpdyConnectHttpsLoadTimingTwoRequestsTwoServers) { |
3806 // Configure against https proxy server "proxy:70". | 3798 // Configure against https proxy server "proxy:70". |
3807 session_deps_.proxy_service.reset(ProxyService::CreateFixed( | 3799 session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70"); |
3808 "https://proxy:70")); | |
3809 BoundTestNetLog log; | 3800 BoundTestNetLog log; |
3810 session_deps_.net_log = log.bound().net_log(); | 3801 session_deps_.net_log = log.bound().net_log(); |
3811 scoped_refptr<HttpNetworkSession> session( | 3802 scoped_refptr<HttpNetworkSession> session( |
3812 SpdySessionDependencies::SpdyCreateSession(&session_deps_)); | 3803 SpdySessionDependencies::SpdyCreateSession(&session_deps_)); |
3813 | 3804 |
3814 HttpRequestInfo request1; | 3805 HttpRequestInfo request1; |
3815 request1.method = "GET"; | 3806 request1.method = "GET"; |
3816 request1.url = GURL("https://www.example.org/"); | 3807 request1.url = GURL("https://www.example.org/"); |
3817 request1.load_flags = 0; | 3808 request1.load_flags = 0; |
3818 | 3809 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3940 | 3931 |
3941 rv = trans2->Read(buf.get(), 256, callback.callback()); | 3932 rv = trans2->Read(buf.get(), 256, callback.callback()); |
3942 EXPECT_EQ(2, callback.GetResult(rv)); | 3933 EXPECT_EQ(2, callback.GetResult(rv)); |
3943 } | 3934 } |
3944 | 3935 |
3945 // Test load timing in the case of two HTTPS (non-SPDY) requests through a SPDY | 3936 // Test load timing in the case of two HTTPS (non-SPDY) requests through a SPDY |
3946 // HTTPS Proxy to the same server. | 3937 // HTTPS Proxy to the same server. |
3947 TEST_P(HttpNetworkTransactionTest, | 3938 TEST_P(HttpNetworkTransactionTest, |
3948 HttpsProxySpdyConnectHttpsLoadTimingTwoRequestsSameServer) { | 3939 HttpsProxySpdyConnectHttpsLoadTimingTwoRequestsSameServer) { |
3949 // Configure against https proxy server "proxy:70". | 3940 // Configure against https proxy server "proxy:70". |
3950 session_deps_.proxy_service.reset(ProxyService::CreateFixed( | 3941 session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70"); |
3951 "https://proxy:70")); | |
3952 BoundTestNetLog log; | 3942 BoundTestNetLog log; |
3953 session_deps_.net_log = log.bound().net_log(); | 3943 session_deps_.net_log = log.bound().net_log(); |
3954 scoped_refptr<HttpNetworkSession> session( | 3944 scoped_refptr<HttpNetworkSession> session( |
3955 SpdySessionDependencies::SpdyCreateSession(&session_deps_)); | 3945 SpdySessionDependencies::SpdyCreateSession(&session_deps_)); |
3956 | 3946 |
3957 HttpRequestInfo request1; | 3947 HttpRequestInfo request1; |
3958 request1.method = "GET"; | 3948 request1.method = "GET"; |
3959 request1.url = GURL("https://www.example.org/"); | 3949 request1.url = GURL("https://www.example.org/"); |
3960 request1.load_flags = 0; | 3950 request1.load_flags = 0; |
3961 | 3951 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4064 // The requests should have the same ID. | 4054 // The requests should have the same ID. |
4065 EXPECT_EQ(load_timing_info.socket_log_id, load_timing_info2.socket_log_id); | 4055 EXPECT_EQ(load_timing_info.socket_log_id, load_timing_info2.socket_log_id); |
4066 | 4056 |
4067 EXPECT_EQ(2, trans2->Read(buf.get(), 256, callback.callback())); | 4057 EXPECT_EQ(2, trans2->Read(buf.get(), 256, callback.callback())); |
4068 } | 4058 } |
4069 | 4059 |
4070 // Test load timing in the case of of two HTTP requests through a SPDY HTTPS | 4060 // Test load timing in the case of of two HTTP requests through a SPDY HTTPS |
4071 // Proxy to different servers. | 4061 // Proxy to different servers. |
4072 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyLoadTimingTwoHttpRequests) { | 4062 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyLoadTimingTwoHttpRequests) { |
4073 // Configure against https proxy server "proxy:70". | 4063 // Configure against https proxy server "proxy:70". |
4074 session_deps_.proxy_service.reset(ProxyService::CreateFixed( | 4064 session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70"); |
4075 "https://proxy:70")); | |
4076 BoundTestNetLog log; | 4065 BoundTestNetLog log; |
4077 session_deps_.net_log = log.bound().net_log(); | 4066 session_deps_.net_log = log.bound().net_log(); |
4078 scoped_refptr<HttpNetworkSession> session( | 4067 scoped_refptr<HttpNetworkSession> session( |
4079 SpdySessionDependencies::SpdyCreateSession(&session_deps_)); | 4068 SpdySessionDependencies::SpdyCreateSession(&session_deps_)); |
4080 | 4069 |
4081 HttpRequestInfo request1; | 4070 HttpRequestInfo request1; |
4082 request1.method = "GET"; | 4071 request1.method = "GET"; |
4083 request1.url = GURL("http://www.example.org/"); | 4072 request1.url = GURL("http://www.example.org/"); |
4084 request1.load_flags = 0; | 4073 request1.load_flags = 0; |
4085 | 4074 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4171 | 4160 |
4172 // Test the challenge-response-retry sequence through an HTTPS Proxy | 4161 // Test the challenge-response-retry sequence through an HTTPS Proxy |
4173 TEST_P(HttpNetworkTransactionTest, HttpsProxyAuthRetry) { | 4162 TEST_P(HttpNetworkTransactionTest, HttpsProxyAuthRetry) { |
4174 HttpRequestInfo request; | 4163 HttpRequestInfo request; |
4175 request.method = "GET"; | 4164 request.method = "GET"; |
4176 request.url = GURL("http://www.example.org/"); | 4165 request.url = GURL("http://www.example.org/"); |
4177 // when the no authentication data flag is set. | 4166 // when the no authentication data flag is set. |
4178 request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA; | 4167 request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA; |
4179 | 4168 |
4180 // Configure against https proxy server "myproxy:70". | 4169 // Configure against https proxy server "myproxy:70". |
4181 session_deps_.proxy_service.reset( | 4170 session_deps_.proxy_service = ProxyService::CreateFixed("https://myproxy:70"); |
4182 ProxyService::CreateFixed("https://myproxy:70")); | |
4183 BoundTestNetLog log; | 4171 BoundTestNetLog log; |
4184 session_deps_.net_log = log.bound().net_log(); | 4172 session_deps_.net_log = log.bound().net_log(); |
4185 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 4173 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
4186 | 4174 |
4187 // Since we have proxy, should use full url | 4175 // Since we have proxy, should use full url |
4188 MockWrite data_writes1[] = { | 4176 MockWrite data_writes1[] = { |
4189 MockWrite( | 4177 MockWrite( |
4190 "GET http://www.example.org/ HTTP/1.1\r\n" | 4178 "GET http://www.example.org/ HTTP/1.1\r\n" |
4191 "Host: www.example.org\r\n" | 4179 "Host: www.example.org\r\n" |
4192 "Proxy-Connection: keep-alive\r\n\r\n"), | 4180 "Proxy-Connection: keep-alive\r\n\r\n"), |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4271 } | 4259 } |
4272 | 4260 |
4273 void HttpNetworkTransactionTest::ConnectStatusHelperWithExpectedStatus( | 4261 void HttpNetworkTransactionTest::ConnectStatusHelperWithExpectedStatus( |
4274 const MockRead& status, int expected_status) { | 4262 const MockRead& status, int expected_status) { |
4275 HttpRequestInfo request; | 4263 HttpRequestInfo request; |
4276 request.method = "GET"; | 4264 request.method = "GET"; |
4277 request.url = GURL("https://www.example.org/"); | 4265 request.url = GURL("https://www.example.org/"); |
4278 request.load_flags = 0; | 4266 request.load_flags = 0; |
4279 | 4267 |
4280 // Configure against proxy server "myproxy:70". | 4268 // Configure against proxy server "myproxy:70". |
4281 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); | 4269 session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70"); |
4282 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 4270 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
4283 | 4271 |
4284 // Since we have proxy, should try to establish tunnel. | 4272 // Since we have proxy, should try to establish tunnel. |
4285 MockWrite data_writes[] = { | 4273 MockWrite data_writes[] = { |
4286 MockWrite( | 4274 MockWrite( |
4287 "CONNECT www.example.org:443 HTTP/1.1\r\n" | 4275 "CONNECT www.example.org:443 HTTP/1.1\r\n" |
4288 "Host: www.example.org\r\n" | 4276 "Host: www.example.org\r\n" |
4289 "Proxy-Connection: keep-alive\r\n\r\n"), | 4277 "Proxy-Connection: keep-alive\r\n\r\n"), |
4290 }; | 4278 }; |
4291 | 4279 |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4489 // Test the flow when both the proxy server AND origin server require | 4477 // Test the flow when both the proxy server AND origin server require |
4490 // authentication. Again, this uses basic auth for both since that is | 4478 // authentication. Again, this uses basic auth for both since that is |
4491 // the simplest to mock. | 4479 // the simplest to mock. |
4492 TEST_P(HttpNetworkTransactionTest, BasicAuthProxyThenServer) { | 4480 TEST_P(HttpNetworkTransactionTest, BasicAuthProxyThenServer) { |
4493 HttpRequestInfo request; | 4481 HttpRequestInfo request; |
4494 request.method = "GET"; | 4482 request.method = "GET"; |
4495 request.url = GURL("http://www.example.org/"); | 4483 request.url = GURL("http://www.example.org/"); |
4496 request.load_flags = 0; | 4484 request.load_flags = 0; |
4497 | 4485 |
4498 // Configure against proxy server "myproxy:70". | 4486 // Configure against proxy server "myproxy:70". |
4499 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); | 4487 session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70"); |
4500 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 4488 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
4501 | 4489 |
4502 scoped_ptr<HttpTransaction> trans( | 4490 scoped_ptr<HttpTransaction> trans( |
4503 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 4491 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
4504 | 4492 |
4505 MockWrite data_writes1[] = { | 4493 MockWrite data_writes1[] = { |
4506 MockWrite( | 4494 MockWrite( |
4507 "GET http://www.example.org/ HTTP/1.1\r\n" | 4495 "GET http://www.example.org/ HTTP/1.1\r\n" |
4508 "Host: www.example.org\r\n" | 4496 "Host: www.example.org\r\n" |
4509 "Proxy-Connection: keep-alive\r\n\r\n"), | 4497 "Proxy-Connection: keep-alive\r\n\r\n"), |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4992 // establish tunnel. | 4980 // establish tunnel. |
4993 // http://code.google.com/p/chromium/issues/detail?id=3772 | 4981 // http://code.google.com/p/chromium/issues/detail?id=3772 |
4994 TEST_P(HttpNetworkTransactionTest, | 4982 TEST_P(HttpNetworkTransactionTest, |
4995 DontRecycleTransportSocketForSSLTunnel) { | 4983 DontRecycleTransportSocketForSSLTunnel) { |
4996 HttpRequestInfo request; | 4984 HttpRequestInfo request; |
4997 request.method = "GET"; | 4985 request.method = "GET"; |
4998 request.url = GURL("https://www.example.org/"); | 4986 request.url = GURL("https://www.example.org/"); |
4999 request.load_flags = 0; | 4987 request.load_flags = 0; |
5000 | 4988 |
5001 // Configure against proxy server "myproxy:70". | 4989 // Configure against proxy server "myproxy:70". |
5002 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); | 4990 session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70"); |
5003 | 4991 |
5004 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 4992 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
5005 | 4993 |
5006 scoped_ptr<HttpTransaction> trans( | 4994 scoped_ptr<HttpTransaction> trans( |
5007 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 4995 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
5008 | 4996 |
5009 // Since we have proxy, should try to establish tunnel. | 4997 // Since we have proxy, should try to establish tunnel. |
5010 MockWrite data_writes1[] = { | 4998 MockWrite data_writes1[] = { |
5011 MockWrite( | 4999 MockWrite( |
5012 "CONNECT www.example.org:443 HTTP/1.1\r\n" | 5000 "CONNECT www.example.org:443 HTTP/1.1\r\n" |
(...skipping 1295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6308 | 6296 |
6309 const HttpResponseInfo* response = trans->GetResponseInfo(); | 6297 const HttpResponseInfo* response = trans->GetResponseInfo(); |
6310 | 6298 |
6311 ASSERT_TRUE(response != NULL); | 6299 ASSERT_TRUE(response != NULL); |
6312 EXPECT_EQ(100, response->headers->GetContentLength()); | 6300 EXPECT_EQ(100, response->headers->GetContentLength()); |
6313 } | 6301 } |
6314 | 6302 |
6315 // Test HTTPS connections to a site with a bad certificate, going through a | 6303 // Test HTTPS connections to a site with a bad certificate, going through a |
6316 // proxy | 6304 // proxy |
6317 TEST_P(HttpNetworkTransactionTest, HTTPSBadCertificateViaProxy) { | 6305 TEST_P(HttpNetworkTransactionTest, HTTPSBadCertificateViaProxy) { |
6318 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); | 6306 session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70"); |
6319 | 6307 |
6320 HttpRequestInfo request; | 6308 HttpRequestInfo request; |
6321 request.method = "GET"; | 6309 request.method = "GET"; |
6322 request.url = GURL("https://www.example.org/"); | 6310 request.url = GURL("https://www.example.org/"); |
6323 request.load_flags = 0; | 6311 request.load_flags = 0; |
6324 | 6312 |
6325 MockWrite proxy_writes[] = { | 6313 MockWrite proxy_writes[] = { |
6326 MockWrite( | 6314 MockWrite( |
6327 "CONNECT www.example.org:443 HTTP/1.1\r\n" | 6315 "CONNECT www.example.org:443 HTTP/1.1\r\n" |
6328 "Host: www.example.org\r\n" | 6316 "Host: www.example.org\r\n" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6390 const HttpResponseInfo* response = trans->GetResponseInfo(); | 6378 const HttpResponseInfo* response = trans->GetResponseInfo(); |
6391 | 6379 |
6392 ASSERT_TRUE(response != NULL); | 6380 ASSERT_TRUE(response != NULL); |
6393 EXPECT_EQ(100, response->headers->GetContentLength()); | 6381 EXPECT_EQ(100, response->headers->GetContentLength()); |
6394 } | 6382 } |
6395 } | 6383 } |
6396 | 6384 |
6397 | 6385 |
6398 // Test HTTPS connections to a site, going through an HTTPS proxy | 6386 // Test HTTPS connections to a site, going through an HTTPS proxy |
6399 TEST_P(HttpNetworkTransactionTest, HTTPSViaHttpsProxy) { | 6387 TEST_P(HttpNetworkTransactionTest, HTTPSViaHttpsProxy) { |
6400 session_deps_.proxy_service.reset( | 6388 session_deps_.proxy_service = |
6401 ProxyService::CreateFixedFromPacResult("HTTPS proxy:70")); | 6389 ProxyService::CreateFixedFromPacResult("HTTPS proxy:70"); |
6402 TestNetLog net_log; | 6390 TestNetLog net_log; |
6403 session_deps_.net_log = &net_log; | 6391 session_deps_.net_log = &net_log; |
6404 | 6392 |
6405 HttpRequestInfo request; | 6393 HttpRequestInfo request; |
6406 request.method = "GET"; | 6394 request.method = "GET"; |
6407 request.url = GURL("https://www.example.org/"); | 6395 request.url = GURL("https://www.example.org/"); |
6408 request.load_flags = 0; | 6396 request.load_flags = 0; |
6409 | 6397 |
6410 MockWrite data_writes[] = { | 6398 MockWrite data_writes[] = { |
6411 MockWrite( | 6399 MockWrite( |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6456 EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion()); | 6444 EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion()); |
6457 | 6445 |
6458 LoadTimingInfo load_timing_info; | 6446 LoadTimingInfo load_timing_info; |
6459 EXPECT_TRUE(trans->GetLoadTimingInfo(&load_timing_info)); | 6447 EXPECT_TRUE(trans->GetLoadTimingInfo(&load_timing_info)); |
6460 TestLoadTimingNotReusedWithPac(load_timing_info, | 6448 TestLoadTimingNotReusedWithPac(load_timing_info, |
6461 CONNECT_TIMING_HAS_SSL_TIMES); | 6449 CONNECT_TIMING_HAS_SSL_TIMES); |
6462 } | 6450 } |
6463 | 6451 |
6464 // Test an HTTPS Proxy's ability to redirect a CONNECT request | 6452 // Test an HTTPS Proxy's ability to redirect a CONNECT request |
6465 TEST_P(HttpNetworkTransactionTest, RedirectOfHttpsConnectViaHttpsProxy) { | 6453 TEST_P(HttpNetworkTransactionTest, RedirectOfHttpsConnectViaHttpsProxy) { |
6466 session_deps_.proxy_service.reset( | 6454 session_deps_.proxy_service = |
6467 ProxyService::CreateFixedFromPacResult("HTTPS proxy:70")); | 6455 ProxyService::CreateFixedFromPacResult("HTTPS proxy:70"); |
6468 TestNetLog net_log; | 6456 TestNetLog net_log; |
6469 session_deps_.net_log = &net_log; | 6457 session_deps_.net_log = &net_log; |
6470 | 6458 |
6471 HttpRequestInfo request; | 6459 HttpRequestInfo request; |
6472 request.method = "GET"; | 6460 request.method = "GET"; |
6473 request.url = GURL("https://www.example.org/"); | 6461 request.url = GURL("https://www.example.org/"); |
6474 request.load_flags = 0; | 6462 request.load_flags = 0; |
6475 | 6463 |
6476 MockWrite data_writes[] = { | 6464 MockWrite data_writes[] = { |
6477 MockWrite( | 6465 MockWrite( |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6533 load_timing_info.connect_timing, | 6521 load_timing_info.connect_timing, |
6534 CONNECT_TIMING_HAS_DNS_TIMES | CONNECT_TIMING_HAS_SSL_TIMES); | 6522 CONNECT_TIMING_HAS_DNS_TIMES | CONNECT_TIMING_HAS_SSL_TIMES); |
6535 | 6523 |
6536 EXPECT_TRUE(load_timing_info.send_start.is_null()); | 6524 EXPECT_TRUE(load_timing_info.send_start.is_null()); |
6537 EXPECT_TRUE(load_timing_info.send_end.is_null()); | 6525 EXPECT_TRUE(load_timing_info.send_end.is_null()); |
6538 EXPECT_TRUE(load_timing_info.receive_headers_end.is_null()); | 6526 EXPECT_TRUE(load_timing_info.receive_headers_end.is_null()); |
6539 } | 6527 } |
6540 | 6528 |
6541 // Test an HTTPS (SPDY) Proxy's ability to redirect a CONNECT request | 6529 // Test an HTTPS (SPDY) Proxy's ability to redirect a CONNECT request |
6542 TEST_P(HttpNetworkTransactionTest, RedirectOfHttpsConnectViaSpdyProxy) { | 6530 TEST_P(HttpNetworkTransactionTest, RedirectOfHttpsConnectViaSpdyProxy) { |
6543 session_deps_.proxy_service.reset( | 6531 session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70"); |
6544 ProxyService::CreateFixed("https://proxy:70")); | |
6545 | 6532 |
6546 HttpRequestInfo request; | 6533 HttpRequestInfo request; |
6547 request.method = "GET"; | 6534 request.method = "GET"; |
6548 request.url = GURL("https://www.example.org/"); | 6535 request.url = GURL("https://www.example.org/"); |
6549 request.load_flags = 0; | 6536 request.load_flags = 0; |
6550 | 6537 |
6551 scoped_ptr<SpdyFrame> conn(spdy_util_.ConstructSpdyConnect( | 6538 scoped_ptr<SpdyFrame> conn(spdy_util_.ConstructSpdyConnect( |
6552 NULL, 0, 1, LOWEST, HostPortPair("www.example.org", 443))); | 6539 NULL, 0, 1, LOWEST, HostPortPair("www.example.org", 443))); |
6553 scoped_ptr<SpdyFrame> goaway( | 6540 scoped_ptr<SpdyFrame> goaway( |
6554 spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); | 6541 spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6593 | 6580 |
6594 EXPECT_EQ(302, response->headers->response_code()); | 6581 EXPECT_EQ(302, response->headers->response_code()); |
6595 std::string url; | 6582 std::string url; |
6596 EXPECT_TRUE(response->headers->IsRedirect(&url)); | 6583 EXPECT_TRUE(response->headers->IsRedirect(&url)); |
6597 EXPECT_EQ("http://login.example.com/", url); | 6584 EXPECT_EQ("http://login.example.com/", url); |
6598 } | 6585 } |
6599 | 6586 |
6600 // Test that an HTTPS proxy's response to a CONNECT request is filtered. | 6587 // Test that an HTTPS proxy's response to a CONNECT request is filtered. |
6601 TEST_P(HttpNetworkTransactionTest, | 6588 TEST_P(HttpNetworkTransactionTest, |
6602 ErrorResponseToHttpsConnectViaHttpsProxy) { | 6589 ErrorResponseToHttpsConnectViaHttpsProxy) { |
6603 session_deps_.proxy_service.reset( | 6590 session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70"); |
6604 ProxyService::CreateFixed("https://proxy:70")); | |
6605 | 6591 |
6606 HttpRequestInfo request; | 6592 HttpRequestInfo request; |
6607 request.method = "GET"; | 6593 request.method = "GET"; |
6608 request.url = GURL("https://www.example.org/"); | 6594 request.url = GURL("https://www.example.org/"); |
6609 request.load_flags = 0; | 6595 request.load_flags = 0; |
6610 | 6596 |
6611 MockWrite data_writes[] = { | 6597 MockWrite data_writes[] = { |
6612 MockWrite( | 6598 MockWrite( |
6613 "CONNECT www.example.org:443 HTTP/1.1\r\n" | 6599 "CONNECT www.example.org:443 HTTP/1.1\r\n" |
6614 "Host: www.example.org\r\n" | 6600 "Host: www.example.org\r\n" |
(...skipping 25 matching lines...) Expand all Loading... |
6640 | 6626 |
6641 rv = callback.WaitForResult(); | 6627 rv = callback.WaitForResult(); |
6642 EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, rv); | 6628 EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, rv); |
6643 | 6629 |
6644 // TODO(ttuttle): Anything else to check here? | 6630 // TODO(ttuttle): Anything else to check here? |
6645 } | 6631 } |
6646 | 6632 |
6647 // Test that a SPDY proxy's response to a CONNECT request is filtered. | 6633 // Test that a SPDY proxy's response to a CONNECT request is filtered. |
6648 TEST_P(HttpNetworkTransactionTest, | 6634 TEST_P(HttpNetworkTransactionTest, |
6649 ErrorResponseToHttpsConnectViaSpdyProxy) { | 6635 ErrorResponseToHttpsConnectViaSpdyProxy) { |
6650 session_deps_.proxy_service.reset( | 6636 session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70"); |
6651 ProxyService::CreateFixed("https://proxy:70")); | |
6652 | 6637 |
6653 HttpRequestInfo request; | 6638 HttpRequestInfo request; |
6654 request.method = "GET"; | 6639 request.method = "GET"; |
6655 request.url = GURL("https://www.example.org/"); | 6640 request.url = GURL("https://www.example.org/"); |
6656 request.load_flags = 0; | 6641 request.load_flags = 0; |
6657 | 6642 |
6658 scoped_ptr<SpdyFrame> conn(spdy_util_.ConstructSpdyConnect( | 6643 scoped_ptr<SpdyFrame> conn(spdy_util_.ConstructSpdyConnect( |
6659 NULL, 0, 1, LOWEST, HostPortPair("www.example.org", 443))); | 6644 NULL, 0, 1, LOWEST, HostPortPair("www.example.org", 443))); |
6660 scoped_ptr<SpdyFrame> rst( | 6645 scoped_ptr<SpdyFrame> rst( |
6661 spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); | 6646 spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6705 // Test the request-challenge-retry sequence for basic auth, through | 6690 // Test the request-challenge-retry sequence for basic auth, through |
6706 // a SPDY proxy over a single SPDY session. | 6691 // a SPDY proxy over a single SPDY session. |
6707 TEST_P(HttpNetworkTransactionTest, BasicAuthSpdyProxy) { | 6692 TEST_P(HttpNetworkTransactionTest, BasicAuthSpdyProxy) { |
6708 HttpRequestInfo request; | 6693 HttpRequestInfo request; |
6709 request.method = "GET"; | 6694 request.method = "GET"; |
6710 request.url = GURL("https://www.example.org/"); | 6695 request.url = GURL("https://www.example.org/"); |
6711 // when the no authentication data flag is set. | 6696 // when the no authentication data flag is set. |
6712 request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA; | 6697 request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA; |
6713 | 6698 |
6714 // Configure against https proxy server "myproxy:70". | 6699 // Configure against https proxy server "myproxy:70". |
6715 session_deps_.proxy_service.reset( | 6700 session_deps_.proxy_service = |
6716 ProxyService::CreateFixedFromPacResult("HTTPS myproxy:70")); | 6701 ProxyService::CreateFixedFromPacResult("HTTPS myproxy:70"); |
6717 BoundTestNetLog log; | 6702 BoundTestNetLog log; |
6718 session_deps_.net_log = log.bound().net_log(); | 6703 session_deps_.net_log = log.bound().net_log(); |
6719 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 6704 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
6720 | 6705 |
6721 // Since we have proxy, should try to establish tunnel. | 6706 // Since we have proxy, should try to establish tunnel. |
6722 scoped_ptr<SpdyFrame> req(spdy_util_.ConstructSpdyConnect( | 6707 scoped_ptr<SpdyFrame> req(spdy_util_.ConstructSpdyConnect( |
6723 NULL, 0, 1, LOWEST, HostPortPair("www.example.org", 443))); | 6708 NULL, 0, 1, LOWEST, HostPortPair("www.example.org", 443))); |
6724 scoped_ptr<SpdyFrame> rst( | 6709 scoped_ptr<SpdyFrame> rst( |
6725 spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); | 6710 spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); |
6726 | 6711 |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6846 TEST_P(HttpNetworkTransactionTest, CrossOriginProxyPush) { | 6831 TEST_P(HttpNetworkTransactionTest, CrossOriginProxyPush) { |
6847 HttpRequestInfo request; | 6832 HttpRequestInfo request; |
6848 HttpRequestInfo push_request; | 6833 HttpRequestInfo push_request; |
6849 | 6834 |
6850 request.method = "GET"; | 6835 request.method = "GET"; |
6851 request.url = GURL("http://www.example.org/"); | 6836 request.url = GURL("http://www.example.org/"); |
6852 push_request.method = "GET"; | 6837 push_request.method = "GET"; |
6853 push_request.url = GURL("http://www.another-origin.com/foo.dat"); | 6838 push_request.url = GURL("http://www.another-origin.com/foo.dat"); |
6854 | 6839 |
6855 // Configure against https proxy server "myproxy:70". | 6840 // Configure against https proxy server "myproxy:70". |
6856 session_deps_.proxy_service.reset( | 6841 session_deps_.proxy_service = |
6857 ProxyService::CreateFixedFromPacResult("HTTPS myproxy:70")); | 6842 ProxyService::CreateFixedFromPacResult("HTTPS myproxy:70"); |
6858 BoundTestNetLog log; | 6843 BoundTestNetLog log; |
6859 session_deps_.net_log = log.bound().net_log(); | 6844 session_deps_.net_log = log.bound().net_log(); |
6860 | 6845 |
6861 // Enable cross-origin push. | 6846 // Enable cross-origin push. |
6862 session_deps_.trusted_spdy_proxy = "myproxy:70"; | 6847 session_deps_.trusted_spdy_proxy = "myproxy:70"; |
6863 | 6848 |
6864 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 6849 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
6865 | 6850 |
6866 scoped_ptr<SpdyFrame> stream1_syn( | 6851 scoped_ptr<SpdyFrame> stream1_syn( |
6867 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, false)); | 6852 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, false)); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6960 } | 6945 } |
6961 | 6946 |
6962 // Test that an explicitly trusted SPDY proxy cannot push HTTPS content. | 6947 // Test that an explicitly trusted SPDY proxy cannot push HTTPS content. |
6963 TEST_P(HttpNetworkTransactionTest, CrossOriginProxyPushCorrectness) { | 6948 TEST_P(HttpNetworkTransactionTest, CrossOriginProxyPushCorrectness) { |
6964 HttpRequestInfo request; | 6949 HttpRequestInfo request; |
6965 | 6950 |
6966 request.method = "GET"; | 6951 request.method = "GET"; |
6967 request.url = GURL("http://www.example.org/"); | 6952 request.url = GURL("http://www.example.org/"); |
6968 | 6953 |
6969 // Configure against https proxy server "myproxy:70". | 6954 // Configure against https proxy server "myproxy:70". |
6970 session_deps_.proxy_service.reset( | 6955 session_deps_.proxy_service = ProxyService::CreateFixed("https://myproxy:70"); |
6971 ProxyService::CreateFixed("https://myproxy:70")); | |
6972 BoundTestNetLog log; | 6956 BoundTestNetLog log; |
6973 session_deps_.net_log = log.bound().net_log(); | 6957 session_deps_.net_log = log.bound().net_log(); |
6974 | 6958 |
6975 // Enable cross-origin push. | 6959 // Enable cross-origin push. |
6976 session_deps_.trusted_spdy_proxy = "myproxy:70"; | 6960 session_deps_.trusted_spdy_proxy = "myproxy:70"; |
6977 | 6961 |
6978 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 6962 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
6979 | 6963 |
6980 scoped_ptr<SpdyFrame> stream1_syn( | 6964 scoped_ptr<SpdyFrame> stream1_syn( |
6981 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, false)); | 6965 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, false)); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7036 EXPECT_EQ(OK, rv); | 7020 EXPECT_EQ(OK, rv); |
7037 EXPECT_EQ("hello!", response_data); | 7021 EXPECT_EQ("hello!", response_data); |
7038 | 7022 |
7039 trans.reset(); | 7023 trans.reset(); |
7040 session->CloseAllConnections(); | 7024 session->CloseAllConnections(); |
7041 } | 7025 } |
7042 | 7026 |
7043 // Test HTTPS connections to a site with a bad certificate, going through an | 7027 // Test HTTPS connections to a site with a bad certificate, going through an |
7044 // HTTPS proxy | 7028 // HTTPS proxy |
7045 TEST_P(HttpNetworkTransactionTest, HTTPSBadCertificateViaHttpsProxy) { | 7029 TEST_P(HttpNetworkTransactionTest, HTTPSBadCertificateViaHttpsProxy) { |
7046 session_deps_.proxy_service.reset(ProxyService::CreateFixed( | 7030 session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70"); |
7047 "https://proxy:70")); | |
7048 | 7031 |
7049 HttpRequestInfo request; | 7032 HttpRequestInfo request; |
7050 request.method = "GET"; | 7033 request.method = "GET"; |
7051 request.url = GURL("https://www.example.org/"); | 7034 request.url = GURL("https://www.example.org/"); |
7052 request.load_flags = 0; | 7035 request.load_flags = 0; |
7053 | 7036 |
7054 // Attempt to fetch the URL from a server with a bad cert | 7037 // Attempt to fetch the URL from a server with a bad cert |
7055 MockWrite bad_cert_writes[] = { | 7038 MockWrite bad_cert_writes[] = { |
7056 MockWrite( | 7039 MockWrite( |
7057 "CONNECT www.example.org:443 HTTP/1.1\r\n" | 7040 "CONNECT www.example.org:443 HTTP/1.1\r\n" |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7166 EXPECT_EQ(OK, rv); | 7149 EXPECT_EQ(OK, rv); |
7167 } | 7150 } |
7168 | 7151 |
7169 TEST_P(HttpNetworkTransactionTest, BuildRequest_UserAgentOverTunnel) { | 7152 TEST_P(HttpNetworkTransactionTest, BuildRequest_UserAgentOverTunnel) { |
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.extra_headers.SetHeader(HttpRequestHeaders::kUserAgent, | 7156 request.extra_headers.SetHeader(HttpRequestHeaders::kUserAgent, |
7174 "Chromium Ultra Awesome X Edition"); | 7157 "Chromium Ultra Awesome X Edition"); |
7175 | 7158 |
7176 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); | 7159 session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70"); |
7177 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 7160 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
7178 scoped_ptr<HttpTransaction> trans( | 7161 scoped_ptr<HttpTransaction> trans( |
7179 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 7162 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
7180 | 7163 |
7181 MockWrite data_writes[] = { | 7164 MockWrite data_writes[] = { |
7182 MockWrite( | 7165 MockWrite( |
7183 "CONNECT www.example.org:443 HTTP/1.1\r\n" | 7166 "CONNECT www.example.org:443 HTTP/1.1\r\n" |
7184 "Host: www.example.org\r\n" | 7167 "Host: www.example.org\r\n" |
7185 "Proxy-Connection: keep-alive\r\n" | 7168 "Proxy-Connection: keep-alive\r\n" |
7186 "User-Agent: Chromium Ultra Awesome X Edition\r\n\r\n"), | 7169 "User-Agent: Chromium Ultra Awesome X Edition\r\n\r\n"), |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7520 rv = callback.WaitForResult(); | 7503 rv = callback.WaitForResult(); |
7521 EXPECT_EQ(OK, rv); | 7504 EXPECT_EQ(OK, rv); |
7522 } | 7505 } |
7523 | 7506 |
7524 TEST_P(HttpNetworkTransactionTest, SOCKS4_HTTP_GET) { | 7507 TEST_P(HttpNetworkTransactionTest, SOCKS4_HTTP_GET) { |
7525 HttpRequestInfo request; | 7508 HttpRequestInfo request; |
7526 request.method = "GET"; | 7509 request.method = "GET"; |
7527 request.url = GURL("http://www.example.org/"); | 7510 request.url = GURL("http://www.example.org/"); |
7528 request.load_flags = 0; | 7511 request.load_flags = 0; |
7529 | 7512 |
7530 session_deps_.proxy_service.reset( | 7513 session_deps_.proxy_service = |
7531 ProxyService::CreateFixedFromPacResult("SOCKS myproxy:1080")); | 7514 ProxyService::CreateFixedFromPacResult("SOCKS myproxy:1080"); |
7532 TestNetLog net_log; | 7515 TestNetLog net_log; |
7533 session_deps_.net_log = &net_log; | 7516 session_deps_.net_log = &net_log; |
7534 | 7517 |
7535 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 7518 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
7536 scoped_ptr<HttpTransaction> trans( | 7519 scoped_ptr<HttpTransaction> trans( |
7537 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 7520 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
7538 | 7521 |
7539 char write_buffer[] = { 0x04, 0x01, 0x00, 0x50, 127, 0, 0, 1, 0 }; | 7522 char write_buffer[] = { 0x04, 0x01, 0x00, 0x50, 127, 0, 0, 1, 0 }; |
7540 char read_buffer[] = { 0x00, 0x5A, 0x00, 0x00, 0, 0, 0, 0 }; | 7523 char read_buffer[] = { 0x00, 0x5A, 0x00, 0x00, 0, 0, 0, 0 }; |
7541 | 7524 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7579 EXPECT_EQ(OK, rv); | 7562 EXPECT_EQ(OK, rv); |
7580 EXPECT_EQ("Payload", response_text); | 7563 EXPECT_EQ("Payload", response_text); |
7581 } | 7564 } |
7582 | 7565 |
7583 TEST_P(HttpNetworkTransactionTest, SOCKS4_SSL_GET) { | 7566 TEST_P(HttpNetworkTransactionTest, SOCKS4_SSL_GET) { |
7584 HttpRequestInfo request; | 7567 HttpRequestInfo request; |
7585 request.method = "GET"; | 7568 request.method = "GET"; |
7586 request.url = GURL("https://www.example.org/"); | 7569 request.url = GURL("https://www.example.org/"); |
7587 request.load_flags = 0; | 7570 request.load_flags = 0; |
7588 | 7571 |
7589 session_deps_.proxy_service.reset( | 7572 session_deps_.proxy_service = |
7590 ProxyService::CreateFixedFromPacResult("SOCKS myproxy:1080")); | 7573 ProxyService::CreateFixedFromPacResult("SOCKS myproxy:1080"); |
7591 TestNetLog net_log; | 7574 TestNetLog net_log; |
7592 session_deps_.net_log = &net_log; | 7575 session_deps_.net_log = &net_log; |
7593 | 7576 |
7594 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 7577 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
7595 scoped_ptr<HttpTransaction> trans( | 7578 scoped_ptr<HttpTransaction> trans( |
7596 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 7579 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
7597 | 7580 |
7598 unsigned char write_buffer[] = { 0x04, 0x01, 0x01, 0xBB, 127, 0, 0, 1, 0 }; | 7581 unsigned char write_buffer[] = { 0x04, 0x01, 0x01, 0xBB, 127, 0, 0, 1, 0 }; |
7599 unsigned char read_buffer[] = { 0x00, 0x5A, 0x00, 0x00, 0, 0, 0, 0 }; | 7582 unsigned char read_buffer[] = { 0x00, 0x5A, 0x00, 0x00, 0, 0, 0, 0 }; |
7600 | 7583 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7643 EXPECT_EQ(OK, rv); | 7626 EXPECT_EQ(OK, rv); |
7644 EXPECT_EQ("Payload", response_text); | 7627 EXPECT_EQ("Payload", response_text); |
7645 } | 7628 } |
7646 | 7629 |
7647 TEST_P(HttpNetworkTransactionTest, SOCKS4_HTTP_GET_no_PAC) { | 7630 TEST_P(HttpNetworkTransactionTest, SOCKS4_HTTP_GET_no_PAC) { |
7648 HttpRequestInfo request; | 7631 HttpRequestInfo request; |
7649 request.method = "GET"; | 7632 request.method = "GET"; |
7650 request.url = GURL("http://www.example.org/"); | 7633 request.url = GURL("http://www.example.org/"); |
7651 request.load_flags = 0; | 7634 request.load_flags = 0; |
7652 | 7635 |
7653 session_deps_.proxy_service.reset( | 7636 session_deps_.proxy_service = |
7654 ProxyService::CreateFixed("socks4://myproxy:1080")); | 7637 ProxyService::CreateFixed("socks4://myproxy:1080"); |
7655 TestNetLog net_log; | 7638 TestNetLog net_log; |
7656 session_deps_.net_log = &net_log; | 7639 session_deps_.net_log = &net_log; |
7657 | 7640 |
7658 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 7641 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
7659 scoped_ptr<HttpTransaction> trans( | 7642 scoped_ptr<HttpTransaction> trans( |
7660 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 7643 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
7661 | 7644 |
7662 char write_buffer[] = { 0x04, 0x01, 0x00, 0x50, 127, 0, 0, 1, 0 }; | 7645 char write_buffer[] = { 0x04, 0x01, 0x00, 0x50, 127, 0, 0, 1, 0 }; |
7663 char read_buffer[] = { 0x00, 0x5A, 0x00, 0x00, 0, 0, 0, 0 }; | 7646 char read_buffer[] = { 0x00, 0x5A, 0x00, 0x00, 0, 0, 0, 0 }; |
7664 | 7647 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7702 EXPECT_EQ(OK, rv); | 7685 EXPECT_EQ(OK, rv); |
7703 EXPECT_EQ("Payload", response_text); | 7686 EXPECT_EQ("Payload", response_text); |
7704 } | 7687 } |
7705 | 7688 |
7706 TEST_P(HttpNetworkTransactionTest, SOCKS5_HTTP_GET) { | 7689 TEST_P(HttpNetworkTransactionTest, SOCKS5_HTTP_GET) { |
7707 HttpRequestInfo request; | 7690 HttpRequestInfo request; |
7708 request.method = "GET"; | 7691 request.method = "GET"; |
7709 request.url = GURL("http://www.example.org/"); | 7692 request.url = GURL("http://www.example.org/"); |
7710 request.load_flags = 0; | 7693 request.load_flags = 0; |
7711 | 7694 |
7712 session_deps_.proxy_service.reset( | 7695 session_deps_.proxy_service = |
7713 ProxyService::CreateFixedFromPacResult("SOCKS5 myproxy:1080")); | 7696 ProxyService::CreateFixedFromPacResult("SOCKS5 myproxy:1080"); |
7714 TestNetLog net_log; | 7697 TestNetLog net_log; |
7715 session_deps_.net_log = &net_log; | 7698 session_deps_.net_log = &net_log; |
7716 | 7699 |
7717 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 7700 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
7718 scoped_ptr<HttpTransaction> trans( | 7701 scoped_ptr<HttpTransaction> trans( |
7719 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 7702 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
7720 | 7703 |
7721 const char kSOCKS5GreetRequest[] = { 0x05, 0x01, 0x00 }; | 7704 const char kSOCKS5GreetRequest[] = { 0x05, 0x01, 0x00 }; |
7722 const char kSOCKS5GreetResponse[] = { 0x05, 0x00 }; | 7705 const char kSOCKS5GreetResponse[] = { 0x05, 0x00 }; |
7723 const char kSOCKS5OkRequest[] = { | 7706 const char kSOCKS5OkRequest[] = { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7774 EXPECT_EQ(OK, rv); | 7757 EXPECT_EQ(OK, rv); |
7775 EXPECT_EQ("Payload", response_text); | 7758 EXPECT_EQ("Payload", response_text); |
7776 } | 7759 } |
7777 | 7760 |
7778 TEST_P(HttpNetworkTransactionTest, SOCKS5_SSL_GET) { | 7761 TEST_P(HttpNetworkTransactionTest, SOCKS5_SSL_GET) { |
7779 HttpRequestInfo request; | 7762 HttpRequestInfo request; |
7780 request.method = "GET"; | 7763 request.method = "GET"; |
7781 request.url = GURL("https://www.example.org/"); | 7764 request.url = GURL("https://www.example.org/"); |
7782 request.load_flags = 0; | 7765 request.load_flags = 0; |
7783 | 7766 |
7784 session_deps_.proxy_service.reset( | 7767 session_deps_.proxy_service = |
7785 ProxyService::CreateFixedFromPacResult("SOCKS5 myproxy:1080")); | 7768 ProxyService::CreateFixedFromPacResult("SOCKS5 myproxy:1080"); |
7786 TestNetLog net_log; | 7769 TestNetLog net_log; |
7787 session_deps_.net_log = &net_log; | 7770 session_deps_.net_log = &net_log; |
7788 | 7771 |
7789 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 7772 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
7790 scoped_ptr<HttpTransaction> trans( | 7773 scoped_ptr<HttpTransaction> trans( |
7791 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 7774 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
7792 | 7775 |
7793 const char kSOCKS5GreetRequest[] = { 0x05, 0x01, 0x00 }; | 7776 const char kSOCKS5GreetRequest[] = { 0x05, 0x01, 0x00 }; |
7794 const char kSOCKS5GreetResponse[] = { 0x05, 0x00 }; | 7777 const char kSOCKS5GreetResponse[] = { 0x05, 0x00 }; |
7795 const unsigned char kSOCKS5OkRequest[] = { | 7778 const unsigned char kSOCKS5OkRequest[] = { |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7931 "", // unused | 7914 "", // unused |
7932 "http://host.with.alternate/direct", | 7915 "http://host.with.alternate/direct", |
7933 "ssl/host.with.alternate:443", | 7916 "ssl/host.with.alternate:443", |
7934 true, | 7917 true, |
7935 }, | 7918 }, |
7936 }; | 7919 }; |
7937 | 7920 |
7938 session_deps_.use_alternative_services = true; | 7921 session_deps_.use_alternative_services = true; |
7939 | 7922 |
7940 for (size_t i = 0; i < arraysize(tests); ++i) { | 7923 for (size_t i = 0; i < arraysize(tests); ++i) { |
7941 session_deps_.proxy_service.reset( | 7924 session_deps_.proxy_service = |
7942 ProxyService::CreateFixed(tests[i].proxy_server)); | 7925 ProxyService::CreateFixed(tests[i].proxy_server); |
7943 scoped_refptr<HttpNetworkSession> session( | 7926 scoped_refptr<HttpNetworkSession> session( |
7944 SetupSessionForGroupNameTests(GetParam(), &session_deps_)); | 7927 SetupSessionForGroupNameTests(GetParam(), &session_deps_)); |
7945 | 7928 |
7946 HttpNetworkSessionPeer peer(session); | 7929 HttpNetworkSessionPeer peer(session); |
7947 CaptureGroupNameTransportSocketPool* transport_conn_pool = | 7930 CaptureGroupNameTransportSocketPool* transport_conn_pool = |
7948 new CaptureGroupNameTransportSocketPool(NULL, NULL); | 7931 new CaptureGroupNameTransportSocketPool(NULL, NULL); |
7949 CaptureGroupNameSSLSocketPool* ssl_conn_pool = | 7932 CaptureGroupNameSSLSocketPool* ssl_conn_pool = |
7950 new CaptureGroupNameSSLSocketPool(NULL, NULL); | 7933 new CaptureGroupNameSSLSocketPool(NULL, NULL); |
7951 scoped_ptr<MockClientSocketPoolManager> mock_pool_manager( | 7934 scoped_ptr<MockClientSocketPoolManager> mock_pool_manager( |
7952 new MockClientSocketPoolManager); | 7935 new MockClientSocketPoolManager); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7993 "http_proxy", | 7976 "http_proxy", |
7994 "ftp://ftp.google.com/http_proxy_normal", | 7977 "ftp://ftp.google.com/http_proxy_normal", |
7995 "ftp/ftp.google.com:21", | 7978 "ftp/ftp.google.com:21", |
7996 false, | 7979 false, |
7997 }, | 7980 }, |
7998 }; | 7981 }; |
7999 | 7982 |
8000 session_deps_.use_alternative_services = true; | 7983 session_deps_.use_alternative_services = true; |
8001 | 7984 |
8002 for (size_t i = 0; i < arraysize(tests); ++i) { | 7985 for (size_t i = 0; i < arraysize(tests); ++i) { |
8003 session_deps_.proxy_service.reset( | 7986 session_deps_.proxy_service = |
8004 ProxyService::CreateFixed(tests[i].proxy_server)); | 7987 ProxyService::CreateFixed(tests[i].proxy_server); |
8005 scoped_refptr<HttpNetworkSession> session( | 7988 scoped_refptr<HttpNetworkSession> session( |
8006 SetupSessionForGroupNameTests(GetParam(), &session_deps_)); | 7989 SetupSessionForGroupNameTests(GetParam(), &session_deps_)); |
8007 | 7990 |
8008 HttpNetworkSessionPeer peer(session); | 7991 HttpNetworkSessionPeer peer(session); |
8009 | 7992 |
8010 HostPortPair proxy_host("http_proxy", 80); | 7993 HostPortPair proxy_host("http_proxy", 80); |
8011 CaptureGroupNameHttpProxySocketPool* http_proxy_pool = | 7994 CaptureGroupNameHttpProxySocketPool* http_proxy_pool = |
8012 new CaptureGroupNameHttpProxySocketPool(NULL, NULL); | 7995 new CaptureGroupNameHttpProxySocketPool(NULL, NULL); |
8013 CaptureGroupNameSSLSocketPool* ssl_conn_pool = | 7996 CaptureGroupNameSSLSocketPool* ssl_conn_pool = |
8014 new CaptureGroupNameSSLSocketPool(NULL, NULL); | 7997 new CaptureGroupNameSSLSocketPool(NULL, NULL); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8063 "socks4://socks_proxy:1080", | 8046 "socks4://socks_proxy:1080", |
8064 "http://host.with.alternate/direct", | 8047 "http://host.with.alternate/direct", |
8065 "socks4/ssl/host.with.alternate:443", | 8048 "socks4/ssl/host.with.alternate:443", |
8066 true, | 8049 true, |
8067 }, | 8050 }, |
8068 }; | 8051 }; |
8069 | 8052 |
8070 session_deps_.use_alternative_services = true; | 8053 session_deps_.use_alternative_services = true; |
8071 | 8054 |
8072 for (size_t i = 0; i < arraysize(tests); ++i) { | 8055 for (size_t i = 0; i < arraysize(tests); ++i) { |
8073 session_deps_.proxy_service.reset( | 8056 session_deps_.proxy_service = |
8074 ProxyService::CreateFixed(tests[i].proxy_server)); | 8057 ProxyService::CreateFixed(tests[i].proxy_server); |
8075 scoped_refptr<HttpNetworkSession> session( | 8058 scoped_refptr<HttpNetworkSession> session( |
8076 SetupSessionForGroupNameTests(GetParam(), &session_deps_)); | 8059 SetupSessionForGroupNameTests(GetParam(), &session_deps_)); |
8077 | 8060 |
8078 HttpNetworkSessionPeer peer(session); | 8061 HttpNetworkSessionPeer peer(session); |
8079 | 8062 |
8080 HostPortPair proxy_host("socks_proxy", 1080); | 8063 HostPortPair proxy_host("socks_proxy", 1080); |
8081 CaptureGroupNameSOCKSSocketPool* socks_conn_pool = | 8064 CaptureGroupNameSOCKSSocketPool* socks_conn_pool = |
8082 new CaptureGroupNameSOCKSSocketPool(NULL, NULL); | 8065 new CaptureGroupNameSOCKSSocketPool(NULL, NULL); |
8083 CaptureGroupNameSSLSocketPool* ssl_conn_pool = | 8066 CaptureGroupNameSSLSocketPool* ssl_conn_pool = |
8084 new CaptureGroupNameSSLSocketPool(NULL, NULL); | 8067 new CaptureGroupNameSSLSocketPool(NULL, NULL); |
(...skipping 16 matching lines...) Expand all Loading... |
8101 EXPECT_EQ(tests[i].expected_group_name, | 8084 EXPECT_EQ(tests[i].expected_group_name, |
8102 socks_conn_pool->last_group_name_received()); | 8085 socks_conn_pool->last_group_name_received()); |
8103 } | 8086 } |
8104 } | 8087 } |
8105 | 8088 |
8106 TEST_P(HttpNetworkTransactionTest, ReconsiderProxyAfterFailedConnection) { | 8089 TEST_P(HttpNetworkTransactionTest, ReconsiderProxyAfterFailedConnection) { |
8107 HttpRequestInfo request; | 8090 HttpRequestInfo request; |
8108 request.method = "GET"; | 8091 request.method = "GET"; |
8109 request.url = GURL("http://www.example.org/"); | 8092 request.url = GURL("http://www.example.org/"); |
8110 | 8093 |
8111 session_deps_.proxy_service.reset( | 8094 session_deps_.proxy_service = |
8112 ProxyService::CreateFixed("myproxy:70;foobar:80")); | 8095 ProxyService::CreateFixed("myproxy:70;foobar:80"); |
8113 | 8096 |
8114 // This simulates failure resolving all hostnames; that means we will fail | 8097 // This simulates failure resolving all hostnames; that means we will fail |
8115 // connecting to both proxies (myproxy:70 and foobar:80). | 8098 // connecting to both proxies (myproxy:70 and foobar:80). |
8116 session_deps_.host_resolver->rules()->AddSimulatedFailure("*"); | 8099 session_deps_.host_resolver->rules()->AddSimulatedFailure("*"); |
8117 | 8100 |
8118 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 8101 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
8119 scoped_ptr<HttpTransaction> trans( | 8102 scoped_ptr<HttpTransaction> trans( |
8120 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 8103 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
8121 | 8104 |
8122 TestCompletionCallback callback; | 8105 TestCompletionCallback callback; |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8339 EXPECT_EQ(OK, rv); | 8322 EXPECT_EQ(OK, rv); |
8340 | 8323 |
8341 response = trans->GetResponseInfo(); | 8324 response = trans->GetResponseInfo(); |
8342 ASSERT_TRUE(response != NULL); | 8325 ASSERT_TRUE(response != NULL); |
8343 EXPECT_TRUE(response->auth_challenge.get() == NULL); | 8326 EXPECT_TRUE(response->auth_challenge.get() == NULL); |
8344 EXPECT_EQ(100, response->headers->GetContentLength()); | 8327 EXPECT_EQ(100, response->headers->GetContentLength()); |
8345 } | 8328 } |
8346 | 8329 |
8347 // Test HTTPS connections going through a proxy that sends extra data. | 8330 // Test HTTPS connections going through a proxy that sends extra data. |
8348 TEST_P(HttpNetworkTransactionTest, HTTPSViaProxyWithExtraData) { | 8331 TEST_P(HttpNetworkTransactionTest, HTTPSViaProxyWithExtraData) { |
8349 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); | 8332 session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70"); |
8350 | 8333 |
8351 HttpRequestInfo request; | 8334 HttpRequestInfo request; |
8352 request.method = "GET"; | 8335 request.method = "GET"; |
8353 request.url = GURL("https://www.example.org/"); | 8336 request.url = GURL("https://www.example.org/"); |
8354 request.load_flags = 0; | 8337 request.load_flags = 0; |
8355 | 8338 |
8356 MockRead proxy_reads[] = { | 8339 MockRead proxy_reads[] = { |
8357 MockRead("HTTP/1.0 200 Connected\r\n\r\nExtra data"), | 8340 MockRead("HTTP/1.0 200 Connected\r\n\r\nExtra data"), |
8358 MockRead(SYNCHRONOUS, OK) | 8341 MockRead(SYNCHRONOUS, OK) |
8359 }; | 8342 }; |
(...skipping 1921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10281 HttpAuthChallengeTokenizer tokenizer(auth_challenge.begin(), | 10264 HttpAuthChallengeTokenizer tokenizer(auth_challenge.begin(), |
10282 auth_challenge.end()); | 10265 auth_challenge.end()); |
10283 auth_handler->InitFromChallenge(&tokenizer, HttpAuth::AUTH_SERVER, | 10266 auth_handler->InitFromChallenge(&tokenizer, HttpAuth::AUTH_SERVER, |
10284 origin, BoundNetLog()); | 10267 origin, BoundNetLog()); |
10285 auth_handler->SetGenerateExpectation( | 10268 auth_handler->SetGenerateExpectation( |
10286 test_config.server_auth_timing == AUTH_ASYNC, | 10269 test_config.server_auth_timing == AUTH_ASYNC, |
10287 test_config.server_auth_rv); | 10270 test_config.server_auth_rv); |
10288 auth_factory->AddMockHandler(auth_handler, HttpAuth::AUTH_SERVER); | 10271 auth_factory->AddMockHandler(auth_handler, HttpAuth::AUTH_SERVER); |
10289 } | 10272 } |
10290 if (test_config.proxy_url) { | 10273 if (test_config.proxy_url) { |
10291 session_deps_.proxy_service.reset( | 10274 session_deps_.proxy_service = |
10292 ProxyService::CreateFixed(test_config.proxy_url)); | 10275 ProxyService::CreateFixed(test_config.proxy_url); |
10293 } else { | 10276 } else { |
10294 session_deps_.proxy_service.reset(ProxyService::CreateDirect()); | 10277 session_deps_.proxy_service = ProxyService::CreateDirect(); |
10295 } | 10278 } |
10296 | 10279 |
10297 HttpRequestInfo request; | 10280 HttpRequestInfo request; |
10298 request.method = "GET"; | 10281 request.method = "GET"; |
10299 request.url = GURL(test_config.server_url); | 10282 request.url = GURL(test_config.server_url); |
10300 request.load_flags = 0; | 10283 request.load_flags = 0; |
10301 | 10284 |
10302 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 10285 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
10303 HttpNetworkTransaction trans(DEFAULT_PRIORITY, session.get()); | 10286 HttpNetworkTransaction trans(DEFAULT_PRIORITY, session.get()); |
10304 | 10287 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10371 } | 10354 } |
10372 } | 10355 } |
10373 } | 10356 } |
10374 } | 10357 } |
10375 | 10358 |
10376 TEST_P(HttpNetworkTransactionTest, MultiRoundAuth) { | 10359 TEST_P(HttpNetworkTransactionTest, MultiRoundAuth) { |
10377 // Do multi-round authentication and make sure it works correctly. | 10360 // Do multi-round authentication and make sure it works correctly. |
10378 HttpAuthHandlerMock::Factory* auth_factory( | 10361 HttpAuthHandlerMock::Factory* auth_factory( |
10379 new HttpAuthHandlerMock::Factory()); | 10362 new HttpAuthHandlerMock::Factory()); |
10380 session_deps_.http_auth_handler_factory.reset(auth_factory); | 10363 session_deps_.http_auth_handler_factory.reset(auth_factory); |
10381 session_deps_.proxy_service.reset(ProxyService::CreateDirect()); | 10364 session_deps_.proxy_service = ProxyService::CreateDirect(); |
10382 session_deps_.host_resolver->rules()->AddRule("www.example.com", "10.0.0.1"); | 10365 session_deps_.host_resolver->rules()->AddRule("www.example.com", "10.0.0.1"); |
10383 session_deps_.host_resolver->set_synchronous_mode(true); | 10366 session_deps_.host_resolver->set_synchronous_mode(true); |
10384 | 10367 |
10385 HttpAuthHandlerMock* auth_handler(new HttpAuthHandlerMock()); | 10368 HttpAuthHandlerMock* auth_handler(new HttpAuthHandlerMock()); |
10386 auth_handler->set_connection_based(true); | 10369 auth_handler->set_connection_based(true); |
10387 std::string auth_challenge = "Mock realm=server"; | 10370 std::string auth_challenge = "Mock realm=server"; |
10388 GURL origin("http://www.example.com"); | 10371 GURL origin("http://www.example.com"); |
10389 HttpAuthChallengeTokenizer tokenizer(auth_challenge.begin(), | 10372 HttpAuthChallengeTokenizer tokenizer(auth_challenge.begin(), |
10390 auth_challenge.end()); | 10373 auth_challenge.end()); |
10391 auth_handler->InitFromChallenge(&tokenizer, HttpAuth::AUTH_SERVER, | 10374 auth_handler->InitFromChallenge(&tokenizer, HttpAuth::AUTH_SERVER, |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10682 private: | 10665 private: |
10683 GURL* url_; | 10666 GURL* url_; |
10684 }; | 10667 }; |
10685 | 10668 |
10686 // This test ensures that the URL passed into the proxy is upgraded to https | 10669 // This test ensures that the URL passed into the proxy is upgraded to https |
10687 // when doing an Alternate Protocol upgrade. | 10670 // when doing an Alternate Protocol upgrade. |
10688 TEST_P(HttpNetworkTransactionTest, SpdyAlternateProtocolThroughProxy) { | 10671 TEST_P(HttpNetworkTransactionTest, SpdyAlternateProtocolThroughProxy) { |
10689 session_deps_.use_alternative_services = true; | 10672 session_deps_.use_alternative_services = true; |
10690 session_deps_.next_protos = SpdyNextProtos(); | 10673 session_deps_.next_protos = SpdyNextProtos(); |
10691 | 10674 |
10692 session_deps_.proxy_service.reset( | 10675 session_deps_.proxy_service = |
10693 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); | 10676 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"); |
10694 TestNetLog net_log; | 10677 TestNetLog net_log; |
10695 session_deps_.net_log = &net_log; | 10678 session_deps_.net_log = &net_log; |
10696 GURL request_url; | 10679 GURL request_url; |
10697 { | 10680 { |
10698 HttpAuthHandlerMock::Factory* auth_factory = | 10681 HttpAuthHandlerMock::Factory* auth_factory = |
10699 new HttpAuthHandlerMock::Factory(); | 10682 new HttpAuthHandlerMock::Factory(); |
10700 UrlRecordingHttpAuthHandlerMock* auth_handler = | 10683 UrlRecordingHttpAuthHandlerMock* auth_handler = |
10701 new UrlRecordingHttpAuthHandlerMock(&request_url); | 10684 new UrlRecordingHttpAuthHandlerMock(&request_url); |
10702 auth_factory->AddMockHandler(auth_handler, HttpAuth::AUTH_PROXY); | 10685 auth_factory->AddMockHandler(auth_handler, HttpAuth::AUTH_PROXY); |
10703 auth_factory->set_do_init_from_challenge(true); | 10686 auth_factory->set_do_init_from_challenge(true); |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10931 | 10914 |
10932 // Let the HttpResponseBodyDrainer drain the socket. | 10915 // Let the HttpResponseBodyDrainer drain the socket. |
10933 base::MessageLoop::current()->RunUntilIdle(); | 10916 base::MessageLoop::current()->RunUntilIdle(); |
10934 | 10917 |
10935 // Socket should now be idle, waiting to be reused. | 10918 // Socket should now be idle, waiting to be reused. |
10936 EXPECT_EQ(1, GetIdleSocketCountInTransportSocketPool(session.get())); | 10919 EXPECT_EQ(1, GetIdleSocketCountInTransportSocketPool(session.get())); |
10937 } | 10920 } |
10938 | 10921 |
10939 // Test a basic GET request through a proxy. | 10922 // Test a basic GET request through a proxy. |
10940 TEST_P(HttpNetworkTransactionTest, ProxyGet) { | 10923 TEST_P(HttpNetworkTransactionTest, ProxyGet) { |
10941 session_deps_.proxy_service.reset( | 10924 session_deps_.proxy_service = |
10942 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); | 10925 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"); |
10943 BoundTestNetLog log; | 10926 BoundTestNetLog log; |
10944 session_deps_.net_log = log.bound().net_log(); | 10927 session_deps_.net_log = log.bound().net_log(); |
10945 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 10928 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
10946 | 10929 |
10947 HttpRequestInfo request; | 10930 HttpRequestInfo request; |
10948 request.method = "GET"; | 10931 request.method = "GET"; |
10949 request.url = GURL("http://www.example.org/"); | 10932 request.url = GURL("http://www.example.org/"); |
10950 | 10933 |
10951 MockWrite data_writes1[] = { | 10934 MockWrite data_writes1[] = { |
10952 MockWrite( | 10935 MockWrite( |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10995 EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion()); | 10978 EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion()); |
10996 | 10979 |
10997 LoadTimingInfo load_timing_info; | 10980 LoadTimingInfo load_timing_info; |
10998 EXPECT_TRUE(trans->GetLoadTimingInfo(&load_timing_info)); | 10981 EXPECT_TRUE(trans->GetLoadTimingInfo(&load_timing_info)); |
10999 TestLoadTimingNotReusedWithPac(load_timing_info, | 10982 TestLoadTimingNotReusedWithPac(load_timing_info, |
11000 CONNECT_TIMING_HAS_CONNECT_TIMES_ONLY); | 10983 CONNECT_TIMING_HAS_CONNECT_TIMES_ONLY); |
11001 } | 10984 } |
11002 | 10985 |
11003 // Test a basic HTTPS GET request through a proxy. | 10986 // Test a basic HTTPS GET request through a proxy. |
11004 TEST_P(HttpNetworkTransactionTest, ProxyTunnelGet) { | 10987 TEST_P(HttpNetworkTransactionTest, ProxyTunnelGet) { |
11005 session_deps_.proxy_service.reset( | 10988 session_deps_.proxy_service = |
11006 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); | 10989 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"); |
11007 BoundTestNetLog log; | 10990 BoundTestNetLog log; |
11008 session_deps_.net_log = log.bound().net_log(); | 10991 session_deps_.net_log = log.bound().net_log(); |
11009 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 10992 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
11010 | 10993 |
11011 HttpRequestInfo request; | 10994 HttpRequestInfo request; |
11012 request.method = "GET"; | 10995 request.method = "GET"; |
11013 request.url = GURL("https://www.example.org/"); | 10996 request.url = GURL("https://www.example.org/"); |
11014 | 10997 |
11015 // Since we have proxy, should try to establish tunnel. | 10998 // Since we have proxy, should try to establish tunnel. |
11016 MockWrite data_writes1[] = { | 10999 MockWrite data_writes1[] = { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11073 | 11056 |
11074 LoadTimingInfo load_timing_info; | 11057 LoadTimingInfo load_timing_info; |
11075 EXPECT_TRUE(trans->GetLoadTimingInfo(&load_timing_info)); | 11058 EXPECT_TRUE(trans->GetLoadTimingInfo(&load_timing_info)); |
11076 TestLoadTimingNotReusedWithPac(load_timing_info, | 11059 TestLoadTimingNotReusedWithPac(load_timing_info, |
11077 CONNECT_TIMING_HAS_SSL_TIMES); | 11060 CONNECT_TIMING_HAS_SSL_TIMES); |
11078 } | 11061 } |
11079 | 11062 |
11080 // Test a basic HTTPS GET request through a proxy, but the server hangs up | 11063 // Test a basic HTTPS GET request through a proxy, but the server hangs up |
11081 // while establishing the tunnel. | 11064 // while establishing the tunnel. |
11082 TEST_P(HttpNetworkTransactionTest, ProxyTunnelGetHangup) { | 11065 TEST_P(HttpNetworkTransactionTest, ProxyTunnelGetHangup) { |
11083 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); | 11066 session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70"); |
11084 BoundTestNetLog log; | 11067 BoundTestNetLog log; |
11085 session_deps_.net_log = log.bound().net_log(); | 11068 session_deps_.net_log = log.bound().net_log(); |
11086 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 11069 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
11087 | 11070 |
11088 HttpRequestInfo request; | 11071 HttpRequestInfo request; |
11089 request.method = "GET"; | 11072 request.method = "GET"; |
11090 request.url = GURL("https://www.example.org/"); | 11073 request.url = GURL("https://www.example.org/"); |
11091 | 11074 |
11092 // Since we have proxy, should try to establish tunnel. | 11075 // Since we have proxy, should try to establish tunnel. |
11093 MockWrite data_writes1[] = { | 11076 MockWrite data_writes1[] = { |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11444 | 11427 |
11445 // Ensure that a client certificate is removed from the SSL client auth | 11428 // Ensure that a client certificate is removed from the SSL client auth |
11446 // cache when: | 11429 // cache when: |
11447 // 1) An HTTPS proxy is involved. | 11430 // 1) An HTTPS proxy is involved. |
11448 // 3) The HTTPS proxy requests a client certificate. | 11431 // 3) The HTTPS proxy requests a client certificate. |
11449 // 4) The client supplies an invalid/unacceptable certificate for the | 11432 // 4) The client supplies an invalid/unacceptable certificate for the |
11450 // proxy. | 11433 // proxy. |
11451 // The test is repeated twice, first for connecting to an HTTPS endpoint, | 11434 // The test is repeated twice, first for connecting to an HTTPS endpoint, |
11452 // then for connecting to an HTTP endpoint. | 11435 // then for connecting to an HTTP endpoint. |
11453 TEST_P(HttpNetworkTransactionTest, ClientAuthCertCache_Proxy_Fail) { | 11436 TEST_P(HttpNetworkTransactionTest, ClientAuthCertCache_Proxy_Fail) { |
11454 session_deps_.proxy_service.reset( | 11437 session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70"); |
11455 ProxyService::CreateFixed("https://proxy:70")); | |
11456 BoundTestNetLog log; | 11438 BoundTestNetLog log; |
11457 session_deps_.net_log = log.bound().net_log(); | 11439 session_deps_.net_log = log.bound().net_log(); |
11458 | 11440 |
11459 scoped_refptr<SSLCertRequestInfo> cert_request(new SSLCertRequestInfo()); | 11441 scoped_refptr<SSLCertRequestInfo> cert_request(new SSLCertRequestInfo()); |
11460 cert_request->host_and_port = HostPortPair("proxy", 70); | 11442 cert_request->host_and_port = HostPortPair("proxy", 70); |
11461 | 11443 |
11462 // See ClientAuthCertCache_Direct_NoFalseStart for the explanation of | 11444 // See ClientAuthCertCache_Direct_NoFalseStart for the explanation of |
11463 // [ssl_]data[1-3]. Rather than represending the endpoint | 11445 // [ssl_]data[1-3]. Rather than represending the endpoint |
11464 // (www.example.com:443), they represent failures with the HTTPS proxy | 11446 // (www.example.com:443), they represent failures with the HTTPS proxy |
11465 // (proxy:70). | 11447 // (proxy:70). |
(...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12431 CreateMockRead(*resp2, 6), | 12413 CreateMockRead(*resp2, 6), |
12432 CreateMockRead(*body2, 7), | 12414 CreateMockRead(*body2, 7), |
12433 MockRead(ASYNC, ERR_IO_PENDING, 8) | 12415 MockRead(ASYNC, ERR_IO_PENDING, 8) |
12434 }; | 12416 }; |
12435 | 12417 |
12436 DeterministicSocketData data1(reads1, arraysize(reads1), | 12418 DeterministicSocketData data1(reads1, arraysize(reads1), |
12437 writes1, arraysize(writes1)); | 12419 writes1, arraysize(writes1)); |
12438 MockConnect connect_data1(ASYNC, OK); | 12420 MockConnect connect_data1(ASYNC, OK); |
12439 data1.set_connect_data(connect_data1); | 12421 data1.set_connect_data(connect_data1); |
12440 | 12422 |
12441 session_deps_.proxy_service.reset( | 12423 session_deps_.proxy_service = |
12442 ProxyService::CreateFixedFromPacResult("HTTPS proxy:70")); | 12424 ProxyService::CreateFixedFromPacResult("HTTPS proxy:70"); |
12443 TestNetLog log; | 12425 TestNetLog log; |
12444 session_deps_.net_log = &log; | 12426 session_deps_.net_log = &log; |
12445 SSLSocketDataProvider ssl1(ASYNC, OK); // to the proxy | 12427 SSLSocketDataProvider ssl1(ASYNC, OK); // to the proxy |
12446 ssl1.SetNextProto(GetParam()); | 12428 ssl1.SetNextProto(GetParam()); |
12447 session_deps_.deterministic_socket_factory->AddSSLSocketDataProvider(&ssl1); | 12429 session_deps_.deterministic_socket_factory->AddSSLSocketDataProvider(&ssl1); |
12448 SSLSocketDataProvider ssl2(ASYNC, OK); // to the server | 12430 SSLSocketDataProvider ssl2(ASYNC, OK); // to the server |
12449 ssl2.SetNextProto(GetParam()); | 12431 ssl2.SetNextProto(GetParam()); |
12450 session_deps_.deterministic_socket_factory->AddSSLSocketDataProvider(&ssl2); | 12432 session_deps_.deterministic_socket_factory->AddSSLSocketDataProvider(&ssl2); |
12451 session_deps_.deterministic_socket_factory->AddSocketDataProvider(&data1); | 12433 session_deps_.deterministic_socket_factory->AddSocketDataProvider(&data1); |
12452 | 12434 |
(...skipping 1757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14210 | 14192 |
14211 // Verify that proxy headers are not sent to the destination server when | 14193 // Verify that proxy headers are not sent to the destination server when |
14212 // establishing a tunnel for a secure WebSocket connection. | 14194 // establishing a tunnel for a secure WebSocket connection. |
14213 TEST_P(HttpNetworkTransactionTest, ProxyHeadersNotSentOverWssTunnel) { | 14195 TEST_P(HttpNetworkTransactionTest, ProxyHeadersNotSentOverWssTunnel) { |
14214 HttpRequestInfo request; | 14196 HttpRequestInfo request; |
14215 request.method = "GET"; | 14197 request.method = "GET"; |
14216 request.url = GURL("wss://www.example.org/"); | 14198 request.url = GURL("wss://www.example.org/"); |
14217 AddWebSocketHeaders(&request.extra_headers); | 14199 AddWebSocketHeaders(&request.extra_headers); |
14218 | 14200 |
14219 // Configure against proxy server "myproxy:70". | 14201 // Configure against proxy server "myproxy:70". |
14220 session_deps_.proxy_service.reset( | 14202 session_deps_.proxy_service = |
14221 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); | 14203 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"); |
14222 | 14204 |
14223 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 14205 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
14224 | 14206 |
14225 // Since a proxy is configured, try to establish a tunnel. | 14207 // Since a proxy is configured, try to establish a tunnel. |
14226 MockWrite data_writes[] = { | 14208 MockWrite data_writes[] = { |
14227 MockWrite( | 14209 MockWrite( |
14228 "CONNECT www.example.org:443 HTTP/1.1\r\n" | 14210 "CONNECT www.example.org:443 HTTP/1.1\r\n" |
14229 "Host: www.example.org\r\n" | 14211 "Host: www.example.org\r\n" |
14230 "Proxy-Connection: keep-alive\r\n\r\n"), | 14212 "Proxy-Connection: keep-alive\r\n\r\n"), |
14231 | 14213 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14316 // This requires the authentication info to be injected into the auth cache | 14298 // This requires the authentication info to be injected into the auth cache |
14317 // due to crbug.com/395064 | 14299 // due to crbug.com/395064 |
14318 // TODO(ricea): Change to use a 407 response once issue 395064 is fixed. | 14300 // TODO(ricea): Change to use a 407 response once issue 395064 is fixed. |
14319 TEST_P(HttpNetworkTransactionTest, ProxyHeadersNotSentOverWsTunnel) { | 14301 TEST_P(HttpNetworkTransactionTest, ProxyHeadersNotSentOverWsTunnel) { |
14320 HttpRequestInfo request; | 14302 HttpRequestInfo request; |
14321 request.method = "GET"; | 14303 request.method = "GET"; |
14322 request.url = GURL("ws://www.example.org/"); | 14304 request.url = GURL("ws://www.example.org/"); |
14323 AddWebSocketHeaders(&request.extra_headers); | 14305 AddWebSocketHeaders(&request.extra_headers); |
14324 | 14306 |
14325 // Configure against proxy server "myproxy:70". | 14307 // Configure against proxy server "myproxy:70". |
14326 session_deps_.proxy_service.reset( | 14308 session_deps_.proxy_service = |
14327 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); | 14309 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"); |
14328 | 14310 |
14329 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 14311 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
14330 | 14312 |
14331 MockWrite data_writes[] = { | 14313 MockWrite data_writes[] = { |
14332 // Try to establish a tunnel for the WebSocket connection, with | 14314 // Try to establish a tunnel for the WebSocket connection, with |
14333 // credentials. Because WebSockets have a separate set of socket pools, | 14315 // credentials. Because WebSockets have a separate set of socket pools, |
14334 // they cannot and will not use the same TCP/IP connection as the | 14316 // they cannot and will not use the same TCP/IP connection as the |
14335 // preflight HTTP request. | 14317 // preflight HTTP request. |
14336 MockWrite( | 14318 MockWrite( |
14337 "CONNECT www.example.org:80 HTTP/1.1\r\n" | 14319 "CONNECT www.example.org:80 HTTP/1.1\r\n" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14386 ASSERT_TRUE(response); | 14368 ASSERT_TRUE(response); |
14387 ASSERT_TRUE(response->headers.get()); | 14369 ASSERT_TRUE(response->headers.get()); |
14388 | 14370 |
14389 EXPECT_EQ(101, response->headers->response_code()); | 14371 EXPECT_EQ(101, response->headers->response_code()); |
14390 | 14372 |
14391 trans.reset(); | 14373 trans.reset(); |
14392 session->CloseAllConnections(); | 14374 session->CloseAllConnections(); |
14393 } | 14375 } |
14394 | 14376 |
14395 } // namespace net | 14377 } // namespace net |
OLD | NEW |