| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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/quic_client_base.h" | 5 #include "net/tools/quic/quic_client_base.h" |
| 6 | 6 |
| 7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
| 8 #include "net/quic/core/crypto/quic_random.h" | 8 #include "net/quic/core/crypto/quic_random.h" |
| 9 #include "net/quic/core/quic_server_id.h" | 9 #include "net/quic/core/quic_server_id.h" |
| 10 #include "net/quic/core/spdy_utils.h" | 10 #include "net/quic/core/spdy_utils.h" |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 QuicAsyncStatus rv = push_promise_index()->Try(headers, this, &handle); | 208 QuicAsyncStatus rv = push_promise_index()->Try(headers, this, &handle); |
| 209 if (rv == QUIC_SUCCESS) | 209 if (rv == QUIC_SUCCESS) |
| 210 return; | 210 return; |
| 211 | 211 |
| 212 if (rv == QUIC_PENDING) { | 212 if (rv == QUIC_PENDING) { |
| 213 // May need to retry request if asynchronous rendezvous fails. | 213 // May need to retry request if asynchronous rendezvous fails. |
| 214 AddPromiseDataToResend(headers, body, fin); | 214 AddPromiseDataToResend(headers, body, fin); |
| 215 return; | 215 return; |
| 216 } | 216 } |
| 217 | 217 |
| 218 QuicSpdyClientStream* stream = CreateReliableClientStream(); | 218 QuicSpdyClientStream* stream = CreateClientStream(); |
| 219 if (stream == nullptr) { | 219 if (stream == nullptr) { |
| 220 QUIC_BUG << "stream creation failed!"; | 220 QUIC_BUG << "stream creation failed!"; |
| 221 return; | 221 return; |
| 222 } | 222 } |
| 223 stream->SendRequest(headers.Clone(), body, fin); | 223 stream->SendRequest(headers.Clone(), body, fin); |
| 224 // Record this in case we need to resend. | 224 // Record this in case we need to resend. |
| 225 MaybeAddDataToResend(headers, body, fin); | 225 MaybeAddDataToResend(headers, body, fin); |
| 226 } | 226 } |
| 227 | 227 |
| 228 void QuicClientBase::SendRequestAndWaitForResponse( | 228 void QuicClientBase::SendRequestAndWaitForResponse( |
| (...skipping 12 matching lines...) Expand all Loading... |
| 241 if (!SpdyUtils::PopulateHeaderBlockFromUrl(url_list[i], &headers)) { | 241 if (!SpdyUtils::PopulateHeaderBlockFromUrl(url_list[i], &headers)) { |
| 242 QUIC_BUG << "Unable to create request"; | 242 QUIC_BUG << "Unable to create request"; |
| 243 continue; | 243 continue; |
| 244 } | 244 } |
| 245 SendRequest(headers, "", true); | 245 SendRequest(headers, "", true); |
| 246 } | 246 } |
| 247 while (WaitForEvents()) { | 247 while (WaitForEvents()) { |
| 248 } | 248 } |
| 249 } | 249 } |
| 250 | 250 |
| 251 QuicSpdyClientStream* QuicClientBase::CreateReliableClientStream() { | 251 QuicSpdyClientStream* QuicClientBase::CreateClientStream() { |
| 252 if (!connected()) { | 252 if (!connected()) { |
| 253 return nullptr; | 253 return nullptr; |
| 254 } | 254 } |
| 255 | 255 |
| 256 QuicSpdyClientStream* stream = | 256 QuicSpdyClientStream* stream = |
| 257 session_->CreateOutgoingDynamicStream(kDefaultPriority); | 257 session_->CreateOutgoingDynamicStream(kDefaultPriority); |
| 258 if (stream) { | 258 if (stream) { |
| 259 stream->set_visitor(this); | 259 stream->set_visitor(this); |
| 260 } | 260 } |
| 261 return stream; | 261 return stream; |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 QUIC_BUG_IF(!store_response_) << "Response not stored!"; | 472 QUIC_BUG_IF(!store_response_) << "Response not stored!"; |
| 473 return latest_response_body_; | 473 return latest_response_body_; |
| 474 } | 474 } |
| 475 | 475 |
| 476 const string& QuicClientBase::latest_response_trailers() const { | 476 const string& QuicClientBase::latest_response_trailers() const { |
| 477 QUIC_BUG_IF(!store_response_) << "Response not stored!"; | 477 QUIC_BUG_IF(!store_response_) << "Response not stored!"; |
| 478 return latest_response_trailers_; | 478 return latest_response_trailers_; |
| 479 } | 479 } |
| 480 | 480 |
| 481 } // namespace net | 481 } // namespace net |
| OLD | NEW |