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

Side by Side Diff: net/url_request/url_request_unittest.cc

Issue 770343003: Block port 443 for all protocols other than HTTPS or WSS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add link to issue in comment next to port 443 on the (default) blocked list. Created 6 years 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
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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <shlobj.h> 9 #include <shlobj.h>
10 #endif 10 #endif
(...skipping 5417 matching lines...) Expand 10 before | Expand all | Expand 10 after
5428 req->Start(); 5428 req->Start();
5429 base::RunLoop().Run(); 5429 base::RunLoop().Run();
5430 5430
5431 EXPECT_EQ(URLRequestStatus::SUCCESS, req->status().status()); 5431 EXPECT_EQ(URLRequestStatus::SUCCESS, req->status().status());
5432 EXPECT_FALSE(req->was_cached()); 5432 EXPECT_FALSE(req->was_cached());
5433 EXPECT_EQ(0, d.received_redirect_count()); 5433 EXPECT_EQ(0, d.received_redirect_count());
5434 EXPECT_EQ(initial_url, req->url()); 5434 EXPECT_EQ(initial_url, req->url());
5435 } 5435 }
5436 } 5436 }
5437 5437
5438 // Make sure an HTTP request using the "unsafe" port 443 fails.
5439 // See: https://crbug.com/436451
5440 TEST_F(URLRequestTestHTTP, UnsafePort) {
5441 TestDelegate d;
5442 {
5443 scoped_ptr<URLRequest> r(default_context_.CreateRequest(
5444 GURL("http://www.google.com:443/"), DEFAULT_PRIORITY, &d, NULL));
5445
5446 r->Start();
5447 EXPECT_TRUE(r->is_pending());
5448
5449 base::RunLoop().Run();
5450
5451 EXPECT_FALSE(r->is_pending());
5452 EXPECT_EQ(URLRequestStatus::FAILED, r->status().status());
5453 EXPECT_EQ(ERR_UNSAFE_PORT, r->status().error());
5454 }
5455 }
5456
5438 // Tests that redirection to an unsafe URL is allowed when it has been marked as 5457 // Tests that redirection to an unsafe URL is allowed when it has been marked as
5439 // safe. 5458 // safe.
5440 TEST_F(URLRequestTestHTTP, UnsafeRedirectToWhitelistedUnsafeURL) { 5459 TEST_F(URLRequestTestHTTP, UnsafeRedirectToWhitelistedUnsafeURL) {
5441 ASSERT_TRUE(test_server_.Start()); 5460 ASSERT_TRUE(test_server_.Start());
5442 5461
5443 GURL unsafe_url("data:text/html,this-is-considered-an-unsafe-url"); 5462 GURL unsafe_url("data:text/html,this-is-considered-an-unsafe-url");
5444 default_network_delegate_.set_redirect_on_headers_received_url(unsafe_url); 5463 default_network_delegate_.set_redirect_on_headers_received_url(unsafe_url);
5445 default_network_delegate_.set_allowed_unsafe_redirect_url(unsafe_url); 5464 default_network_delegate_.set_allowed_unsafe_redirect_url(unsafe_url);
5446 5465
5447 TestDelegate d; 5466 TestDelegate d;
(...skipping 3367 matching lines...) Expand 10 before | Expand all | Expand 10 after
8815 8834
8816 EXPECT_FALSE(r->is_pending()); 8835 EXPECT_FALSE(r->is_pending());
8817 EXPECT_EQ(1, d->response_started_count()); 8836 EXPECT_EQ(1, d->response_started_count());
8818 EXPECT_FALSE(d->received_data_before_response()); 8837 EXPECT_FALSE(d->received_data_before_response());
8819 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size)); 8838 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size));
8820 } 8839 }
8821 } 8840 }
8822 #endif // !defined(DISABLE_FTP_SUPPORT) 8841 #endif // !defined(DISABLE_FTP_SUPPORT)
8823 8842
8824 } // namespace net 8843 } // namespace net
OLDNEW
« net/base/net_util.cc ('K') | « net/http/http_stream_factory_impl_job.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698