| Index: content/child/web_url_request_util.cc
|
| diff --git a/content/child/web_url_request_util.cc b/content/child/web_url_request_util.cc
|
| index 5a5bc9ff1b279f901b3d0b6d3e6e1bf9c8d73be3..5d51dcb72c6332b5fb1b5c66867f18b048c6733b 100644
|
| --- a/content/child/web_url_request_util.cc
|
| +++ b/content/child/web_url_request_util.cc
|
| @@ -229,38 +229,40 @@ int GetLoadFlagsForWebURLRequest(const blink::WebURLRequest& request) {
|
| }
|
|
|
| scoped_refptr<ResourceRequestBody> GetRequestBodyForWebURLRequest(
|
| - const blink::WebURLRequest& request) {
|
| - scoped_refptr<ResourceRequestBody> request_body;
|
| + const blink::WebURLRequest& request,
|
| + RequestBodyType type) {
|
| + scoped_refptr<ResourceRequestBody> body_to_return;
|
|
|
| - if (request.httpBody().isNull()) {
|
| - return request_body;
|
| - }
|
| + const WebHTTPBody& body =
|
| + type == HTTP_BODY ? request.httpBody() : request.attachedCredentialBody();
|
| +
|
| + if (body.isNull())
|
| + return body_to_return;
|
|
|
| const std::string& method = request.httpMethod().latin1();
|
| // GET and HEAD requests shouldn't have http bodies.
|
| DCHECK(method != "GET" && method != "HEAD");
|
|
|
| - const WebHTTPBody& httpBody = request.httpBody();
|
| - request_body = new ResourceRequestBody();
|
| + body_to_return = new ResourceRequestBody();
|
| size_t i = 0;
|
| WebHTTPBody::Element element;
|
| - while (httpBody.elementAt(i++, element)) {
|
| + while (body.elementAt(i++, element)) {
|
| switch (element.type) {
|
| case WebHTTPBody::Element::TypeData:
|
| if (!element.data.isEmpty()) {
|
| // Blink sometimes gives empty data to append. These aren't
|
| // necessary so they are just optimized out here.
|
| - request_body->AppendBytes(
|
| - element.data.data(), static_cast<int>(element.data.size()));
|
| + body_to_return->AppendBytes(element.data.data(),
|
| + static_cast<int>(element.data.size()));
|
| }
|
| break;
|
| case WebHTTPBody::Element::TypeFile:
|
| if (element.fileLength == -1) {
|
| - request_body->AppendFileRange(
|
| + body_to_return->AppendFileRange(
|
| blink::WebStringToFilePath(element.filePath), 0,
|
| std::numeric_limits<uint64_t>::max(), base::Time());
|
| } else {
|
| - request_body->AppendFileRange(
|
| + body_to_return->AppendFileRange(
|
| blink::WebStringToFilePath(element.filePath),
|
| static_cast<uint64_t>(element.fileStart),
|
| static_cast<uint64_t>(element.fileLength),
|
| @@ -270,21 +272,21 @@ scoped_refptr<ResourceRequestBody> GetRequestBodyForWebURLRequest(
|
| case WebHTTPBody::Element::TypeFileSystemURL: {
|
| GURL file_system_url = element.fileSystemURL;
|
| DCHECK(file_system_url.SchemeIsFileSystem());
|
| - request_body->AppendFileSystemFileRange(
|
| + body_to_return->AppendFileSystemFileRange(
|
| file_system_url, static_cast<uint64_t>(element.fileStart),
|
| static_cast<uint64_t>(element.fileLength),
|
| base::Time::FromDoubleT(element.modificationTime));
|
| break;
|
| }
|
| case WebHTTPBody::Element::TypeBlob:
|
| - request_body->AppendBlob(element.blobUUID.utf8());
|
| + body_to_return->AppendBlob(element.blobUUID.utf8());
|
| break;
|
| default:
|
| NOTREACHED();
|
| }
|
| }
|
| - request_body->set_identifier(request.httpBody().identifier());
|
| - return request_body;
|
| + body_to_return->set_identifier(body.identifier());
|
| + return body_to_return;
|
| }
|
|
|
| #define STATIC_ASSERT_ENUM(a, b) \
|
|
|