summaryrefslogtreecommitdiffstats
path: root/net/ocsp
diff options
context:
space:
mode:
authorhashimoto@chromium.org <hashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-15 20:28:28 +0000
committerhashimoto@chromium.org <hashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-15 20:28:28 +0000
commitf288ef0df0a231d3abf9c9afed4b1d17f7b4e12d (patch)
tree31e2abbd97fd38151b1026258411e3732764f99a /net/ocsp
parentfbd5c8ac9e5ee6d101295deceaa089f063c4f535 (diff)
downloadchromium_src-f288ef0df0a231d3abf9c9afed4b1d17f7b4e12d.zip
chromium_src-f288ef0df0a231d3abf9c9afed4b1d17f7b4e12d.tar.gz
chromium_src-f288ef0df0a231d3abf9c9afed4b1d17f7b4e12d.tar.bz2
net: Change argument of URLRequest::set_upload from UploadData to UploadDataStream
Users of URLRequest are now responsible to create UploadDataStream. UploadOwnedBytesElementReader is moved from upload_data_stream.cc to upload_bytes_element_reader.h. BUG=156574 TEST=net_unittests and git try TBR=abodenha@chromium.org for cloud_print/service/service_state.cc Review URL: https://chromiumcodereview.appspot.com/11439008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@173318 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/ocsp')
-rw-r--r--net/ocsp/nss_ocsp.cc16
1 files changed, 11 insertions, 5 deletions
diff --git a/net/ocsp/nss_ocsp.cc b/net/ocsp/nss_ocsp.cc
index 3caff5d..f122841 100644
--- a/net/ocsp/nss_ocsp.cc
+++ b/net/ocsp/nss_ocsp.cc
@@ -33,7 +33,8 @@
#include "net/base/host_port_pair.h"
#include "net/base/io_buffer.h"
#include "net/base/load_flags.h"
-#include "net/base/upload_data.h"
+#include "net/base/upload_bytes_element_reader.h"
+#include "net/base/upload_data_stream.h"
#include "net/http/http_request_headers.h"
#include "net/http/http_response_headers.h"
#include "net/url_request/url_request.h"
@@ -190,6 +191,8 @@ class OCSPRequestSession
void SetPostData(const char* http_data, PRUint32 http_data_len,
const char* http_content_type) {
+ // |upload_content_| should not be modified if |request_| is active.
+ DCHECK(!request_);
upload_content_.assign(http_data, http_data_len);
upload_content_type_.assign(http_content_type);
}
@@ -403,9 +406,10 @@ class OCSPRequestSession
extra_request_headers_.SetHeader(
HttpRequestHeaders::kContentType, upload_content_type_);
- scoped_refptr<UploadData> upload_data(new UploadData());
- upload_data->AppendBytes(upload_content_.data(), upload_content_.size());
- request_->set_upload(upload_data);
+ scoped_ptr<UploadElementReader> reader(new UploadBytesElementReader(
+ upload_content_.data(), upload_content_.size()));
+ request_->set_upload(make_scoped_ptr(
+ UploadDataStream::CreateWithReader(reader.Pass(), 0)));
}
if (!extra_request_headers_.IsEmpty())
request_->SetExtraRequestHeaders(extra_request_headers_);
@@ -420,7 +424,9 @@ class OCSPRequestSession
URLRequest* request_; // The actual request this wraps
scoped_refptr<IOBuffer> buffer_; // Read buffer
HttpRequestHeaders extra_request_headers_;
- std::string upload_content_; // HTTP POST payload
+
+ // HTTP POST payload. |request_| reads bytes from this.
+ std::string upload_content_;
std::string upload_content_type_; // MIME type of POST payload
int response_code_; // HTTP status code for the request