| 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 15 matching lines...) Expand all Loading... |
| 26 #include "base/string_util.h" | 26 #include "base/string_util.h" |
| 27 #include "base/stringprintf.h" | 27 #include "base/stringprintf.h" |
| 28 #include "base/synchronization/condition_variable.h" | 28 #include "base/synchronization/condition_variable.h" |
| 29 #include "base/synchronization/lock.h" | 29 #include "base/synchronization/lock.h" |
| 30 #include "base/threading/thread_checker.h" | 30 #include "base/threading/thread_checker.h" |
| 31 #include "base/time.h" | 31 #include "base/time.h" |
| 32 #include "googleurl/src/gurl.h" | 32 #include "googleurl/src/gurl.h" |
| 33 #include "net/base/host_port_pair.h" | 33 #include "net/base/host_port_pair.h" |
| 34 #include "net/base/io_buffer.h" | 34 #include "net/base/io_buffer.h" |
| 35 #include "net/base/load_flags.h" | 35 #include "net/base/load_flags.h" |
| 36 #include "net/base/upload_data.h" |
| 36 #include "net/http/http_request_headers.h" | 37 #include "net/http/http_request_headers.h" |
| 37 #include "net/http/http_response_headers.h" | 38 #include "net/http/http_response_headers.h" |
| 38 #include "net/url_request/url_request.h" | 39 #include "net/url_request/url_request.h" |
| 39 #include "net/url_request/url_request_context.h" | 40 #include "net/url_request/url_request_context.h" |
| 40 | 41 |
| 41 namespace net { | 42 namespace net { |
| 42 | 43 |
| 43 namespace { | 44 namespace { |
| 44 | 45 |
| 45 // Protects |g_request_context|. | 46 // Protects |g_request_context|. |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 request_->set_load_flags(LOAD_DISABLE_CACHE | LOAD_DO_NOT_SAVE_COOKIES | | 395 request_->set_load_flags(LOAD_DISABLE_CACHE | LOAD_DO_NOT_SAVE_COOKIES | |
| 395 LOAD_DO_NOT_SEND_COOKIES); | 396 LOAD_DO_NOT_SEND_COOKIES); |
| 396 | 397 |
| 397 if (http_request_method_ == "POST") { | 398 if (http_request_method_ == "POST") { |
| 398 DCHECK(!upload_content_.empty()); | 399 DCHECK(!upload_content_.empty()); |
| 399 DCHECK(!upload_content_type_.empty()); | 400 DCHECK(!upload_content_type_.empty()); |
| 400 | 401 |
| 401 request_->set_method("POST"); | 402 request_->set_method("POST"); |
| 402 extra_request_headers_.SetHeader( | 403 extra_request_headers_.SetHeader( |
| 403 HttpRequestHeaders::kContentType, upload_content_type_); | 404 HttpRequestHeaders::kContentType, upload_content_type_); |
| 404 request_->AppendBytesToUpload(upload_content_.data(), | 405 |
| 405 static_cast<int>(upload_content_.size())); | 406 scoped_refptr<UploadData> upload_data(new UploadData()); |
| 407 upload_data->AppendBytes(upload_content_.data(), upload_content_.size()); |
| 408 request_->set_upload(upload_data); |
| 406 } | 409 } |
| 407 if (!extra_request_headers_.IsEmpty()) | 410 if (!extra_request_headers_.IsEmpty()) |
| 408 request_->SetExtraRequestHeaders(extra_request_headers_); | 411 request_->SetExtraRequestHeaders(extra_request_headers_); |
| 409 | 412 |
| 410 request_->Start(); | 413 request_->Start(); |
| 411 AddRef(); // Release after |request_| deleted. | 414 AddRef(); // Release after |request_| deleted. |
| 412 } | 415 } |
| 413 | 416 |
| 414 GURL url_; // The URL we eventually wound up at | 417 GURL url_; // The URL we eventually wound up at |
| 415 std::string http_request_method_; | 418 std::string http_request_method_; |
| (...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 956 void SetURLRequestContextForNSSHttpIO(URLRequestContext* request_context) { | 959 void SetURLRequestContextForNSSHttpIO(URLRequestContext* request_context) { |
| 957 pthread_mutex_lock(&g_request_context_lock); | 960 pthread_mutex_lock(&g_request_context_lock); |
| 958 if (request_context) { | 961 if (request_context) { |
| 959 DCHECK(!g_request_context); | 962 DCHECK(!g_request_context); |
| 960 } | 963 } |
| 961 g_request_context = request_context; | 964 g_request_context = request_context; |
| 962 pthread_mutex_unlock(&g_request_context_lock); | 965 pthread_mutex_unlock(&g_request_context_lock); |
| 963 } | 966 } |
| 964 | 967 |
| 965 } // namespace net | 968 } // namespace net |
| OLD | NEW |