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/ocsp/nss_ocsp.h" | 5 #include "net/ocsp/nss_ocsp.h" |
6 | 6 |
7 #include <certt.h> | 7 #include <certt.h> |
8 #include <certdb.h> | 8 #include <certdb.h> |
9 #include <ocsp.h> | 9 #include <ocsp.h> |
10 #include <nspr.h> | 10 #include <nspr.h> |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "base/threading/thread_checker.h" | 30 #include "base/threading/thread_checker.h" |
31 #include "base/time/time.h" | 31 #include "base/time/time.h" |
32 #include "net/base/host_port_pair.h" | 32 #include "net/base/host_port_pair.h" |
33 #include "net/base/io_buffer.h" | 33 #include "net/base/io_buffer.h" |
34 #include "net/base/load_flags.h" | 34 #include "net/base/load_flags.h" |
35 #include "net/base/request_priority.h" | 35 #include "net/base/request_priority.h" |
36 #include "net/base/upload_bytes_element_reader.h" | 36 #include "net/base/upload_bytes_element_reader.h" |
37 #include "net/base/upload_data_stream.h" | 37 #include "net/base/upload_data_stream.h" |
38 #include "net/http/http_request_headers.h" | 38 #include "net/http/http_request_headers.h" |
39 #include "net/http/http_response_headers.h" | 39 #include "net/http/http_response_headers.h" |
| 40 #include "net/url_request/redirect_info.h" |
40 #include "net/url_request/url_request.h" | 41 #include "net/url_request/url_request.h" |
41 #include "net/url_request/url_request_context.h" | 42 #include "net/url_request/url_request_context.h" |
42 #include "url/gurl.h" | 43 #include "url/gurl.h" |
43 | 44 |
44 namespace net { | 45 namespace net { |
45 | 46 |
46 namespace { | 47 namespace { |
47 | 48 |
48 // Protects |g_request_context|. | 49 // Protects |g_request_context|. |
49 pthread_mutex_t g_request_context_lock = PTHREAD_MUTEX_INITIALIZER; | 50 pthread_mutex_t g_request_context_lock = PTHREAD_MUTEX_INITIALIZER; |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 DCHECK(finished_); | 277 DCHECK(finished_); |
277 return response_headers_->raw_headers(); | 278 return response_headers_->raw_headers(); |
278 } | 279 } |
279 | 280 |
280 const std::string& http_response_data() const { | 281 const std::string& http_response_data() const { |
281 DCHECK(finished_); | 282 DCHECK(finished_); |
282 return data_; | 283 return data_; |
283 } | 284 } |
284 | 285 |
285 virtual void OnReceivedRedirect(URLRequest* request, | 286 virtual void OnReceivedRedirect(URLRequest* request, |
286 const GURL& new_url, | 287 const RedirectInfo& redirect_info, |
287 bool* defer_redirect) OVERRIDE { | 288 bool* defer_redirect) OVERRIDE { |
288 DCHECK_EQ(request, request_); | 289 DCHECK_EQ(request, request_); |
289 DCHECK_EQ(base::MessageLoopForIO::current(), io_loop_); | 290 DCHECK_EQ(base::MessageLoopForIO::current(), io_loop_); |
290 | 291 |
291 if (!new_url.SchemeIs("http")) { | 292 if (!redirect_info.new_url.SchemeIs("http")) { |
292 // Prevent redirects to non-HTTP schemes, including HTTPS. This matches | 293 // Prevent redirects to non-HTTP schemes, including HTTPS. This matches |
293 // the initial check in OCSPServerSession::CreateRequest(). | 294 // the initial check in OCSPServerSession::CreateRequest(). |
294 CancelURLRequest(); | 295 CancelURLRequest(); |
295 } | 296 } |
296 } | 297 } |
297 | 298 |
298 virtual void OnResponseStarted(URLRequest* request) OVERRIDE { | 299 virtual void OnResponseStarted(URLRequest* request) OVERRIDE { |
299 DCHECK_EQ(request, request_); | 300 DCHECK_EQ(request, request_); |
300 DCHECK_EQ(base::MessageLoopForIO::current(), io_loop_); | 301 DCHECK_EQ(base::MessageLoopForIO::current(), io_loop_); |
301 | 302 |
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
970 void SetURLRequestContextForNSSHttpIO(URLRequestContext* request_context) { | 971 void SetURLRequestContextForNSSHttpIO(URLRequestContext* request_context) { |
971 pthread_mutex_lock(&g_request_context_lock); | 972 pthread_mutex_lock(&g_request_context_lock); |
972 if (request_context) { | 973 if (request_context) { |
973 DCHECK(!g_request_context); | 974 DCHECK(!g_request_context); |
974 } | 975 } |
975 g_request_context = request_context; | 976 g_request_context = request_context; |
976 pthread_mutex_unlock(&g_request_context_lock); | 977 pthread_mutex_unlock(&g_request_context_lock); |
977 } | 978 } |
978 | 979 |
979 } // namespace net | 980 } // namespace net |
OLD | NEW |