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

Side by Side Diff: net/test/embedded_test_server/embedded_test_server.cc

Issue 1518613002: Support for server session cache. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@client_certs
Patch Set: Rebase only Created 4 years, 11 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
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/test/embedded_test_server/embedded_test_server.h" 5 #include "net/test/embedded_test_server/embedded_test_server.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 std::vector<std::string> headers; 285 std::vector<std::string> headers;
286 headers.push_back("PRIVATE KEY"); 286 headers.push_back("PRIVATE KEY");
287 PEMTokenizer pem_tokenizer(key_string, headers); 287 PEMTokenizer pem_tokenizer(key_string, headers);
288 pem_tokenizer.GetNext(); 288 pem_tokenizer.GetNext();
289 std::vector<uint8_t> key_vector; 289 std::vector<uint8_t> key_vector;
290 key_vector.assign(pem_tokenizer.data().begin(), pem_tokenizer.data().end()); 290 key_vector.assign(pem_tokenizer.data().begin(), pem_tokenizer.data().end());
291 291
292 scoped_ptr<crypto::RSAPrivateKey> server_key( 292 scoped_ptr<crypto::RSAPrivateKey> server_key(
293 crypto::RSAPrivateKey::CreateFromPrivateKeyInfo(key_vector)); 293 crypto::RSAPrivateKey::CreateFromPrivateKeyInfo(key_vector));
294 294
295 return CreateSSLServerSocket(std::move(connection), GetCertificate().get(), 295 scoped_ptr<SSLServerSocketContext> context = CreateSSLServerSocketContext(
296 *server_key, ssl_config_); 296 GetCertificate().get(), *server_key, ssl_config_);
297
298 return context->CreateSSLServerSocket(std::move(connection));
davidben 2016/01/22 23:57:48 The socket should not outlive the context, nor sho
ryanchung 2016/01/29 23:28:16 I moved the context creation to InitializeAndListe
297 } 299 }
298 300
299 void EmbeddedTestServer::DoAcceptLoop() { 301 void EmbeddedTestServer::DoAcceptLoop() {
300 int rv = OK; 302 int rv = OK;
301 while (rv == OK) { 303 while (rv == OK) {
302 rv = listen_socket_->Accept( 304 rv = listen_socket_->Accept(
303 &accepted_socket_, base::Bind(&EmbeddedTestServer::OnAcceptCompleted, 305 &accepted_socket_, base::Bind(&EmbeddedTestServer::OnAcceptCompleted,
304 base::Unretained(this))); 306 base::Unretained(this)));
305 if (rv == ERR_IO_PENDING) 307 if (rv == ERR_IO_PENDING)
306 return; 308 return;
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 run_loop.QuitClosure())) { 424 run_loop.QuitClosure())) {
423 return false; 425 return false;
424 } 426 }
425 run_loop.Run(); 427 run_loop.Run();
426 428
427 return true; 429 return true;
428 } 430 }
429 431
430 } // namespace test_server 432 } // namespace test_server
431 } // namespace net 433 } // namespace net
OLDNEW
« net/socket/ssl_server_socket_unittest.cc ('K') | « net/ssl/ssl_server_config.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698