OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/tools/quic/test_tools/quic_test_client.h" | 5 #include "net/tools/quic/test_tools/quic_test_client.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 BalsaHeaders* MungeHeaders(const BalsaHeaders* const_headers) { | 124 BalsaHeaders* MungeHeaders(const BalsaHeaders* const_headers) { |
125 StringPiece uri = const_headers->request_uri(); | 125 StringPiece uri = const_headers->request_uri(); |
126 if (uri.empty()) { | 126 if (uri.empty()) { |
127 return nullptr; | 127 return nullptr; |
128 } | 128 } |
129 if (const_headers->request_method() == "CONNECT") { | 129 if (const_headers->request_method() == "CONNECT") { |
130 return nullptr; | 130 return nullptr; |
131 } | 131 } |
132 BalsaHeaders* headers = new BalsaHeaders; | 132 BalsaHeaders* headers = new BalsaHeaders; |
133 headers->CopyFrom(*const_headers); | 133 headers->CopyFrom(*const_headers); |
134 if (!uri.starts_with("https://") && !uri.starts_with("http://")) { | 134 if (!base::StartsWith(uri, "https://", |
| 135 base::CompareCase::INSENSITIVE_ASCII) && |
| 136 !base::StartsWith(uri, "http://", base::CompareCase::INSENSITIVE_ASCII)) { |
135 // If we have a relative URL, set some defaults. | 137 // If we have a relative URL, set some defaults. |
136 string full_uri = "https://test.example.com"; | 138 string full_uri = "https://test.example.com"; |
137 full_uri.append(uri.as_string()); | 139 full_uri.append(uri.as_string()); |
138 headers->SetRequestUri(full_uri); | 140 headers->SetRequestUri(full_uri); |
139 } | 141 } |
140 return headers; | 142 return headers; |
141 } | 143 } |
142 | 144 |
143 MockableQuicClient::MockableQuicClient( | 145 MockableQuicClient::MockableQuicClient( |
144 IPEndPoint server_address, | 146 IPEndPoint server_address, |
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 CHECK(message); | 751 CHECK(message); |
750 message->headers()->SetRequestVersion( | 752 message->headers()->SetRequestVersion( |
751 HTTPMessage::VersionToString(HttpConstants::HTTP_1_1)); | 753 HTTPMessage::VersionToString(HttpConstants::HTTP_1_1)); |
752 message->headers()->SetRequestMethod( | 754 message->headers()->SetRequestMethod( |
753 HTTPMessage::MethodToString(HttpConstants::GET)); | 755 HTTPMessage::MethodToString(HttpConstants::GET)); |
754 message->headers()->SetRequestUri(uri); | 756 message->headers()->SetRequestUri(uri); |
755 } | 757 } |
756 | 758 |
757 } // namespace test | 759 } // namespace test |
758 } // namespace net | 760 } // namespace net |
OLD | NEW |