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

Side by Side Diff: content/common/net/url_fetcher_impl.cc

Issue 9342007: Add HTTP PUT request type to content:URLFetcher (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 10 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) 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 "content/common/net/url_fetcher_impl.h" 5 #include "content/common/net/url_fetcher_impl.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 break; 811 break;
812 812
813 case HEAD: 813 case HEAD:
814 request_->set_method("HEAD"); 814 request_->set_method("HEAD");
815 break; 815 break;
816 816
817 case DELETE_REQUEST: 817 case DELETE_REQUEST:
818 request_->set_method("DELETE"); 818 request_->set_method("DELETE");
819 break; 819 break;
820 820
821 case PUT:
wtc 2012/02/06 23:34:07 Let's list the PUT case right below the POST case
kuan 2012/02/06 23:58:17 Done.
822 DCHECK(!upload_content_.empty());
wtc 2012/02/06 23:34:07 I studied the Section 9.6 PUT in the HTTP 1.1 RFC
kuan 2012/02/06 23:58:17 Done. Since chunked encoding is also allowed for
823 DCHECK(!upload_content_type_.empty());
824
825 request_->set_method("PUT");
826 extra_request_headers_.SetHeader(net::HttpRequestHeaders::kContentType,
827 upload_content_type_);
828 request_->AppendBytesToUpload(
829 upload_content_.data(), static_cast<int>(upload_content_.length()));
830 break;
831
821 default: 832 default:
822 NOTREACHED(); 833 NOTREACHED();
823 } 834 }
824 835
825 if (!extra_request_headers_.IsEmpty()) 836 if (!extra_request_headers_.IsEmpty())
826 request_->SetExtraRequestHeaders(extra_request_headers_); 837 request_->SetExtraRequestHeaders(extra_request_headers_);
827 838
828 // There might be data left over from a previous request attempt. 839 // There might be data left over from a previous request attempt.
829 data_.clear(); 840 data_.clear();
830 841
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
968 int URLFetcherImpl::GetLoadFlags() const { 979 int URLFetcherImpl::GetLoadFlags() const {
969 return core_->load_flags_; 980 return core_->load_flags_;
970 } 981 }
971 982
972 void URLFetcherImpl::SetExtraRequestHeaders( 983 void URLFetcherImpl::SetExtraRequestHeaders(
973 const std::string& extra_request_headers) { 984 const std::string& extra_request_headers) {
974 core_->extra_request_headers_.Clear(); 985 core_->extra_request_headers_.Clear();
975 core_->extra_request_headers_.AddHeadersFromString(extra_request_headers); 986 core_->extra_request_headers_.AddHeadersFromString(extra_request_headers);
976 } 987 }
977 988
989 void URLFetcherImpl::AddRequestHeaderFromString(
990 const base::StringPiece& header_line) {
991 core_->extra_request_headers_.AddHeaderFromString(header_line);
992 }
993
978 void URLFetcherImpl::GetExtraRequestHeaders(net::HttpRequestHeaders* headers) { 994 void URLFetcherImpl::GetExtraRequestHeaders(net::HttpRequestHeaders* headers) {
979 headers->CopyFrom(core_->extra_request_headers_); 995 headers->CopyFrom(core_->extra_request_headers_);
980 } 996 }
981 997
982 void URLFetcherImpl::SetRequestContext( 998 void URLFetcherImpl::SetRequestContext(
983 net::URLRequestContextGetter* request_context_getter) { 999 net::URLRequestContextGetter* request_context_getter) {
984 DCHECK(!core_->request_context_getter_); 1000 DCHECK(!core_->request_context_getter_);
985 core_->request_context_getter_ = request_context_getter; 1001 core_->request_context_getter_ = request_context_getter;
986 } 1002 }
987 1003
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
1126 1142
1127 // static 1143 // static
1128 content::URLFetcherFactory* URLFetcherImpl::factory() { 1144 content::URLFetcherFactory* URLFetcherImpl::factory() {
1129 return g_factory; 1145 return g_factory;
1130 } 1146 }
1131 1147
1132 // static 1148 // static
1133 void URLFetcherImpl::set_factory(content::URLFetcherFactory* factory) { 1149 void URLFetcherImpl::set_factory(content::URLFetcherFactory* factory) {
1134 g_factory = factory; 1150 g_factory = factory;
1135 } 1151 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698