| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/ocsp/nss_ocsp.h" | 5 #include "net/ocsp/nss_ocsp.h" |
| 6 | 6 |
| 7 #include <certdb.h> |
| 7 #include <certt.h> | 8 #include <certt.h> |
| 8 #include <certdb.h> | |
| 9 #include <ocsp.h> | |
| 10 #include <nspr.h> | 9 #include <nspr.h> |
| 11 #include <nss.h> | 10 #include <nss.h> |
| 11 #include <ocsp.h> |
| 12 #include <secerr.h> | 12 #include <secerr.h> |
| 13 | 13 |
| 14 #include <string> | 14 #include <string> |
| 15 | 15 |
| 16 #include "base/compiler_specific.h" | 16 #include "base/compiler_specific.h" |
| 17 #include "base/condition_variable.h" | 17 #include "base/condition_variable.h" |
| 18 #include "base/histogram.h" | 18 #include "base/histogram.h" |
| 19 #include "base/logging.h" | 19 #include "base/logging.h" |
| 20 #include "base/message_loop.h" | 20 #include "base/message_loop.h" |
| 21 #include "base/singleton.h" | 21 #include "base/singleton.h" |
| 22 #include "base/string_util.h" | 22 #include "base/string_util.h" |
| 23 #include "base/stringprintf.h" |
| 23 #include "base/thread.h" | 24 #include "base/thread.h" |
| 24 #include "base/time.h" | 25 #include "base/time.h" |
| 25 #include "googleurl/src/gurl.h" | 26 #include "googleurl/src/gurl.h" |
| 26 #include "net/base/io_buffer.h" | 27 #include "net/base/io_buffer.h" |
| 27 #include "net/base/load_flags.h" | 28 #include "net/base/load_flags.h" |
| 28 #include "net/http/http_request_headers.h" | 29 #include "net/http/http_request_headers.h" |
| 29 #include "net/http/http_response_headers.h" | 30 #include "net/http/http_response_headers.h" |
| 30 #include "net/url_request/url_request.h" | 31 #include "net/url_request/url_request.h" |
| 31 #include "net/url_request/url_request_context.h" | 32 #include "net/url_request/url_request_context.h" |
| 32 | 33 |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 // We dont' support "https" because we haven't thought about | 442 // We dont' support "https" because we haven't thought about |
| 442 // whether it's safe to re-enter this code from talking to an OCSP | 443 // whether it's safe to re-enter this code from talking to an OCSP |
| 443 // responder over SSL. | 444 // responder over SSL. |
| 444 if (strcmp(http_protocol_variant, "http") != 0) { | 445 if (strcmp(http_protocol_variant, "http") != 0) { |
| 445 PORT_SetError(PR_NOT_IMPLEMENTED_ERROR); | 446 PORT_SetError(PR_NOT_IMPLEMENTED_ERROR); |
| 446 return NULL; | 447 return NULL; |
| 447 } | 448 } |
| 448 | 449 |
| 449 // TODO(ukai): If |host| is an IPv6 literal, we need to quote it with | 450 // TODO(ukai): If |host| is an IPv6 literal, we need to quote it with |
| 450 // square brackets []. | 451 // square brackets []. |
| 451 std::string url_string(StringPrintf("%s://%s:%d%s", | 452 std::string url_string(base::StringPrintf("%s://%s:%d%s", |
| 452 http_protocol_variant, | 453 http_protocol_variant, |
| 453 host_.c_str(), | 454 host_.c_str(), |
| 454 port_, | 455 port_, |
| 455 path_and_query_string)); | 456 path_and_query_string)); |
| 456 LOG(INFO) << "URL [" << url_string << "]"; | 457 LOG(INFO) << "URL [" << url_string << "]"; |
| 457 GURL url(url_string); | 458 GURL url(url_string); |
| 458 return new OCSPRequestSession( | 459 return new OCSPRequestSession( |
| 459 url, http_request_method, | 460 url, http_request_method, |
| 460 base::TimeDelta::FromMilliseconds(PR_IntervalToMilliseconds(timeout))); | 461 base::TimeDelta::FromMilliseconds(PR_IntervalToMilliseconds(timeout))); |
| 461 } | 462 } |
| 462 | 463 |
| 463 | 464 |
| 464 private: | 465 private: |
| 465 std::string host_; | 466 std::string host_; |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 789 // This function would be called before NSS initialization. | 790 // This function would be called before NSS initialization. |
| 790 void SetURLRequestContextForOCSP(URLRequestContext* request_context) { | 791 void SetURLRequestContextForOCSP(URLRequestContext* request_context) { |
| 791 OCSPInitSingleton::set_url_request_context(request_context); | 792 OCSPInitSingleton::set_url_request_context(request_context); |
| 792 } | 793 } |
| 793 | 794 |
| 794 URLRequestContext* GetURLRequestContextForOCSP() { | 795 URLRequestContext* GetURLRequestContextForOCSP() { |
| 795 return OCSPInitSingleton::url_request_context(); | 796 return OCSPInitSingleton::url_request_context(); |
| 796 } | 797 } |
| 797 | 798 |
| 798 } // namespace net | 799 } // namespace net |
| OLD | NEW |