| 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/http/http_stream_parser.h" | 5 #include "net/http/http_stream_parser.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 897 return read_buf_->offset() > read_buf_unused_offset_; | 897 return read_buf_->offset() > read_buf_unused_offset_; |
| 898 } | 898 } |
| 899 | 899 |
| 900 bool HttpStreamParser::IsConnectionReused() const { | 900 bool HttpStreamParser::IsConnectionReused() const { |
| 901 ClientSocketHandle::SocketReuseType reuse_type = connection_->reuse_type(); | 901 ClientSocketHandle::SocketReuseType reuse_type = connection_->reuse_type(); |
| 902 return connection_->is_reused() || | 902 return connection_->is_reused() || |
| 903 reuse_type == ClientSocketHandle::UNUSED_IDLE; | 903 reuse_type == ClientSocketHandle::UNUSED_IDLE; |
| 904 } | 904 } |
| 905 | 905 |
| 906 void HttpStreamParser::SetConnectionReused() { | 906 void HttpStreamParser::SetConnectionReused() { |
| 907 connection_->set_is_reused(true); | 907 connection_->set_reuse_type(ClientSocketHandle::REUSED_IDLE); |
| 908 } | 908 } |
| 909 | 909 |
| 910 bool HttpStreamParser::IsConnectionReusable() const { | 910 bool HttpStreamParser::IsConnectionReusable() const { |
| 911 return connection_->socket() && connection_->socket()->IsConnectedAndIdle(); | 911 return connection_->socket() && connection_->socket()->IsConnectedAndIdle(); |
| 912 } | 912 } |
| 913 | 913 |
| 914 void HttpStreamParser::GetSSLInfo(SSLInfo* ssl_info) { | 914 void HttpStreamParser::GetSSLInfo(SSLInfo* ssl_info) { |
| 915 if (request_->url.SchemeIsSecure() && connection_->socket()) { | 915 if (request_->url.SchemeIsSecure() && connection_->socket()) { |
| 916 SSLClientSocket* ssl_socket = | 916 SSLClientSocket* ssl_socket = |
| 917 static_cast<SSLClientSocket*>(connection_->socket()); | 917 static_cast<SSLClientSocket*>(connection_->socket()); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 961 request_body->IsInMemory() && | 961 request_body->IsInMemory() && |
| 962 request_body->size() > 0) { | 962 request_body->size() > 0) { |
| 963 size_t merged_size = request_headers.size() + request_body->size(); | 963 size_t merged_size = request_headers.size() + request_body->size(); |
| 964 if (merged_size <= kMaxMergedHeaderAndBodySize) | 964 if (merged_size <= kMaxMergedHeaderAndBodySize) |
| 965 return true; | 965 return true; |
| 966 } | 966 } |
| 967 return false; | 967 return false; |
| 968 } | 968 } |
| 969 | 969 |
| 970 } // namespace net | 970 } // namespace net |
| OLD | NEW |