| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/http/http_network_transaction.h" | 5 #include "net/http/http_network_transaction.h" |
| 6 | 6 |
| 7 #include <math.h> // ceil | 7 #include <math.h> // ceil |
| 8 #include <stdarg.h> | 8 #include <stdarg.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 4999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5010 SpdyHeaderBlock connect2_block; | 5010 SpdyHeaderBlock connect2_block; |
| 5011 spdy_util_.MaybeAddVersionHeader(&connect2_block); | 5011 spdy_util_.MaybeAddVersionHeader(&connect2_block); |
| 5012 connect2_block[spdy_util_.GetMethodKey()] = "CONNECT"; | 5012 connect2_block[spdy_util_.GetMethodKey()] = "CONNECT"; |
| 5013 if (GetProtocol() == kProtoHTTP2) { | 5013 if (GetProtocol() == kProtoHTTP2) { |
| 5014 connect2_block[spdy_util_.GetHostKey()] = "mail.example.org:443"; | 5014 connect2_block[spdy_util_.GetHostKey()] = "mail.example.org:443"; |
| 5015 } else { | 5015 } else { |
| 5016 connect2_block[spdy_util_.GetHostKey()] = "mail.example.org"; | 5016 connect2_block[spdy_util_.GetHostKey()] = "mail.example.org"; |
| 5017 connect2_block[spdy_util_.GetPathKey()] = "mail.example.org:443"; | 5017 connect2_block[spdy_util_.GetPathKey()] = "mail.example.org:443"; |
| 5018 } | 5018 } |
| 5019 std::unique_ptr<SpdySerializedFrame> connect2( | 5019 std::unique_ptr<SpdySerializedFrame> connect2( |
| 5020 spdy_util_.ConstructSpdySyn(3, connect2_block, LOWEST, false)); | 5020 spdy_util_.ConstructSpdySyn(3, std::move(connect2_block), LOWEST, false)); |
| 5021 | 5021 |
| 5022 std::unique_ptr<SpdySerializedFrame> conn_resp2( | 5022 std::unique_ptr<SpdySerializedFrame> conn_resp2( |
| 5023 spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 3)); | 5023 spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 3)); |
| 5024 | 5024 |
| 5025 // Fetch https://mail.example.org/ via HTTP. | 5025 // Fetch https://mail.example.org/ via HTTP. |
| 5026 const char get2[] = | 5026 const char get2[] = |
| 5027 "GET / HTTP/1.1\r\n" | 5027 "GET / HTTP/1.1\r\n" |
| 5028 "Host: mail.example.org\r\n" | 5028 "Host: mail.example.org\r\n" |
| 5029 "Connection: keep-alive\r\n\r\n"; | 5029 "Connection: keep-alive\r\n\r\n"; |
| 5030 std::unique_ptr<SpdySerializedFrame> wrapped_get2( | 5030 std::unique_ptr<SpdySerializedFrame> wrapped_get2( |
| (...skipping 8659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13690 spdy_util_.ConstructWrappedSpdyFrame(req1, 1)); | 13690 spdy_util_.ConstructWrappedSpdyFrame(req1, 1)); |
| 13691 | 13691 |
| 13692 // SPDY GET for HTTP URL (through the proxy, but not the tunnel). | 13692 // SPDY GET for HTTP URL (through the proxy, but not the tunnel). |
| 13693 SpdyHeaderBlock req2_block; | 13693 SpdyHeaderBlock req2_block; |
| 13694 spdy_util_.MaybeAddVersionHeader(&req2_block); | 13694 spdy_util_.MaybeAddVersionHeader(&req2_block); |
| 13695 req2_block[spdy_util_.GetMethodKey()] = "GET"; | 13695 req2_block[spdy_util_.GetMethodKey()] = "GET"; |
| 13696 req2_block[spdy_util_.GetHostKey()] = "www.example.org:8080"; | 13696 req2_block[spdy_util_.GetHostKey()] = "www.example.org:8080"; |
| 13697 req2_block[spdy_util_.GetSchemeKey()] = "http"; | 13697 req2_block[spdy_util_.GetSchemeKey()] = "http"; |
| 13698 req2_block[spdy_util_.GetPathKey()] = "/"; | 13698 req2_block[spdy_util_.GetPathKey()] = "/"; |
| 13699 std::unique_ptr<SpdySerializedFrame> req2( | 13699 std::unique_ptr<SpdySerializedFrame> req2( |
| 13700 spdy_util_.ConstructSpdySyn(3, req2_block, MEDIUM, true)); | 13700 spdy_util_.ConstructSpdySyn(3, std::move(req2_block), MEDIUM, true)); |
| 13701 | 13701 |
| 13702 MockWrite writes1[] = { | 13702 MockWrite writes1[] = { |
| 13703 CreateMockWrite(*connect, 0), CreateMockWrite(*wrapped_req1, 2), | 13703 CreateMockWrite(*connect, 0), CreateMockWrite(*wrapped_req1, 2), |
| 13704 CreateMockWrite(*req2, 6), | 13704 CreateMockWrite(*req2, 6), |
| 13705 }; | 13705 }; |
| 13706 | 13706 |
| 13707 std::unique_ptr<SpdySerializedFrame> conn_resp( | 13707 std::unique_ptr<SpdySerializedFrame> conn_resp( |
| 13708 spdy_util_.ConstructSpdyGetSynReply(nullptr, 0, 1)); | 13708 spdy_util_.ConstructSpdyGetSynReply(nullptr, 0, 1)); |
| 13709 std::unique_ptr<SpdySerializedFrame> resp1( | 13709 std::unique_ptr<SpdySerializedFrame> resp1( |
| 13710 spdy_util_wrapped.ConstructSpdyGetSynReply(nullptr, 0, 1)); | 13710 spdy_util_wrapped.ConstructSpdyGetSynReply(nullptr, 0, 1)); |
| (...skipping 2212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15923 base::RunLoop().RunUntilIdle(); | 15923 base::RunLoop().RunUntilIdle(); |
| 15924 | 15924 |
| 15925 EXPECT_TRUE(trans.GetResponseInfo()->was_fetched_via_spdy); | 15925 EXPECT_TRUE(trans.GetResponseInfo()->was_fetched_via_spdy); |
| 15926 HttpRequestHeaders headers; | 15926 HttpRequestHeaders headers; |
| 15927 ASSERT_TRUE(trans.GetFullRequestHeaders(&headers)); | 15927 ASSERT_TRUE(trans.GetFullRequestHeaders(&headers)); |
| 15928 EXPECT_TRUE(headers.HasHeader(HttpRequestHeaders::kTokenBinding)); | 15928 EXPECT_TRUE(headers.HasHeader(HttpRequestHeaders::kTokenBinding)); |
| 15929 } | 15929 } |
| 15930 #endif // !defined(OS_IOS) | 15930 #endif // !defined(OS_IOS) |
| 15931 | 15931 |
| 15932 } // namespace net | 15932 } // namespace net |
| OLD | NEW |