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

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

Issue 495663002: OpenSSL: Disable ECDSA cipher suites on Windows XP. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Bounce through testserver.py instead. Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/tools/testserver/testserver.py ('k') | third_party/tlslite/README.chromium » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 #include "net/http/http_byte_range.h" 54 #include "net/http/http_byte_range.h"
55 #include "net/http/http_cache.h" 55 #include "net/http/http_cache.h"
56 #include "net/http/http_network_layer.h" 56 #include "net/http/http_network_layer.h"
57 #include "net/http/http_network_session.h" 57 #include "net/http/http_network_session.h"
58 #include "net/http/http_request_headers.h" 58 #include "net/http/http_request_headers.h"
59 #include "net/http/http_response_headers.h" 59 #include "net/http/http_response_headers.h"
60 #include "net/http/http_util.h" 60 #include "net/http/http_util.h"
61 #include "net/ocsp/nss_ocsp.h" 61 #include "net/ocsp/nss_ocsp.h"
62 #include "net/proxy/proxy_service.h" 62 #include "net/proxy/proxy_service.h"
63 #include "net/socket/ssl_client_socket.h" 63 #include "net/socket/ssl_client_socket.h"
64 #include "net/ssl/ssl_cipher_suite_names.h"
64 #include "net/ssl/ssl_connection_status_flags.h" 65 #include "net/ssl/ssl_connection_status_flags.h"
65 #include "net/test/cert_test_util.h" 66 #include "net/test/cert_test_util.h"
66 #include "net/test/spawned_test_server/spawned_test_server.h" 67 #include "net/test/spawned_test_server/spawned_test_server.h"
67 #include "net/url_request/data_protocol_handler.h" 68 #include "net/url_request/data_protocol_handler.h"
68 #include "net/url_request/static_http_user_agent_settings.h" 69 #include "net/url_request/static_http_user_agent_settings.h"
69 #include "net/url_request/url_request.h" 70 #include "net/url_request/url_request.h"
70 #include "net/url_request/url_request_http_job.h" 71 #include "net/url_request/url_request_http_job.h"
71 #include "net/url_request/url_request_job_factory_impl.h" 72 #include "net/url_request/url_request_job_factory_impl.h"
72 #include "net/url_request/url_request_redirect_job.h" 73 #include "net/url_request/url_request_redirect_job.h"
73 #include "net/url_request/url_request_test_job.h" 74 #include "net/url_request/url_request_test_job.h"
(...skipping 6850 matching lines...) Expand 10 before | Expand all | Expand 10 after
6924 EXPECT_EQ("insert", parts[0]); 6925 EXPECT_EQ("insert", parts[0]);
6925 if (i == 0) { 6926 if (i == 0) {
6926 session_id = parts[1]; 6927 session_id = parts[1];
6927 } else { 6928 } else {
6928 EXPECT_NE(session_id, parts[1]); 6929 EXPECT_NE(session_id, parts[1]);
6929 } 6930 }
6930 } 6931 }
6931 } 6932 }
6932 } 6933 }
6933 6934
6935 #if defined(OS_WIN)
6936
6937 namespace {
6938
6939 bool IsECDSACipherSuite(uint16_t cipher_suite) {
6940 const char* key_exchange;
6941 const char* cipher;
6942 const char* mac;
6943 bool is_aead;
6944 SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead, cipher_suite);
6945 return std::string(key_exchange).find("ECDSA") != std::string::npos;
6946 }
6947
6948 } // namespace
6949
6950 // Test that ECDSA is disabled on Windows XP, where ECDSA certificates cannot be
6951 // verified.
6952 TEST_F(HTTPSRequestTest, DisableECDSAOnXP) {
6953 if (base::win::GetVersion() >= base::win::VERSION_VISTA) {
6954 LOG(INFO) << "Skipping test on this version.";
6955 return;
6956 }
6957
6958 SpawnedTestServer test_server(
6959 SpawnedTestServer::TYPE_HTTPS,
6960 SpawnedTestServer::kLocalhost,
6961 base::FilePath(FILE_PATH_LITERAL("net/data/ssl")));
6962 ASSERT_TRUE(test_server.Start());
6963
6964 TestDelegate d;
6965 scoped_ptr<URLRequest> r(default_context_.CreateRequest(
6966 test_server.GetURL("client-cipher-list"), DEFAULT_PRIORITY, &d, NULL));
6967 r->Start();
6968 EXPECT_TRUE(r->is_pending());
6969
6970 base::RunLoop().Run();
6971
6972 EXPECT_EQ(1, d.response_started_count());
6973 std::vector<std::string> lines;
6974 base::SplitString(d.data_received(), '\n', &lines);
6975
6976 for (size_t i = 0; i < lines.size(); i++) {
6977 int cipher_suite;
6978 ASSERT_TRUE(base::StringToInt(lines[i], &cipher_suite));
6979 EXPECT_FALSE(IsECDSACipherSuite(cipher_suite))
6980 << "ClientHello advertised " << std::hex << cipher_suite;
Ryan Sleevi 2014/09/03 19:08:58 Don't modify the stream like this if you don't res
davidben 2014/09/03 19:15:32 Done.
6981 }
6982 }
6983
6984 #endif // OS_WIN
6985
6934 class HTTPSFallbackTest : public testing::Test { 6986 class HTTPSFallbackTest : public testing::Test {
6935 public: 6987 public:
6936 HTTPSFallbackTest() : context_(true) { 6988 HTTPSFallbackTest() : context_(true) {
6937 context_.Init(); 6989 context_.Init();
6938 delegate_.set_allow_certificate_errors(true); 6990 delegate_.set_allow_certificate_errors(true);
6939 } 6991 }
6940 virtual ~HTTPSFallbackTest() {} 6992 virtual ~HTTPSFallbackTest() {}
6941 6993
6942 protected: 6994 protected:
6943 void DoFallbackTest(const SpawnedTestServer::SSLOptions& ssl_options) { 6995 void DoFallbackTest(const SpawnedTestServer::SSLOptions& ssl_options) {
(...skipping 1097 matching lines...) Expand 10 before | Expand all | Expand 10 after
8041 8093
8042 EXPECT_FALSE(r->is_pending()); 8094 EXPECT_FALSE(r->is_pending());
8043 EXPECT_EQ(1, d->response_started_count()); 8095 EXPECT_EQ(1, d->response_started_count());
8044 EXPECT_FALSE(d->received_data_before_response()); 8096 EXPECT_FALSE(d->received_data_before_response());
8045 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size)); 8097 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size));
8046 } 8098 }
8047 } 8099 }
8048 #endif // !defined(DISABLE_FTP_SUPPORT) 8100 #endif // !defined(DISABLE_FTP_SUPPORT)
8049 8101
8050 } // namespace net 8102 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/testserver/testserver.py ('k') | third_party/tlslite/README.chromium » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698