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 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
14 #include "base/stringprintf.h" | 14 #include "base/stringprintf.h" |
15 #include "net/base/host_port_pair.h" | 15 #include "net/base/host_port_pair.h" |
16 #include "net/base/net_log.h" | 16 #include "net/base/net_log.h" |
17 #include "net/base/net_util.h" | 17 #include "net/base/net_util.h" |
18 #include "net/base/upload_data_stream.h" | 18 #include "net/base/upload_data_stream.h" |
19 #include "net/http/http_request_headers.h" | 19 #include "net/http/http_request_headers.h" |
20 #include "net/http/http_request_info.h" | 20 #include "net/http/http_request_info.h" |
21 #include "net/http/http_response_info.h" | 21 #include "net/http/http_response_info.h" |
22 #include "net/spdy/spdy_header_block.h" | 22 #include "net/spdy/spdy_header_block.h" |
23 #include "net/spdy/spdy_http_utils.h" | 23 #include "net/spdy/spdy_http_utils.h" |
| 24 #include "net/spdy/spdy_protocol.h" |
24 #include "net/spdy/spdy_session.h" | 25 #include "net/spdy/spdy_session.h" |
25 | 26 |
26 namespace net { | 27 namespace net { |
27 | 28 |
28 SpdyHttpStream::SpdyHttpStream(SpdySession* spdy_session, | 29 SpdyHttpStream::SpdyHttpStream(SpdySession* spdy_session, |
29 bool direct) | 30 bool direct) |
30 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), | 31 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), |
31 spdy_session_(spdy_session), | 32 spdy_session_(spdy_session), |
32 stream_closed_(false), | 33 stream_closed_(false), |
33 closed_stream_pushed_(false), | 34 closed_stream_pushed_(false), |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 // will take care of that part. | 402 // will take care of that part. |
402 SSLInfo ssl_info; | 403 SSLInfo ssl_info; |
403 NextProto protocol_negotiated = kProtoUnknown; | 404 NextProto protocol_negotiated = kProtoUnknown; |
404 stream_->GetSSLInfo(&ssl_info, | 405 stream_->GetSSLInfo(&ssl_info, |
405 &response_info_->was_npn_negotiated, | 406 &response_info_->was_npn_negotiated, |
406 &protocol_negotiated); | 407 &protocol_negotiated); |
407 response_info_->npn_negotiated_protocol = | 408 response_info_->npn_negotiated_protocol = |
408 SSLClientSocket::NextProtoToString(protocol_negotiated); | 409 SSLClientSocket::NextProtoToString(protocol_negotiated); |
409 response_info_->request_time = stream_->GetRequestTime(); | 410 response_info_->request_time = stream_->GetRequestTime(); |
410 switch (spdy_session_->GetProtocolVersion()) { | 411 switch (spdy_session_->GetProtocolVersion()) { |
411 case 2: | 412 case kSpdyVersion2: |
412 response_info_->connection_info = HttpResponseInfo::CONNECTION_INFO_SPDY2; | 413 response_info_->connection_info = HttpResponseInfo::CONNECTION_INFO_SPDY2; |
413 break; | 414 break; |
414 case 3: | 415 case kSpdyVersion3: |
415 response_info_->connection_info = HttpResponseInfo::CONNECTION_INFO_SPDY3; | 416 response_info_->connection_info = HttpResponseInfo::CONNECTION_INFO_SPDY3; |
416 break; | 417 break; |
| 418 case kSpdyVersion4: |
| 419 response_info_->connection_info = HttpResponseInfo::CONNECTION_INFO_SPDY4; |
| 420 break; |
417 default: | 421 default: |
418 NOTREACHED(); | 422 NOTREACHED(); |
419 } | 423 } |
420 response_info_->vary_data.Init(*request_info_, *response_info_->headers); | 424 response_info_->vary_data.Init(*request_info_, *response_info_->headers); |
421 // TODO(ahendrickson): This is recorded after the entire SYN_STREAM control | 425 // TODO(ahendrickson): This is recorded after the entire SYN_STREAM control |
422 // frame has been received and processed. Move to framer? | 426 // frame has been received and processed. Move to framer? |
423 response_info_->response_time = response_time; | 427 response_info_->response_time = response_time; |
424 | 428 |
425 if (!callback_.is_null()) | 429 if (!callback_.is_null()) |
426 DoCallback(status); | 430 DoCallback(status); |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 bool SpdyHttpStream::IsSpdyHttpStream() const { | 596 bool SpdyHttpStream::IsSpdyHttpStream() const { |
593 return true; | 597 return true; |
594 } | 598 } |
595 | 599 |
596 void SpdyHttpStream::Drain(HttpNetworkSession* session) { | 600 void SpdyHttpStream::Drain(HttpNetworkSession* session) { |
597 Close(false); | 601 Close(false); |
598 delete this; | 602 delete this; |
599 } | 603 } |
600 | 604 |
601 } // namespace net | 605 } // namespace net |
OLD | NEW |