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/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "net/base/address_list.h" | 10 #include "net/base/address_list.h" |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 NetLog::TYPE_HTTP_TRANSACTION_SEND_REQUEST_HEADERS, | 202 NetLog::TYPE_HTTP_TRANSACTION_SEND_REQUEST_HEADERS, |
203 make_scoped_refptr(new NetLogHttpRequestParameter( | 203 make_scoped_refptr(new NetLogHttpRequestParameter( |
204 request_line, headers))); | 204 request_line, headers))); |
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 AddressList address; | 212 IPEndPoint ip_endpoint; |
213 int result = connection_->socket()->GetPeerAddress(&address); | 213 int result = connection_->socket()->GetPeerAddress(&ip_endpoint); |
214 if (result != OK) | 214 if (result != OK) |
215 return result; | 215 return result; |
216 response_->socket_address = HostPortPair::FromIPEndPoint(address.front()); | 216 response_->socket_address = HostPortPair::FromIPEndPoint(ip_endpoint); |
217 | 217 |
218 std::string request = request_line + headers.ToString(); | 218 std::string request = request_line + headers.ToString(); |
219 request_body_.reset(request_body); | 219 request_body_.reset(request_body); |
220 if (request_body_ != NULL) { | 220 if (request_body_ != NULL) { |
221 request_body_buf_ = new SeekableIOBuffer(kRequestBodyBufferSize); | 221 request_body_buf_ = new SeekableIOBuffer(kRequestBodyBufferSize); |
222 if (request_body_->is_chunked()) { | 222 if (request_body_->is_chunked()) { |
223 request_body_->set_chunk_callback(this); | 223 request_body_->set_chunk_callback(this); |
224 // The chunk buffer is adjusted to guarantee that |request_body_buf_| | 224 // The chunk buffer is adjusted to guarantee that |request_body_buf_| |
225 // is large enough to hold the encoded chunk. | 225 // is large enough to hold the encoded chunk. |
226 chunk_buf_ = new IOBufferWithSize(kRequestBodyBufferSize - | 226 chunk_buf_ = new IOBufferWithSize(kRequestBodyBufferSize - |
(...skipping 725 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 |