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/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 bool fin, | 241 bool fin, |
242 QuicAckListenerInterface* delegate) { | 242 QuicAckListenerInterface* delegate) { |
243 if (headers) { | 243 if (headers) { |
244 QuicClientPushPromiseIndex::TryHandle* handle; | 244 QuicClientPushPromiseIndex::TryHandle* handle; |
245 QuicAsyncStatus rv = client()->push_promise_index()->Try( | 245 QuicAsyncStatus rv = client()->push_promise_index()->Try( |
246 SpdyBalsaUtils::RequestHeadersToSpdyHeaders(*headers), this, &handle); | 246 SpdyBalsaUtils::RequestHeadersToSpdyHeaders(*headers), this, &handle); |
247 if (rv == QUIC_SUCCESS) | 247 if (rv == QUIC_SUCCESS) |
248 return 1; | 248 return 1; |
249 if (rv == QUIC_PENDING) { | 249 if (rv == QUIC_PENDING) { |
250 // May need to retry request if asynchronous rendezvous fails. | 250 // May need to retry request if asynchronous rendezvous fails. |
251 auto new_headers = new BalsaHeaders; | 251 auto* new_headers = new BalsaHeaders; |
252 new_headers->CopyFrom(*headers); | 252 new_headers->CopyFrom(*headers); |
253 push_promise_data_to_resend_.reset( | 253 push_promise_data_to_resend_.reset( |
254 new TestClientDataToResend(new_headers, body, fin, this, delegate)); | 254 new TestClientDataToResend(new_headers, body, fin, this, delegate)); |
255 return 1; | 255 return 1; |
256 } | 256 } |
257 } | 257 } |
258 | 258 |
259 // Maybe it's better just to overload this. it's just that we need | 259 // Maybe it's better just to overload this. it's just that we need |
260 // for the GetOrCreateStream function to call something else...which | 260 // for the GetOrCreateStream function to call something else...which |
261 // is icky and complicated, but maybe not worse than this. | 261 // is icky and complicated, but maybe not worse than this. |
(...skipping 22 matching lines...) Expand all Loading... |
284 } else { | 284 } else { |
285 stream->WriteOrBufferBody(body.as_string(), fin, delegate); | 285 stream->WriteOrBufferBody(body.as_string(), fin, delegate); |
286 ret = body.length(); | 286 ret = body.length(); |
287 } | 287 } |
288 if (FLAGS_enable_quic_stateless_reject_support) { | 288 if (FLAGS_enable_quic_stateless_reject_support) { |
289 BalsaHeaders* new_headers = nullptr; | 289 BalsaHeaders* new_headers = nullptr; |
290 if (headers) { | 290 if (headers) { |
291 new_headers = new BalsaHeaders; | 291 new_headers = new BalsaHeaders; |
292 new_headers->CopyFrom(*headers); | 292 new_headers->CopyFrom(*headers); |
293 } | 293 } |
294 auto data_to_resend = | 294 auto* data_to_resend = |
295 new TestClientDataToResend(new_headers, body, fin, this, delegate); | 295 new TestClientDataToResend(new_headers, body, fin, this, delegate); |
296 client()->MaybeAddQuicDataToResend(data_to_resend); | 296 client()->MaybeAddQuicDataToResend(data_to_resend); |
297 } | 297 } |
298 return ret; | 298 return ret; |
299 } | 299 } |
300 | 300 |
301 ssize_t QuicTestClient::SendMessage(const HTTPMessage& message) { | 301 ssize_t QuicTestClient::SendMessage(const HTTPMessage& message) { |
302 stream_ = nullptr; // Always force creation of a stream for SendMessage. | 302 stream_ = nullptr; // Always force creation of a stream for SendMessage. |
303 | 303 |
304 // If we're not connected, try to find an sni hostname. | 304 // If we're not connected, try to find an sni hostname. |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 CHECK(message); | 670 CHECK(message); |
671 message->headers()->SetRequestVersion( | 671 message->headers()->SetRequestVersion( |
672 HTTPMessage::VersionToString(HttpConstants::HTTP_1_1)); | 672 HTTPMessage::VersionToString(HttpConstants::HTTP_1_1)); |
673 message->headers()->SetRequestMethod( | 673 message->headers()->SetRequestMethod( |
674 HTTPMessage::MethodToString(HttpConstants::GET)); | 674 HTTPMessage::MethodToString(HttpConstants::GET)); |
675 message->headers()->SetRequestUri(uri); | 675 message->headers()->SetRequestUri(uri); |
676 } | 676 } |
677 | 677 |
678 } // namespace test | 678 } // namespace test |
679 } // namespace net | 679 } // namespace net |
OLD | NEW |