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

Side by Side Diff: net/ocsp/nss_ocsp.cc

Issue 11439008: net: Change argument of URLRequest::set_upload from UploadData to UploadDataStream (Closed) Base URL: http://git.chromium.org/chromium/src.git@chunk
Patch Set: Add comment about shareable file ownership Created 8 years 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
« no previous file with comments | « net/base/upload_file_element_reader.h ('k') | net/url_request/url_fetcher_core.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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
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/base/upload_bytes_element_reader.h"
37 #include "net/base/upload_data_stream.h"
37 #include "net/http/http_request_headers.h" 38 #include "net/http/http_request_headers.h"
38 #include "net/http/http_response_headers.h" 39 #include "net/http/http_response_headers.h"
39 #include "net/url_request/url_request.h" 40 #include "net/url_request/url_request.h"
40 #include "net/url_request/url_request_context.h" 41 #include "net/url_request/url_request_context.h"
41 42
42 namespace net { 43 namespace net {
43 44
44 namespace { 45 namespace {
45 46
46 // Protects |g_request_context|. 47 // Protects |g_request_context|.
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 LOAD_DO_NOT_SEND_COOKIES); 397 LOAD_DO_NOT_SEND_COOKIES);
397 398
398 if (http_request_method_ == "POST") { 399 if (http_request_method_ == "POST") {
399 DCHECK(!upload_content_.empty()); 400 DCHECK(!upload_content_.empty());
400 DCHECK(!upload_content_type_.empty()); 401 DCHECK(!upload_content_type_.empty());
401 402
402 request_->set_method("POST"); 403 request_->set_method("POST");
403 extra_request_headers_.SetHeader( 404 extra_request_headers_.SetHeader(
404 HttpRequestHeaders::kContentType, upload_content_type_); 405 HttpRequestHeaders::kContentType, upload_content_type_);
405 406
406 scoped_refptr<UploadData> upload_data(new UploadData()); 407 scoped_ptr<UploadElementReader> reader(new UploadBytesElementReader(
407 upload_data->AppendBytes(upload_content_.data(), upload_content_.size()); 408 upload_content_.data(), upload_content_.size()));
408 request_->set_upload(upload_data); 409 request_->set_upload(make_scoped_ptr(
410 UploadDataStream::CreateWithReader(reader.Pass(), 0)));
409 } 411 }
410 if (!extra_request_headers_.IsEmpty()) 412 if (!extra_request_headers_.IsEmpty())
411 request_->SetExtraRequestHeaders(extra_request_headers_); 413 request_->SetExtraRequestHeaders(extra_request_headers_);
412 414
413 request_->Start(); 415 request_->Start();
414 AddRef(); // Release after |request_| deleted. 416 AddRef(); // Release after |request_| deleted.
415 } 417 }
416 418
417 GURL url_; // The URL we eventually wound up at 419 GURL url_; // The URL we eventually wound up at
418 std::string http_request_method_; 420 std::string http_request_method_;
419 base::TimeDelta timeout_; // The timeout for OCSP 421 base::TimeDelta timeout_; // The timeout for OCSP
420 URLRequest* request_; // The actual request this wraps 422 URLRequest* request_; // The actual request this wraps
mmenke 2012/12/13 16:44:40 Think it's worth mentioning that if upload_content
hashimoto 2012/12/13 17:39:12 Seems DCHECK(!request_) in the dtor guarantees tha
mmenke 2012/12/13 17:42:12 You're right that it currently does - I'm just bei
421 scoped_refptr<IOBuffer> buffer_; // Read buffer 423 scoped_refptr<IOBuffer> buffer_; // Read buffer
422 HttpRequestHeaders extra_request_headers_; 424 HttpRequestHeaders extra_request_headers_;
423 std::string upload_content_; // HTTP POST payload 425 std::string upload_content_; // HTTP POST payload
424 std::string upload_content_type_; // MIME type of POST payload 426 std::string upload_content_type_; // MIME type of POST payload
425 427
426 int response_code_; // HTTP status code for the request 428 int response_code_; // HTTP status code for the request
427 std::string response_content_type_; 429 std::string response_content_type_;
428 scoped_refptr<HttpResponseHeaders> response_headers_; 430 scoped_refptr<HttpResponseHeaders> response_headers_;
429 std::string data_; // Results of the request 431 std::string data_; // Results of the request
430 432
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
959 void SetURLRequestContextForNSSHttpIO(URLRequestContext* request_context) { 961 void SetURLRequestContextForNSSHttpIO(URLRequestContext* request_context) {
960 pthread_mutex_lock(&g_request_context_lock); 962 pthread_mutex_lock(&g_request_context_lock);
961 if (request_context) { 963 if (request_context) {
962 DCHECK(!g_request_context); 964 DCHECK(!g_request_context);
963 } 965 }
964 g_request_context = request_context; 966 g_request_context = request_context;
965 pthread_mutex_unlock(&g_request_context_lock); 967 pthread_mutex_unlock(&g_request_context_lock);
966 } 968 }
967 969
968 } // namespace net 970 } // namespace net
OLDNEW
« no previous file with comments | « net/base/upload_file_element_reader.h ('k') | net/url_request/url_fetcher_core.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698