diff options
Diffstat (limited to 'net')
22 files changed, 179 insertions, 7 deletions
diff --git a/net/base/host_port_pair.cc b/net/base/host_port_pair.cc index 1c4406f..5164fcf 100644 --- a/net/base/host_port_pair.cc +++ b/net/base/host_port_pair.cc @@ -7,6 +7,8 @@ #include "base/string_util.h" #include "base/stringprintf.h" #include "googleurl/src/gurl.h" +#include "net/base/net_util.h" +#include "net/base/sys_addrinfo.h" namespace net { @@ -19,6 +21,12 @@ HostPortPair HostPortPair::FromURL(const GURL& url) { return HostPortPair(url.HostNoBrackets(), url.EffectiveIntPort()); } +// static +HostPortPair HostPortPair::FromAddrInfo(const struct addrinfo* ai) { + return HostPortPair(NetAddressToString(ai), + GetPortFromSockaddr(ai->ai_addr, ai->ai_addrlen)); +} + std::string HostPortPair::ToString() const { return base::StringPrintf("%s:%u", HostForURL().c_str(), port_); } diff --git a/net/base/host_port_pair.h b/net/base/host_port_pair.h index 2c7bb9f..7488e6c 100644 --- a/net/base/host_port_pair.h +++ b/net/base/host_port_pair.h @@ -9,6 +9,7 @@ #include <string> #include "base/basictypes.h" +struct addrinfo; class GURL; namespace net { @@ -22,6 +23,9 @@ class HostPortPair { // Creates a HostPortPair for the origin of |url|. static HostPortPair FromURL(const GURL& url); + // Creates a HostPortPair from an addrinfo struct. + static HostPortPair FromAddrInfo(const struct addrinfo* ai); + // TODO(willchan): Define a functor instead. // Comparator function so this can be placed in a std::map. bool operator<(const HostPortPair& other) const { diff --git a/net/ftp/ftp_network_transaction.cc b/net/ftp/ftp_network_transaction.cc index d012818..3f35c83 100644 --- a/net/ftp/ftp_network_transaction.cc +++ b/net/ftp/ftp_network_transaction.cc @@ -9,6 +9,7 @@ #include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" +#include "net/base/address_list.h" #include "net/base/connection_type_histograms.h" #include "net/base/escape.h" #include "net/base/net_errors.h" @@ -620,8 +621,15 @@ int FtpNetworkTransaction::DoCtrlConnect() { } int FtpNetworkTransaction::DoCtrlConnectComplete(int result) { - if (result == OK) - next_state_ = STATE_CTRL_READ; + if (result == OK) { + // Put the peer's IP address and port into the response. + AddressList address; + result = ctrl_socket_->GetPeerAddress(&address); + if (result == OK) { + response_.socket_address = HostPortPair::FromAddrInfo(address.head()); + next_state_ = STATE_CTRL_READ; + } + } return result; } diff --git a/net/ftp/ftp_network_transaction_unittest.cc b/net/ftp/ftp_network_transaction_unittest.cc index 8da3baf..1d86fba 100644 --- a/net/ftp/ftp_network_transaction_unittest.cc +++ b/net/ftp/ftp_network_transaction_unittest.cc @@ -9,6 +9,7 @@ #include "base/ref_counted.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" +#include "net/base/host_port_pair.h" #include "net/base/io_buffer.h" #include "net/base/mock_host_resolver.h" #include "net/base/net_util.h" @@ -831,6 +832,9 @@ TEST_F(FtpNetworkTransactionTest, DirectoryTransaction) { EXPECT_TRUE(transaction_.GetResponseInfo()->is_directory_listing); EXPECT_EQ(-1, transaction_.GetResponseInfo()->expected_content_size); + EXPECT_EQ("192.0.2.33", + transaction_.GetResponseInfo()->socket_address.host()); + EXPECT_EQ(0, transaction_.GetResponseInfo()->socket_address.port()); } TEST_F(FtpNetworkTransactionTest, DirectoryTransactionWithPasvFallback) { @@ -904,6 +908,9 @@ TEST_F(FtpNetworkTransactionTest, DownloadTransaction) { // We pass an artificial value of 18 as a response to the SIZE command. EXPECT_EQ(18, transaction_.GetResponseInfo()->expected_content_size); + EXPECT_EQ("192.0.2.33", + transaction_.GetResponseInfo()->socket_address.host()); + EXPECT_EQ(0, transaction_.GetResponseInfo()->socket_address.port()); } TEST_F(FtpNetworkTransactionTest, DownloadTransactionWithPasvFallback) { diff --git a/net/ftp/ftp_response_info.h b/net/ftp/ftp_response_info.h index 0c8884c..9db9018 100644 --- a/net/ftp/ftp_response_info.h +++ b/net/ftp/ftp_response_info.h @@ -7,6 +7,7 @@ #pragma once #include "base/time.h" +#include "net/base/host_port_pair.h" namespace net { @@ -36,6 +37,9 @@ class FtpResponseInfo { // True if the response data is of a directory listing. bool is_directory_listing; + + // Remote address of the socket which fetched this resource. + HostPortPair socket_address; }; } // namespace net diff --git a/net/http/http_cache_unittest.cc b/net/http/http_cache_unittest.cc index bf8cb6b..8d5fea4 100644 --- a/net/http/http_cache_unittest.cc +++ b/net/http/http_cache_unittest.cc @@ -11,6 +11,7 @@ #include "base/stringprintf.h" #include "net/base/cache_type.h" #include "net/base/cert_status_flags.h" +#include "net/base/host_port_pair.h" #include "net/base/load_flags.h" #include "net/base/net_errors.h" #include "net/base/net_log_unittest.h" @@ -3978,6 +3979,31 @@ TEST(HttpCache, WriteResponseInfo_Truncated) { entry->Close(); } +// Tests basic pickling/unpickling of HttpResponseInfo. +TEST(HttpCache, PersistHttpResponseInfo) { + // Set some fields (add more if needed.) + net::HttpResponseInfo response1; + response1.was_cached = false; + response1.socket_address = net::HostPortPair("1.2.3.4", 80); + response1.headers = new net::HttpResponseHeaders("HTTP/1.1 200 OK"); + + // Pickle. + Pickle pickle; + response1.Persist(&pickle, false, false); + + // Unpickle. + net::HttpResponseInfo response2; + bool response_truncated; + EXPECT_TRUE(response2.InitFromPickle(pickle, &response_truncated)); + EXPECT_FALSE(response_truncated); + + // Verify fields. + EXPECT_TRUE(response2.was_cached); // InitFromPickle sets this flag. + EXPECT_EQ("1.2.3.4", response2.socket_address.host()); + EXPECT_EQ(80, response2.socket_address.port()); + EXPECT_EQ("HTTP/1.1 200 OK", response2.headers->GetStatusLine()); +} + // Tests that we delete an entry when the request is cancelled before starting // to read from the network. TEST(HttpCache, DoomOnDestruction) { diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc index 8c87136..e54edf5 100644 --- a/net/http/http_network_transaction_unittest.cc +++ b/net/http/http_network_transaction_unittest.cc @@ -175,6 +175,9 @@ class HttpNetworkTransactionTest : public PlatformTest { EXPECT_TRUE(response->headers != NULL); out.status_line = response->headers->GetStatusLine(); + EXPECT_EQ("192.0.2.33", response->socket_address.host()); + EXPECT_EQ(0, response->socket_address.port()); + rv = ReadTransaction(trans.get(), &out.response_data); EXPECT_EQ(OK, rv); diff --git a/net/http/http_response_info.cc b/net/http/http_response_info.cc index 2c23faa..9b3444a 100644 --- a/net/http/http_response_info.cc +++ b/net/http/http_response_info.cc @@ -74,6 +74,7 @@ HttpResponseInfo::HttpResponseInfo(const HttpResponseInfo& rhs) was_npn_negotiated(rhs.was_npn_negotiated), was_alternate_protocol_available(rhs.was_alternate_protocol_available), was_fetched_via_proxy(rhs.was_fetched_via_proxy), + socket_address(rhs.socket_address), request_time(rhs.request_time), response_time(rhs.response_time), auth_challenge(rhs.auth_challenge), @@ -93,6 +94,7 @@ HttpResponseInfo& HttpResponseInfo::operator=(const HttpResponseInfo& rhs) { was_npn_negotiated = rhs.was_npn_negotiated; was_alternate_protocol_available = rhs.was_alternate_protocol_available; was_fetched_via_proxy = rhs.was_fetched_via_proxy; + socket_address = rhs.socket_address; request_time = rhs.request_time; response_time = rhs.response_time; auth_challenge = rhs.auth_challenge; @@ -158,6 +160,18 @@ bool HttpResponseInfo::InitFromPickle(const Pickle& pickle, return false; } + // Read socket_address. This was not always present in the response info, + // so we don't fail if it can't be read. If additional fields are added in + // a future version, then they must only be read if this operation succeeds. + std::string socket_address_host; + if (pickle.ReadString(&iter, &socket_address_host)) { + // If the host was written, we always expect the port to follow. + uint16 socket_address_port; + if (!pickle.ReadUInt16(&iter, &socket_address_port)) + return false; + socket_address = HostPortPair(socket_address_host, socket_address_port); + } + was_fetched_via_spdy = (flags & RESPONSE_INFO_WAS_SPDY) != 0; was_npn_negotiated = (flags & RESPONSE_INFO_WAS_NPN) != 0; @@ -223,6 +237,9 @@ void HttpResponseInfo::Persist(Pickle* pickle, if (vary_data.is_valid()) vary_data.Persist(pickle); + + pickle->WriteString(socket_address.host()); + pickle->WriteUInt16(socket_address.port()); } } // namespace net diff --git a/net/http/http_response_info.h b/net/http/http_response_info.h index 4fbea3d..e13f288 100644 --- a/net/http/http_response_info.h +++ b/net/http/http_response_info.h @@ -7,6 +7,7 @@ #pragma once #include "base/time.h" +#include "net/base/host_port_pair.h" #include "net/base/ssl_info.h" #include "net/http/http_vary_data.h" @@ -60,6 +61,15 @@ class HttpResponseInfo { // transparent proxy may have been involved. bool was_fetched_via_proxy; + // Remote address of the socket which fetched this resource. + // + // NOTE: If the response was served from the cache (was_cached is true), + // the socket address will be set to the address that the content came from + // originally. This is true even if the response was re-validated using a + // different remote address, or if some of the content came from a byte-range + // request to a different address. + HostPortPair socket_address; + // The time at which the request was made that resulted in this response. // For cached responses, this is the last time the cache entry was validated. base::Time request_time; diff --git a/net/http/http_stream_parser.cc b/net/http/http_stream_parser.cc index 20ebd87..6621f0b 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; diff --git a/net/socket/socket_test_util.cc b/net/socket/socket_test_util.cc index d5ee9ae..dc89546 100644 --- a/net/socket/socket_test_util.cc +++ b/net/socket/socket_test_util.cc @@ -631,7 +631,7 @@ bool MockClientSocket::IsConnectedAndIdle() const { } int MockClientSocket::GetPeerAddress(AddressList* address) const { - return net::SystemHostResolverProc("localhost", ADDRESS_FAMILY_UNSPECIFIED, + return net::SystemHostResolverProc("192.0.2.33", ADDRESS_FAMILY_UNSPECIFIED, 0, address, NULL); } diff --git a/net/spdy/spdy_http_stream.cc b/net/spdy/spdy_http_stream.cc index 6a6abb2..e07578e 100644 --- a/net/spdy/spdy_http_stream.cc +++ b/net/spdy/spdy_http_stream.cc @@ -10,6 +10,8 @@ #include "base/logging.h" #include "base/message_loop.h" +#include "net/base/address_list.h" +#include "net/base/host_port_pair.h" #include "net/base/load_flags.h" #include "net/base/net_util.h" #include "net/http/http_request_headers.h" @@ -230,8 +232,15 @@ int SpdyHttpStream::SendRequest(const HttpRequestHeaders& request_headers, response_info_ = response; + // Put the peer's IP address and port into the response. + AddressList address; + int result = stream_->GetPeerAddress(&address); + if (result != OK) + return result; + response_info_->socket_address = HostPortPair::FromAddrInfo(address.head()); + bool has_upload_data = request_body_stream_.get() != NULL; - int result = stream_->SendRequest(has_upload_data); + result = stream_->SendRequest(has_upload_data); if (result == ERR_IO_PENDING) { CHECK(!user_callback_); user_callback_ = callback; diff --git a/net/spdy/spdy_network_transaction_unittest.cc b/net/spdy/spdy_network_transaction_unittest.cc index de248cb..402f2f7 100644 --- a/net/spdy/spdy_network_transaction_unittest.cc +++ b/net/spdy/spdy_network_transaction_unittest.cc @@ -177,10 +177,11 @@ class SpdyNetworkTransactionTest EXPECT_EQ(request_.url.SchemeIs("https"), response->was_npn_negotiated); } + EXPECT_EQ("192.0.2.33", response->socket_address.host()); + EXPECT_EQ(0, response->socket_address.port()); output_.status_line = response->headers->GetStatusLine(); output_.response_info = *response; // Make a copy so we can verify. output_.rv = ReadTransaction(trans_.get(), &output_.response_data); - return; } // Most tests will want to call this function. In particular, the MockReads diff --git a/net/url_request/url_request.cc b/net/url_request/url_request.cc index 9e35fc0..848b810 100644 --- a/net/url_request/url_request.cc +++ b/net/url_request/url_request.cc @@ -9,6 +9,7 @@ #include "base/metrics/stats_counters.h" #include "base/singleton.h" #include "base/synchronization/lock.h" +#include "net/base/host_port_pair.h" #include "net/base/load_flags.h" #include "net/base/net_errors.h" #include "net/base/net_log.h" @@ -272,6 +273,11 @@ void URLRequest::GetAllResponseHeaders(string* headers) { } } +HostPortPair URLRequest::GetSocketAddress() const { + DCHECK(job_); + return job_->GetSocketAddress(); +} + net::HttpResponseHeaders* URLRequest::response_headers() const { return response_info_.headers.get(); } diff --git a/net/url_request/url_request.h b/net/url_request/url_request.h index bb08a8f..a2ad24b 100644 --- a/net/url_request/url_request.h +++ b/net/url_request/url_request.h @@ -38,6 +38,7 @@ typedef std::vector<std::string> ResponseCookies; namespace net { class CookieOptions; +class HostPortPair; class IOBuffer; class SSLCertRequestInfo; class UploadData; @@ -416,6 +417,10 @@ class URLRequest : public base::NonThreadSafe { return response_info_.was_fetched_via_proxy; } + // Returns the host and port that the content was fetched from. See + // http_response_info.h for caveats relating to cached content. + HostPortPair GetSocketAddress() const; + // Get all response headers, as a HttpResponseHeaders object. See comments // in HttpResponseHeaders class as to the format of the data. net::HttpResponseHeaders* response_headers() const; diff --git a/net/url_request/url_request_ftp_job.cc b/net/url_request/url_request_ftp_job.cc index 8c170ff..48f0639 100644 --- a/net/url_request/url_request_ftp_job.cc +++ b/net/url_request/url_request_ftp_job.cc @@ -8,6 +8,7 @@ #include "base/message_loop.h" #include "base/utf_string_conversions.h" #include "net/base/auth.h" +#include "net/base/host_port_pair.h" #include "net/base/net_errors.h" #include "net/base/net_util.h" #include "net/ftp/ftp_response_info.h" @@ -52,6 +53,13 @@ bool URLRequestFtpJob::GetMimeType(std::string* mime_type) const { return false; } +HostPortPair URLRequestFtpJob::GetSocketAddress() const { + if (!transaction_.get()) { + return HostPortPair(); + } + return transaction_->GetResponseInfo()->socket_address; +} + URLRequestFtpJob::~URLRequestFtpJob() { } diff --git a/net/url_request/url_request_ftp_job.h b/net/url_request/url_request_ftp_job.h index fe85ba3..84c54e1 100644 --- a/net/url_request/url_request_ftp_job.h +++ b/net/url_request/url_request_ftp_job.h @@ -31,6 +31,7 @@ class URLRequestFtpJob : public URLRequestJob { // Overridden from URLRequestJob: virtual bool GetMimeType(std::string* mime_type) const; + virtual HostPortPair GetSocketAddress() const; private: virtual ~URLRequestFtpJob(); diff --git a/net/url_request/url_request_http_job.cc b/net/url_request/url_request_http_job.cc index de51284..563c85b 100644 --- a/net/url_request/url_request_http_job.cc +++ b/net/url_request/url_request_http_job.cc @@ -16,12 +16,13 @@ #include "net/base/cookie_policy.h" #include "net/base/cookie_store.h" #include "net/base/filter.h" -#include "net/base/transport_security_state.h" +#include "net/base/host_port_pair.h" #include "net/base/load_flags.h" #include "net/base/net_errors.h" #include "net/base/net_util.h" #include "net/base/sdch_manager.h" #include "net/base/ssl_cert_request_info.h" +#include "net/base/transport_security_state.h" #include "net/http/http_request_headers.h" #include "net/http/http_response_headers.h" #include "net/http/http_response_info.h" @@ -926,6 +927,10 @@ void URLRequestHttpJob::StopCaching() { transaction_->StopCaching(); } +HostPortPair URLRequestHttpJob::GetSocketAddress() const { + return response_info_ ? response_info_->socket_address : HostPortPair(); +} + URLRequestHttpJob::~URLRequestHttpJob() { DCHECK(!sdch_test_control_ || !sdch_test_activated_); if (!IsCachedContent()) { diff --git a/net/url_request/url_request_http_job.h b/net/url_request/url_request_http_job.h index 3f9356e..e1abf3e 100644 --- a/net/url_request/url_request_http_job.h +++ b/net/url_request/url_request_http_job.h @@ -85,6 +85,7 @@ class URLRequestHttpJob : public URLRequestJob { virtual void ContinueDespiteLastError(); virtual bool ReadRawData(IOBuffer* buf, int buf_size, int *bytes_read); virtual void StopCaching(); + virtual HostPortPair GetSocketAddress() const; // Keep a reference to the url request context to be sure it's not deleted // before us. diff --git a/net/url_request/url_request_job.cc b/net/url_request/url_request_job.cc index ac05127..12c8d2e 100644 --- a/net/url_request/url_request_job.cc +++ b/net/url_request/url_request_job.cc @@ -9,6 +9,7 @@ #include "base/string_number_conversions.h" #include "base/string_util.h" #include "net/base/auth.h" +#include "net/base/host_port_pair.h" #include "net/base/io_buffer.h" #include "net/base/load_flags.h" #include "net/base/mime_util.h" @@ -398,6 +399,10 @@ void URLRequestJob::RecordPacketStats(StatisticSelector statistic) const { } } +HostPortPair URLRequestJob::GetSocketAddress() const { + return HostPortPair(); +} + URLRequestJob::~URLRequestJob() { g_url_request_job_tracker.RemoveJob(this); } diff --git a/net/url_request/url_request_job.h b/net/url_request/url_request_job.h index 3ac648b..b6c286a 100644 --- a/net/url_request/url_request_job.h +++ b/net/url_request/url_request_job.h @@ -15,6 +15,7 @@ #include "base/time.h" #include "googleurl/src/gurl.h" #include "net/base/filter.h" +#include "net/base/host_port_pair.h" #include "net/base/load_states.h" @@ -209,6 +210,10 @@ class URLRequestJob : public base::RefCounted<URLRequestJob>, virtual int GetInputStreamBufferSize() const; virtual void RecordPacketStats(StatisticSelector statistic) const; + // Returns the socket address for the connection. + // See url_request.h for details. + virtual HostPortPair GetSocketAddress() const; + protected: friend class base::RefCounted<URLRequestJob>; virtual ~URLRequestJob(); diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc index 35573ed..3192b39 100644 --- a/net/url_request/url_request_unittest.cc +++ b/net/url_request/url_request_unittest.cc @@ -267,6 +267,10 @@ TEST_F(URLRequestTestHTTP, GetTest_NoCache) { EXPECT_EQ(1, d.response_started_count()); EXPECT_FALSE(d.received_data_before_response()); EXPECT_NE(0, d.bytes_received()); + EXPECT_EQ(test_server_.host_port_pair().host(), + r.GetSocketAddress().host()); + EXPECT_EQ(test_server_.host_port_pair().port(), + r.GetSocketAddress().port()); // TODO(eroman): Add back the NetLog tests... } @@ -287,6 +291,10 @@ TEST_F(URLRequestTestHTTP, GetTest) { EXPECT_EQ(1, d.response_started_count()); EXPECT_FALSE(d.received_data_before_response()); EXPECT_NE(0, d.bytes_received()); + EXPECT_EQ(test_server_.host_port_pair().host(), + r.GetSocketAddress().host()); + EXPECT_EQ(test_server_.host_port_pair().port(), + r.GetSocketAddress().port()); } } @@ -335,6 +343,10 @@ TEST_F(HTTPSRequestTest, HTTPSGetTest) { EXPECT_FALSE(d.received_data_before_response()); EXPECT_NE(0, d.bytes_received()); CheckSSLInfo(r.ssl_info()); + EXPECT_EQ(test_server.host_port_pair().host(), + r.GetSocketAddress().host()); + EXPECT_EQ(test_server.host_port_pair().port(), + r.GetSocketAddress().port()); } } @@ -713,6 +725,8 @@ TEST_F(URLRequestTest, AboutBlankTest) { EXPECT_TRUE(!r.is_pending()); EXPECT_FALSE(d.received_data_before_response()); EXPECT_EQ(d.bytes_received(), 0); + EXPECT_EQ("", r.GetSocketAddress().host()); + EXPECT_EQ(0, r.GetSocketAddress().port()); } } @@ -750,6 +764,8 @@ TEST_F(URLRequestTest, DataURLImageTest) { EXPECT_TRUE(!r.is_pending()); EXPECT_FALSE(d.received_data_before_response()); EXPECT_EQ(d.bytes_received(), 911); + EXPECT_EQ("", r.GetSocketAddress().host()); + EXPECT_EQ(0, r.GetSocketAddress().port()); } } @@ -774,6 +790,8 @@ TEST_F(URLRequestTest, FileTest) { EXPECT_EQ(1, d.response_started_count()); EXPECT_FALSE(d.received_data_before_response()); EXPECT_EQ(d.bytes_received(), static_cast<int>(file_size)); + EXPECT_EQ("", r.GetSocketAddress().host()); + EXPECT_EQ(0, r.GetSocketAddress().port()); } } @@ -2373,6 +2391,10 @@ TEST_F(URLRequestTestFTP, FLAKY_FTPDirectoryListing) { EXPECT_EQ(1, d.response_started_count()); EXPECT_FALSE(d.received_data_before_response()); EXPECT_LT(0, d.bytes_received()); + EXPECT_EQ(test_server_.host_port_pair().host(), + r.GetSocketAddress().host()); + EXPECT_EQ(test_server_.host_port_pair().port(), + r.GetSocketAddress().port()); } } @@ -2398,6 +2420,10 @@ TEST_F(URLRequestTestFTP, FLAKY_FTPGetTestAnonymous) { EXPECT_EQ(1, d.response_started_count()); EXPECT_FALSE(d.received_data_before_response()); EXPECT_EQ(d.bytes_received(), static_cast<int>(file_size)); + EXPECT_EQ(test_server_.host_port_pair().host(), + r.GetSocketAddress().host()); + EXPECT_EQ(test_server_.host_port_pair().port(), + r.GetSocketAddress().port()); } } @@ -2422,6 +2448,10 @@ TEST_F(URLRequestTestFTP, FLAKY_FTPGetTest) { file_util::GetFileSize(app_path, &file_size); EXPECT_FALSE(r.is_pending()); + EXPECT_EQ(test_server_.host_port_pair().host(), + r.GetSocketAddress().host()); + EXPECT_EQ(test_server_.host_port_pair().port(), + r.GetSocketAddress().port()); EXPECT_EQ(1, d.response_started_count()); EXPECT_FALSE(d.received_data_before_response()); EXPECT_EQ(d.bytes_received(), static_cast<int>(file_size)); |