| OLD | NEW |
| 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/cert_net/nss_ocsp.h" | 5 #include "net/cert_net/nss_ocsp.h" |
| 6 | 6 |
| 7 #include <certt.h> | 7 #include <certt.h> |
| 8 #include <certdb.h> | 8 #include <certdb.h> |
| 9 #include <nspr.h> | 9 #include <nspr.h> |
| 10 #include <nss.h> | 10 #include <nss.h> |
| (...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 787 strcasecmp(mime_type, "application/x-x509-crl") == 0 || | 787 strcasecmp(mime_type, "application/x-x509-crl") == 0 || |
| 788 strcasecmp(mime_type, "application/pkix-crl") == 0; | 788 strcasecmp(mime_type, "application/pkix-crl") == 0; |
| 789 bool is_cert = | 789 bool is_cert = |
| 790 strcasecmp(mime_type, "application/x-x509-ca-cert") == 0 || | 790 strcasecmp(mime_type, "application/x-x509-ca-cert") == 0 || |
| 791 strcasecmp(mime_type, "application/x-x509-server-cert") == 0 || | 791 strcasecmp(mime_type, "application/x-x509-server-cert") == 0 || |
| 792 strcasecmp(mime_type, "application/pkix-cert") == 0 || | 792 strcasecmp(mime_type, "application/pkix-cert") == 0 || |
| 793 strcasecmp(mime_type, "application/pkcs7-mime") == 0; | 793 strcasecmp(mime_type, "application/pkcs7-mime") == 0; |
| 794 | 794 |
| 795 if (!is_cert && !is_crl && !is_ocsp) { | 795 if (!is_cert && !is_crl && !is_ocsp) { |
| 796 // We didn't get a hint from the MIME type, so do the best that we can. | 796 // We didn't get a hint from the MIME type, so do the best that we can. |
| 797 const std::string path = req->url().path(); | 797 const std::string path = req->url().path().as_string(); |
| 798 const std::string host = req->url().host(); | 798 const std::string host = req->url().host(); |
| 799 is_crl = strcasestr(path.c_str(), ".crl") != NULL; | 799 is_crl = strcasestr(path.c_str(), ".crl") != NULL; |
| 800 is_cert = strcasestr(path.c_str(), ".crt") != NULL || | 800 is_cert = strcasestr(path.c_str(), ".crt") != NULL || |
| 801 strcasestr(path.c_str(), ".p7c") != NULL || | 801 strcasestr(path.c_str(), ".p7c") != NULL || |
| 802 strcasestr(path.c_str(), ".cer") != NULL; | 802 strcasestr(path.c_str(), ".cer") != NULL; |
| 803 is_ocsp = strcasestr(host.c_str(), "ocsp") != NULL || | 803 is_ocsp = strcasestr(host.c_str(), "ocsp") != NULL || |
| 804 req->http_request_method() == "POST"; | 804 req->http_request_method() == "POST"; |
| 805 } | 805 } |
| 806 | 806 |
| 807 if (is_ocsp) { | 807 if (is_ocsp) { |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 964 void SetURLRequestContextForNSSHttpIO(URLRequestContext* request_context) { | 964 void SetURLRequestContextForNSSHttpIO(URLRequestContext* request_context) { |
| 965 pthread_mutex_lock(&g_request_context_lock); | 965 pthread_mutex_lock(&g_request_context_lock); |
| 966 if (request_context) { | 966 if (request_context) { |
| 967 DCHECK(!g_request_context); | 967 DCHECK(!g_request_context); |
| 968 } | 968 } |
| 969 g_request_context = request_context; | 969 g_request_context = request_context; |
| 970 pthread_mutex_unlock(&g_request_context_lock); | 970 pthread_mutex_unlock(&g_request_context_lock); |
| 971 } | 971 } |
| 972 | 972 |
| 973 } // namespace net | 973 } // namespace net |
| OLD | NEW |