| 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" |
| 11 #include "net/base/ssl_cert_request_info.h" | 12 #include "net/base/ssl_cert_request_info.h" |
| 12 #include "net/http/http_net_log_params.h" | 13 #include "net/http/http_net_log_params.h" |
| 13 #include "net/http/http_request_headers.h" | 14 #include "net/http/http_request_headers.h" |
| 14 #include "net/http/http_request_info.h" | 15 #include "net/http/http_request_info.h" |
| 15 #include "net/http/http_response_headers.h" | 16 #include "net/http/http_response_headers.h" |
| 16 #include "net/http/http_util.h" | 17 #include "net/http/http_util.h" |
| 17 #include "net/socket/ssl_client_socket.h" | 18 #include "net/socket/ssl_client_socket.h" |
| 18 #include "net/socket/client_socket_handle.h" | 19 #include "net/socket/client_socket_handle.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 DCHECK(callback); | 56 DCHECK(callback); |
| 56 DCHECK(response); | 57 DCHECK(response); |
| 57 | 58 |
| 58 if (net_log_.IsLoggingAllEvents()) { | 59 if (net_log_.IsLoggingAllEvents()) { |
| 59 net_log_.AddEvent( | 60 net_log_.AddEvent( |
| 60 NetLog::TYPE_HTTP_TRANSACTION_SEND_REQUEST_HEADERS, | 61 NetLog::TYPE_HTTP_TRANSACTION_SEND_REQUEST_HEADERS, |
| 61 make_scoped_refptr(new NetLogHttpRequestParameter( | 62 make_scoped_refptr(new NetLogHttpRequestParameter( |
| 62 request_line, headers))); | 63 request_line, headers))); |
| 63 } | 64 } |
| 64 response_ = response; | 65 response_ = response; |
| 66 |
| 67 // Put the peer's ip:port into the response, for inquisitive users. |
| 68 AddressList address; |
| 69 connection_->socket()->GetPeerAddress(&address); |
| 70 response_->socket_address = |
| 71 address.head() ? NetAddressToStringWithPort(address.head()) : ""; |
| 72 |
| 65 std::string request = request_line + headers.ToString(); | 73 std::string request = request_line + headers.ToString(); |
| 66 scoped_refptr<StringIOBuffer> headers_io_buf(new StringIOBuffer(request)); | 74 scoped_refptr<StringIOBuffer> headers_io_buf(new StringIOBuffer(request)); |
| 67 request_headers_ = new DrainableIOBuffer(headers_io_buf, | 75 request_headers_ = new DrainableIOBuffer(headers_io_buf, |
| 68 headers_io_buf->size()); | 76 headers_io_buf->size()); |
| 69 request_body_.reset(request_body); | 77 request_body_.reset(request_body); |
| 70 | 78 |
| 71 io_state_ = STATE_SENDING_HEADERS; | 79 io_state_ = STATE_SENDING_HEADERS; |
| 72 int result = DoLoop(OK); | 80 int result = DoLoop(OK); |
| 73 if (result == ERR_IO_PENDING) | 81 if (result == ERR_IO_PENDING) |
| 74 user_callback_ = callback; | 82 user_callback_ = callback; |
| (...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 void HttpStreamParser::GetSSLCertRequestInfo( | 638 void HttpStreamParser::GetSSLCertRequestInfo( |
| 631 SSLCertRequestInfo* cert_request_info) { | 639 SSLCertRequestInfo* cert_request_info) { |
| 632 if (request_->url.SchemeIs("https") && connection_->socket()) { | 640 if (request_->url.SchemeIs("https") && connection_->socket()) { |
| 633 SSLClientSocket* ssl_socket = | 641 SSLClientSocket* ssl_socket = |
| 634 static_cast<SSLClientSocket*>(connection_->socket()); | 642 static_cast<SSLClientSocket*>(connection_->socket()); |
| 635 ssl_socket->GetSSLCertRequestInfo(cert_request_info); | 643 ssl_socket->GetSSLCertRequestInfo(cert_request_info); |
| 636 } | 644 } |
| 637 } | 645 } |
| 638 | 646 |
| 639 } // namespace net | 647 } // namespace net |
| OLD | NEW |