| 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/spdy/spdy_http_stream.h" | 5 #include "net/spdy/spdy_http_stream.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <list> | 8 #include <list> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 closed_stream_received_bytes_(0), | 42 closed_stream_received_bytes_(0), |
| 43 closed_stream_sent_bytes_(0), | 43 closed_stream_sent_bytes_(0), |
| 44 request_info_(NULL), | 44 request_info_(NULL), |
| 45 response_info_(NULL), | 45 response_info_(NULL), |
| 46 response_headers_status_(RESPONSE_HEADERS_ARE_INCOMPLETE), | 46 response_headers_status_(RESPONSE_HEADERS_ARE_INCOMPLETE), |
| 47 user_buffer_len_(0), | 47 user_buffer_len_(0), |
| 48 request_body_buf_size_(0), | 48 request_body_buf_size_(0), |
| 49 buffered_read_callback_pending_(false), | 49 buffered_read_callback_pending_(false), |
| 50 more_read_data_pending_(false), | 50 more_read_data_pending_(false), |
| 51 direct_(direct), | 51 direct_(direct), |
| 52 was_npn_negotiated_(false), | 52 was_alpn_negotiated_(false), |
| 53 negotiated_protocol_(kProtoUnknown), | 53 negotiated_protocol_(kProtoUnknown), |
| 54 weak_factory_(this) { | 54 weak_factory_(this) { |
| 55 DCHECK(spdy_session_.get()); | 55 DCHECK(spdy_session_.get()); |
| 56 } | 56 } |
| 57 | 57 |
| 58 SpdyHttpStream::~SpdyHttpStream() { | 58 SpdyHttpStream::~SpdyHttpStream() { |
| 59 if (stream_.get()) { | 59 if (stream_.get()) { |
| 60 stream_->DetachDelegate(); | 60 stream_->DetachDelegate(); |
| 61 DCHECK(!stream_.get()); | 61 DCHECK(!stream_.get()); |
| 62 } | 62 } |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 | 323 |
| 324 if (!SpdyHeadersToHttpResponse(response_headers, response_info_)) { | 324 if (!SpdyHeadersToHttpResponse(response_headers, response_info_)) { |
| 325 // We do not have complete headers yet. | 325 // We do not have complete headers yet. |
| 326 return RESPONSE_HEADERS_ARE_INCOMPLETE; | 326 return RESPONSE_HEADERS_ARE_INCOMPLETE; |
| 327 } | 327 } |
| 328 | 328 |
| 329 response_info_->response_time = stream_->response_time(); | 329 response_info_->response_time = stream_->response_time(); |
| 330 response_headers_status_ = RESPONSE_HEADERS_ARE_COMPLETE; | 330 response_headers_status_ = RESPONSE_HEADERS_ARE_COMPLETE; |
| 331 // Don't store the SSLInfo in the response here, HttpNetworkTransaction | 331 // Don't store the SSLInfo in the response here, HttpNetworkTransaction |
| 332 // will take care of that part. | 332 // will take care of that part. |
| 333 response_info_->was_npn_negotiated = was_npn_negotiated_; | 333 response_info_->was_alpn_negotiated = was_alpn_negotiated_; |
| 334 response_info_->npn_negotiated_protocol = | 334 response_info_->alpn_negotiated_protocol = |
| 335 SSLClientSocket::NextProtoToString(negotiated_protocol_); | 335 SSLClientSocket::NextProtoToString(negotiated_protocol_); |
| 336 response_info_->request_time = stream_->GetRequestTime(); | 336 response_info_->request_time = stream_->GetRequestTime(); |
| 337 response_info_->connection_info = | 337 response_info_->connection_info = |
| 338 HttpResponseInfo::ConnectionInfoFromNextProto(kProtoHTTP2); | 338 HttpResponseInfo::ConnectionInfoFromNextProto(kProtoHTTP2); |
| 339 response_info_->vary_data | 339 response_info_->vary_data |
| 340 .Init(*request_info_, *response_info_->headers.get()); | 340 .Init(*request_info_, *response_info_->headers.get()); |
| 341 | 341 |
| 342 if (!response_callback_.is_null()) { | 342 if (!response_callback_.is_null()) { |
| 343 DoResponseCallback(OK); | 343 DoResponseCallback(OK); |
| 344 } | 344 } |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 base::Bind(&SpdyHttpStream::OnRequestBodyReadCompleted, | 443 base::Bind(&SpdyHttpStream::OnRequestBodyReadCompleted, |
| 444 weak_factory_.GetWeakPtr())); | 444 weak_factory_.GetWeakPtr())); |
| 445 | 445 |
| 446 if (rv != ERR_IO_PENDING) | 446 if (rv != ERR_IO_PENDING) |
| 447 OnRequestBodyReadCompleted(rv); | 447 OnRequestBodyReadCompleted(rv); |
| 448 } | 448 } |
| 449 | 449 |
| 450 void SpdyHttpStream::InitializeStreamHelper() { | 450 void SpdyHttpStream::InitializeStreamHelper() { |
| 451 stream_->SetDelegate(this); | 451 stream_->SetDelegate(this); |
| 452 stream_->GetSSLInfo(&ssl_info_); | 452 stream_->GetSSLInfo(&ssl_info_); |
| 453 was_npn_negotiated_ = stream_->WasNpnNegotiated(); | 453 was_alpn_negotiated_ = stream_->WasNpnNegotiated(); |
| 454 negotiated_protocol_ = stream_->GetNegotiatedProtocol(); | 454 negotiated_protocol_ = stream_->GetNegotiatedProtocol(); |
| 455 } | 455 } |
| 456 | 456 |
| 457 void SpdyHttpStream::ResetStreamInternal() { | 457 void SpdyHttpStream::ResetStreamInternal() { |
| 458 spdy_session_->ResetStream(stream()->stream_id(), RST_STREAM_INTERNAL_ERROR, | 458 spdy_session_->ResetStream(stream()->stream_id(), RST_STREAM_INTERNAL_ERROR, |
| 459 std::string()); | 459 std::string()); |
| 460 } | 460 } |
| 461 | 461 |
| 462 void SpdyHttpStream::OnRequestBodyReadCompleted(int status) { | 462 void SpdyHttpStream::OnRequestBodyReadCompleted(int status) { |
| 463 if (status < 0) { | 463 if (status < 0) { |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 614 details->connection_info = HttpResponseInfo::CONNECTION_INFO_HTTP2; | 614 details->connection_info = HttpResponseInfo::CONNECTION_INFO_HTTP2; |
| 615 return; | 615 return; |
| 616 } | 616 } |
| 617 | 617 |
| 618 void SpdyHttpStream::SetPriority(RequestPriority priority) { | 618 void SpdyHttpStream::SetPriority(RequestPriority priority) { |
| 619 // TODO(akalin): Plumb this through to |stream_request_| and | 619 // TODO(akalin): Plumb this through to |stream_request_| and |
| 620 // |stream_|. | 620 // |stream_|. |
| 621 } | 621 } |
| 622 | 622 |
| 623 } // namespace net | 623 } // namespace net |
| OLD | NEW |