| 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/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 8 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 9 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| 10 #include "net/base/address_list.h" | 11 #include "net/base/address_list.h" |
| 11 #include "net/base/auth.h" | 12 #include "net/base/auth.h" |
| 12 #include "net/base/io_buffer.h" | 13 #include "net/base/io_buffer.h" |
| 13 #include "net/base/ssl_cert_request_info.h" | 14 #include "net/base/ssl_cert_request_info.h" |
| 14 #include "net/http/http_net_log_params.h" | |
| 15 #include "net/http/http_request_headers.h" | 15 #include "net/http/http_request_headers.h" |
| 16 #include "net/http/http_request_info.h" | 16 #include "net/http/http_request_info.h" |
| 17 #include "net/http/http_response_headers.h" | 17 #include "net/http/http_response_headers.h" |
| 18 #include "net/http/http_util.h" | 18 #include "net/http/http_util.h" |
| 19 #include "net/socket/ssl_client_socket.h" | 19 #include "net/socket/ssl_client_socket.h" |
| 20 #include "net/socket/client_socket_handle.h" | 20 #include "net/socket/client_socket_handle.h" |
| 21 | 21 |
| 22 namespace { | 22 namespace { |
| 23 | 23 |
| 24 const size_t kMaxMergedHeaderAndBodySize = 1400; | 24 const size_t kMaxMergedHeaderAndBodySize = 1400; |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 int HttpStreamParser::SendRequest(const std::string& request_line, | 190 int HttpStreamParser::SendRequest(const std::string& request_line, |
| 191 const HttpRequestHeaders& headers, | 191 const HttpRequestHeaders& headers, |
| 192 UploadDataStream* request_body, | 192 UploadDataStream* request_body, |
| 193 HttpResponseInfo* response, | 193 HttpResponseInfo* response, |
| 194 const CompletionCallback& callback) { | 194 const CompletionCallback& callback) { |
| 195 DCHECK_EQ(STATE_NONE, io_state_); | 195 DCHECK_EQ(STATE_NONE, io_state_); |
| 196 DCHECK(callback_.is_null()); | 196 DCHECK(callback_.is_null()); |
| 197 DCHECK(!callback.is_null()); | 197 DCHECK(!callback.is_null()); |
| 198 DCHECK(response); | 198 DCHECK(response); |
| 199 | 199 |
| 200 if (net_log_.IsLoggingAllEvents()) { | 200 net_log_.AddEvent( |
| 201 net_log_.AddEvent( | 201 NetLog::TYPE_HTTP_TRANSACTION_SEND_REQUEST_HEADERS, |
| 202 NetLog::TYPE_HTTP_TRANSACTION_SEND_REQUEST_HEADERS, | 202 base::Bind(&HttpRequestHeaders::NetLogCallback, |
| 203 make_scoped_refptr(new NetLogHttpRequestParameter( | 203 base::Unretained(&headers), |
| 204 request_line, headers))); | 204 &request_line)); |
| 205 } | 205 |
| 206 DVLOG(1) << __FUNCTION__ << "()" | 206 DVLOG(1) << __FUNCTION__ << "()" |
| 207 << " request_line = \"" << request_line << "\"" | 207 << " request_line = \"" << request_line << "\"" |
| 208 << " headers = \"" << headers.ToString() << "\""; | 208 << " headers = \"" << headers.ToString() << "\""; |
| 209 response_ = response; | 209 response_ = response; |
| 210 | 210 |
| 211 // Put the peer's IP address and port into the response. | 211 // Put the peer's IP address and port into the response. |
| 212 IPEndPoint ip_endpoint; | 212 IPEndPoint ip_endpoint; |
| 213 int result = connection_->socket()->GetPeerAddress(&ip_endpoint); | 213 int result = connection_->socket()->GetPeerAddress(&ip_endpoint); |
| 214 if (result != OK) | 214 if (result != OK) |
| 215 return result; | 215 return result; |
| (...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 952 request_body->IsInMemory() && | 952 request_body->IsInMemory() && |
| 953 request_body->size() > 0) { | 953 request_body->size() > 0) { |
| 954 size_t merged_size = request_headers.size() + request_body->size(); | 954 size_t merged_size = request_headers.size() + request_body->size(); |
| 955 if (merged_size <= kMaxMergedHeaderAndBodySize) | 955 if (merged_size <= kMaxMergedHeaderAndBodySize) |
| 956 return true; | 956 return true; |
| 957 } | 957 } |
| 958 return false; | 958 return false; |
| 959 } | 959 } |
| 960 | 960 |
| 961 } // namespace net | 961 } // namespace net |
| OLD | NEW |