Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(310)

Unified Diff: net/http/http_stream_parser.cc

Issue 6488010: Propagate the remote socket address to URLRequest and to ViewHostMsg_FrameNavigate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address eroman's comments Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/http/http_stream_parser.cc
diff --git a/net/http/http_stream_parser.cc b/net/http/http_stream_parser.cc
index 20ebd87ed9e315847a8d501c8181b5dbcb45f2ab..6621f0b1ca21b505f429ff7a0988266e6cb56ff1 100644
--- a/net/http/http_stream_parser.cc
+++ b/net/http/http_stream_parser.cc
@@ -6,6 +6,7 @@
#include "base/compiler_specific.h"
#include "base/metrics/histogram.h"
+#include "net/base/address_list.h"
#include "net/base/auth.h"
#include "net/base/io_buffer.h"
#include "net/base/ssl_cert_request_info.h"
@@ -65,6 +66,14 @@ int HttpStreamParser::SendRequest(const std::string& request_line,
request_line, headers)));
}
response_ = response;
+
+ // Put the peer's IP address and port into the response.
+ AddressList address;
+ int result = connection_->socket()->GetPeerAddress(&address);
+ if (result != OK)
+ return result;
+ response_->socket_address = HostPortPair::FromAddrInfo(address.head());
+
std::string request = request_line + headers.ToString();
scoped_refptr<StringIOBuffer> headers_io_buf(new StringIOBuffer(request));
request_headers_ = new DrainableIOBuffer(headers_io_buf,
@@ -74,7 +83,7 @@ int HttpStreamParser::SendRequest(const std::string& request_line,
request_body_->set_chunk_callback(this);
io_state_ = STATE_SENDING_HEADERS;
- int result = DoLoop(OK);
+ result = DoLoop(OK);
if (result == ERR_IO_PENDING)
user_callback_ = callback;

Powered by Google App Engine
This is Rietveld 408576698