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

Side by Side Diff: net/http/http_proxy_client_socket_pool_spdy3_unittest.cc

Issue 15688012: net: don't process truncated headers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Only enforce this for HTTPS URLs. Created 7 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_proxy_client_socket_pool.h" 5 #include "net/http/http_proxy_client_socket_pool.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 arraysize(spdy_writes)); 472 arraysize(spdy_writes));
473 AddAuthToCache(); 473 AddAuthToCache();
474 474
475 int rv = handle_.Init("a", GetTunnelParams(), LOW, callback_.callback(), 475 int rv = handle_.Init("a", GetTunnelParams(), LOW, callback_.callback(),
476 &pool_, BoundNetLog()); 476 &pool_, BoundNetLog());
477 EXPECT_EQ(ERR_IO_PENDING, rv); 477 EXPECT_EQ(ERR_IO_PENDING, rv);
478 EXPECT_FALSE(handle_.is_initialized()); 478 EXPECT_FALSE(handle_.is_initialized());
479 EXPECT_FALSE(handle_.socket()); 479 EXPECT_FALSE(handle_.socket());
480 480
481 data_->RunFor(3); 481 data_->RunFor(3);
482 EXPECT_EQ(ERR_CONNECTION_CLOSED, callback_.WaitForResult()); 482 if (GetParam() == SPDY) {
483 // SPDY cannot process a headers block unless it's complete and so it
484 // returns ERR_CONNECTION_CLOSED in this case.
485 EXPECT_EQ(ERR_CONNECTION_CLOSED, callback_.WaitForResult());
486 } else {
487 EXPECT_EQ(ERR_HEADERS_TRUNCATED, callback_.WaitForResult());
488 }
483 EXPECT_FALSE(handle_.is_initialized()); 489 EXPECT_FALSE(handle_.is_initialized());
484 EXPECT_FALSE(handle_.socket()); 490 EXPECT_FALSE(handle_.socket());
485 } 491 }
486 492
487 TEST_P(HttpProxyClientSocketPoolSpdy3Test, TunnelSetupError) { 493 TEST_P(HttpProxyClientSocketPoolSpdy3Test, TunnelSetupError) {
488 MockWrite writes[] = { 494 MockWrite writes[] = {
489 MockWrite(ASYNC, 0, 495 MockWrite(ASYNC, 0,
490 "CONNECT www.google.com:443 HTTP/1.1\r\n" 496 "CONNECT www.google.com:443 HTTP/1.1\r\n"
491 "Host: www.google.com\r\n" 497 "Host: www.google.com\r\n"
492 "Proxy-Connection: keep-alive\r\n" 498 "Proxy-Connection: keep-alive\r\n"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 // Make sure Location header was included and correct. 615 // Make sure Location header was included and correct.
610 std::string location; 616 std::string location;
611 EXPECT_TRUE(headers->IsRedirect(&location)); 617 EXPECT_TRUE(headers->IsRedirect(&location));
612 EXPECT_EQ(location, redirectTarget); 618 EXPECT_EQ(location, redirectTarget);
613 } 619 }
614 } 620 }
615 621
616 // It would be nice to also test the timeouts in HttpProxyClientSocketPool. 622 // It would be nice to also test the timeouts in HttpProxyClientSocketPool.
617 623
618 } // namespace net 624 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698