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

Unified Diff: net/http/http_proxy_client_socket_pool_unittest.cc

Issue 25312002: net: don't preserve 1xx responses in parser buffer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: g try Created 7 years, 3 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
« no previous file with comments | « no previous file | net/http/http_stream_parser.h » ('j') | net/http/http_stream_parser.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_proxy_client_socket_pool_unittest.cc
diff --git a/net/http/http_proxy_client_socket_pool_unittest.cc b/net/http/http_proxy_client_socket_pool_unittest.cc
index a40c9da8138fcb954082bee32dfe719488963c6d..34cc5aa7bbcd98c46c758e0ea9f888eb5a6ad8ef 100644
--- a/net/http/http_proxy_client_socket_pool_unittest.cc
+++ b/net/http/http_proxy_client_socket_pool_unittest.cc
@@ -564,6 +564,39 @@ TEST_P(HttpProxyClientSocketPoolTest, TunnelUnexpectedClose) {
EXPECT_FALSE(handle_.socket());
}
+TEST_P(HttpProxyClientSocketPoolTest, Tunnel1xxResponse) {
+ // Tests that 1xx responses are rejected for a CONNECT request.
+ if (GetParam().proxy_type == SPDY) {
+ // SPDY doesn't have 1xx responses.
+ return;
+ }
+
+ MockWrite writes[] = {
+ MockWrite(ASYNC, 0,
+ "CONNECT www.google.com:443 HTTP/1.1\r\n"
+ "Host: www.google.com\r\n"
+ "Proxy-Connection: keep-alive\r\n"
+ "Proxy-Authorization: Basic Zm9vOmJhcg==\r\n\r\n"),
wtc 2013/10/01 18:12:57 Nit: Is the Proxy-Authorization header (and the Ad
agl 2013/10/01 19:53:18 Done.
+ };
+ MockRead reads[] = {
+ MockRead(ASYNC, 1, "HTTP/1.1 100 Continue\r\n\r\n"),
+ MockRead(ASYNC, 2, "HTTP/1.1 200 Connection Established\r\n\r\n"),
+ };
+
+ Initialize(reads, arraysize(reads), writes, arraysize(writes),
+ NULL, 0, NULL, 0);
+ AddAuthToCache();
+
+ int rv = handle_.Init("a", CreateTunnelParams(), LOW, callback_.callback(),
+ &pool_, BoundNetLog());
+ EXPECT_EQ(ERR_IO_PENDING, rv);
+ EXPECT_FALSE(handle_.is_initialized());
+ EXPECT_FALSE(handle_.socket());
+
+ data_->RunFor(2);
+ EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, callback_.WaitForResult());
+}
+
TEST_P(HttpProxyClientSocketPoolTest, TunnelSetupError) {
MockWrite writes[] = {
MockWrite(ASYNC, 0,
« no previous file with comments | « no previous file | net/http/http_stream_parser.h » ('j') | net/http/http_stream_parser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698