| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "net/base/address_list.h" |
| 9 #include "net/base/auth.h" | 10 #include "net/base/auth.h" |
| 10 #include "net/base/io_buffer.h" | 11 #include "net/base/io_buffer.h" |
| 12 #include "net/base/net_util.h" |
| 11 #include "net/base/ssl_cert_request_info.h" | 13 #include "net/base/ssl_cert_request_info.h" |
| 12 #include "net/http/http_net_log_params.h" | 14 #include "net/http/http_net_log_params.h" |
| 13 #include "net/http/http_request_headers.h" | 15 #include "net/http/http_request_headers.h" |
| 14 #include "net/http/http_request_info.h" | 16 #include "net/http/http_request_info.h" |
| 15 #include "net/http/http_response_headers.h" | 17 #include "net/http/http_response_headers.h" |
| 16 #include "net/http/http_util.h" | 18 #include "net/http/http_util.h" |
| 17 #include "net/socket/ssl_client_socket.h" | 19 #include "net/socket/ssl_client_socket.h" |
| 18 #include "net/socket/client_socket_handle.h" | 20 #include "net/socket/client_socket_handle.h" |
| 19 | 21 |
| 20 namespace net { | 22 namespace net { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 DCHECK(callback); | 60 DCHECK(callback); |
| 59 DCHECK(response); | 61 DCHECK(response); |
| 60 | 62 |
| 61 if (net_log_.IsLoggingAllEvents()) { | 63 if (net_log_.IsLoggingAllEvents()) { |
| 62 net_log_.AddEvent( | 64 net_log_.AddEvent( |
| 63 NetLog::TYPE_HTTP_TRANSACTION_SEND_REQUEST_HEADERS, | 65 NetLog::TYPE_HTTP_TRANSACTION_SEND_REQUEST_HEADERS, |
| 64 make_scoped_refptr(new NetLogHttpRequestParameter( | 66 make_scoped_refptr(new NetLogHttpRequestParameter( |
| 65 request_line, headers))); | 67 request_line, headers))); |
| 66 } | 68 } |
| 67 response_ = response; | 69 response_ = response; |
| 70 |
| 71 // Put the peer's ip:port into the response, for inquisitive users. |
| 72 AddressList address; |
| 73 if (connection_->socket()->GetPeerAddress(&address) == OK) |
| 74 response_->socket_address = NetAddressToStringWithPort(address.head()); |
| 75 else |
| 76 response_->socket_address.clear(); |
| 77 |
| 68 std::string request = request_line + headers.ToString(); | 78 std::string request = request_line + headers.ToString(); |
| 69 scoped_refptr<StringIOBuffer> headers_io_buf(new StringIOBuffer(request)); | 79 scoped_refptr<StringIOBuffer> headers_io_buf(new StringIOBuffer(request)); |
| 70 request_headers_ = new DrainableIOBuffer(headers_io_buf, | 80 request_headers_ = new DrainableIOBuffer(headers_io_buf, |
| 71 headers_io_buf->size()); | 81 headers_io_buf->size()); |
| 72 request_body_.reset(request_body); | 82 request_body_.reset(request_body); |
| 73 if (request_body_ != NULL && request_body_->is_chunked()) | 83 if (request_body_ != NULL && request_body_->is_chunked()) |
| 74 request_body_->set_chunk_callback(this); | 84 request_body_->set_chunk_callback(this); |
| 75 | 85 |
| 76 io_state_ = STATE_SENDING_HEADERS; | 86 io_state_ = STATE_SENDING_HEADERS; |
| 77 int result = DoLoop(OK); | 87 int result = DoLoop(OK); |
| (...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 655 void HttpStreamParser::GetSSLCertRequestInfo( | 665 void HttpStreamParser::GetSSLCertRequestInfo( |
| 656 SSLCertRequestInfo* cert_request_info) { | 666 SSLCertRequestInfo* cert_request_info) { |
| 657 if (request_->url.SchemeIs("https") && connection_->socket()) { | 667 if (request_->url.SchemeIs("https") && connection_->socket()) { |
| 658 SSLClientSocket* ssl_socket = | 668 SSLClientSocket* ssl_socket = |
| 659 static_cast<SSLClientSocket*>(connection_->socket()); | 669 static_cast<SSLClientSocket*>(connection_->socket()); |
| 660 ssl_socket->GetSSLCertRequestInfo(cert_request_info); | 670 ssl_socket->GetSSLCertRequestInfo(cert_request_info); |
| 661 } | 671 } |
| 662 } | 672 } |
| 663 | 673 |
| 664 } // namespace net | 674 } // namespace net |
| OLD | NEW |