summaryrefslogtreecommitdiffstats
path: root/net/http
diff options
context:
space:
mode:
authorericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-16 20:36:09 +0000
committerericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-16 20:36:09 +0000
commit0e75a7333e0188a19e329f81dd1fef9d3664eb42 (patch)
tree5c7c2e1d46c4f4f509d81e5afb7e1d58de55a57b /net/http
parent1fcf6ef590782d36bb77f508bfed3547005f0a7e (diff)
downloadchromium_src-0e75a7333e0188a19e329f81dd1fef9d3664eb42.zip
chromium_src-0e75a7333e0188a19e329f81dd1fef9d3664eb42.tar.gz
chromium_src-0e75a7333e0188a19e329f81dd1fef9d3664eb42.tar.bz2
Misc style changes.
(trying to address previous review comments). Review URL: http://codereview.chromium.org/7447 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3482 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http')
-rw-r--r--net/http/http_network_transaction.cc11
-rw-r--r--net/http/http_network_transaction.h5
-rw-r--r--net/http/http_network_transaction_unittest.cc29
3 files changed, 15 insertions, 30 deletions
diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc
index 7fc99e8..9d74c87 100644
--- a/net/http/http_network_transaction.cc
+++ b/net/http/http_network_transaction.cc
@@ -603,9 +603,9 @@ int HttpNetworkTransaction::DoReadHeaders() {
return connection_.socket()->Read(buf, buf_len, &io_callback_);
}
-int HttpNetworkTransaction::HandleSocketClosedBeforeReadingEndOfHeaders() {
+int HttpNetworkTransaction::HandleConnectionClosedBeforeEndOfHeaders() {
if (establishing_tunnel_) {
- // The socket was closed before the tunnel could be established.
+ // The connection was closed before the tunnel could be established.
return ERR_TUNNEL_CONNECTION_FAILED;
}
@@ -619,9 +619,8 @@ int HttpNetworkTransaction::HandleSocketClosedBeforeReadingEndOfHeaders() {
// a partial HTTP/1.x response.
if (header_buf_len_ == 0) {
- // The connection was closed before any data was sent. This could have
- // been intended as a HTTP/0.9 response with no data, but more likely
- // than not it represents an error.
+ // The connection was closed before any data was sent. Likely an error
+ // rather than empty HTTP/0.9 response.
return ERR_EMPTY_RESPONSE;
}
@@ -645,7 +644,7 @@ int HttpNetworkTransaction::DoReadHeadersComplete(int result) {
// The socket was closed before we found end-of-headers.
if (result == 0) {
- int rv = HandleSocketClosedBeforeReadingEndOfHeaders();
+ int rv = HandleConnectionClosedBeforeEndOfHeaders();
if (rv != OK)
return rv;
} else {
diff --git a/net/http/http_network_transaction.h b/net/http/http_network_transaction.h
index c686cd6..a075e06 100644
--- a/net/http/http_network_transaction.h
+++ b/net/http/http_network_transaction.h
@@ -109,8 +109,9 @@ class HttpNetworkTransaction : public HttpTransaction {
int ReconsiderProxyAfterError(int error);
// Decides the policy when the connection is closed before the end of headers
- // has been reached.
- int HandleSocketClosedBeforeReadingEndOfHeaders();
+ // has been read. This only applies to reading responses, and not writing
+ // requests.
+ int HandleConnectionClosedBeforeEndOfHeaders();
// Return true if based on the bytes read so far, the start of the
// status line is known. This is used to distingish between HTTP/0.9
diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc
index b421d3c..2f63d86 100644
--- a/net/http/http_network_transaction_unittest.cc
+++ b/net/http/http_network_transaction_unittest.cc
@@ -223,6 +223,12 @@ class HttpNetworkTransactionTest : public PlatformTest {
mock_sockets_index = 0;
}
+ virtual void TearDown() {
+ // Empty the current queue.
+ MessageLoop::current()->RunAllPending();
+ PlatformTest::TearDown();
+ }
+
protected:
void KeepAliveConnectionResendRequestTest(const MockRead& read_failure);
};
@@ -269,9 +275,6 @@ SimpleGetHelperResult SimpleGetHelper(MockRead data_reads[]) {
trans->Destroy();
- // Empty the current queue.
- MessageLoop::current()->RunAllPending();
-
return out;
}
@@ -434,9 +437,6 @@ TEST_F(HttpNetworkTransactionTest, ReuseConnection) {
EXPECT_EQ(kExpectedResponseData[i], response_data);
trans->Destroy();
-
- // Empty the current queue.
- MessageLoop::current()->RunAllPending();
}
}
@@ -482,9 +482,6 @@ TEST_F(HttpNetworkTransactionTest, Ignores100) {
EXPECT_EQ("hello world", response_data);
trans->Destroy();
-
- // Empty the current queue.
- MessageLoop::current()->RunAllPending();
}
// read_failure specifies a read failure that should cause the network
@@ -544,9 +541,6 @@ void HttpNetworkTransactionTest::KeepAliveConnectionResendRequestTest(
EXPECT_EQ(kExpectedResponseData[i], response_data);
trans->Destroy();
-
- // Empty the current queue.
- MessageLoop::current()->RunAllPending();
}
}
@@ -592,9 +586,6 @@ TEST_F(HttpNetworkTransactionTest, NonKeepAliveConnectionReset) {
EXPECT_TRUE(response == NULL);
trans->Destroy();
-
- // Empty the current queue.
- MessageLoop::current()->RunAllPending();
}
// What do various browsers do when the server closes a non-keepalive
@@ -614,7 +605,7 @@ TEST_F(HttpNetworkTransactionTest, NonKeepAliveConnectionEOF) {
MockRead(false, net::OK),
};
SimpleGetHelperResult out = SimpleGetHelper(data_reads);
- EXPECT_EQ(out.rv, net::ERR_EMPTY_RESPONSE);
+ EXPECT_EQ(net::ERR_EMPTY_RESPONSE, out.rv);
}
// Test the request-challenge-retry sequence for basic auth.
@@ -700,9 +691,6 @@ TEST_F(HttpNetworkTransactionTest, BasicAuth) {
EXPECT_EQ(100, response->headers->GetContentLength());
trans->Destroy();
-
- // Empty the current queue.
- MessageLoop::current()->RunAllPending();
}
// Test the flow when both the proxy server AND origin server require
@@ -836,7 +824,4 @@ TEST_F(HttpNetworkTransactionTest, BasicAuthProxyThenServer) {
EXPECT_EQ(100, response->headers->GetContentLength());
trans->Destroy();
-
- // Empty the current queue.
- MessageLoop::current()->RunAllPending();
}