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

Side by Side Diff: net/http/http_util.cc

Issue 6134003: Prototype of chunked transfer encoded POST. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 months 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 // The rules for parsing content-types were borrowed from Firefox: 5 // The rules for parsing content-types were borrowed from Firefox:
6 // http://lxr.mozilla.org/mozilla/source/netwerk/base/src/nsURLHelper.cpp#834 6 // http://lxr.mozilla.org/mozilla/source/netwerk/base/src/nsURLHelper.cpp#834
7 7
8 #include "net/http/http_util.h" 8 #include "net/http/http_util.h"
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 667
668 // Our consumer should have made sure that this is a safe referrer. See for 668 // Our consumer should have made sure that this is a safe referrer. See for
669 // instance WebCore::FrameLoader::HideReferrer. 669 // instance WebCore::FrameLoader::HideReferrer.
670 if (request_info->referrer.is_valid()) { 670 if (request_info->referrer.is_valid()) {
671 request_headers->SetHeader(HttpRequestHeaders::kReferer, 671 request_headers->SetHeader(HttpRequestHeaders::kReferer,
672 request_info->referrer.spec()); 672 request_info->referrer.spec());
673 } 673 }
674 674
675 // Add a content length header? 675 // Add a content length header?
676 if (upload_data_stream) { 676 if (upload_data_stream) {
677 request_headers->SetHeader( 677 if (upload_data_stream->is_chunked()) {
678 HttpRequestHeaders::kContentLength, 678 request_headers->SetHeader(
679 base::Uint64ToString(upload_data_stream->size())); 679 HttpRequestHeaders::kTransferEncoding, "Chunked");
wtc 2011/01/12 02:39:02 Use lowercase "chunked", which is the string used
Satish 2011/01/13 17:43:27 Done.
680 } else {
681 request_headers->SetHeader(
682 HttpRequestHeaders::kContentLength,
683 base::Uint64ToString(upload_data_stream->size()));
684 }
680 } else if (request_info->method == "POST" || request_info->method == "PUT" || 685 } else if (request_info->method == "POST" || request_info->method == "PUT" ||
681 request_info->method == "HEAD") { 686 request_info->method == "HEAD") {
682 // An empty POST/PUT request still needs a content length. As for HEAD, 687 // An empty POST/PUT request still needs a content length. As for HEAD,
683 // IE and Safari also add a content length header. Presumably it is to 688 // IE and Safari also add a content length header. Presumably it is to
684 // support sending a HEAD request to an URL that only expects to be sent a 689 // support sending a HEAD request to an URL that only expects to be sent a
685 // POST or some other method that normally would have a message body. 690 // POST or some other method that normally would have a message body.
686 request_headers->SetHeader(HttpRequestHeaders::kContentLength, "0"); 691 request_headers->SetHeader(HttpRequestHeaders::kContentLength, "0");
687 } 692 }
688 693
689 // Honor load flags that impact proxy caches. 694 // Honor load flags that impact proxy caches.
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 value_is_quoted_ = true; 866 value_is_quoted_ = true;
862 // Do not store iterators into this. See declaration of unquoted_value_. 867 // Do not store iterators into this. See declaration of unquoted_value_.
863 unquoted_value_ = HttpUtil::Unquote(value_begin_, value_end_); 868 unquoted_value_ = HttpUtil::Unquote(value_begin_, value_end_);
864 } 869 }
865 } 870 }
866 871
867 return true; 872 return true;
868 } 873 }
869 874
870 } // namespace net 875 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698