xref: /aosp_15_r20/system/update_engine/common/http_fetcher.cc (revision 5a9231315b4521097b8dc3750bc806fcafe0c72f)
1 //
2 // Copyright (C) 2009 The Android Open Source Project
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //      http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #include "update_engine/common/http_fetcher.h"
18 
19 #include <base/bind.h>
20 
21 using base::Closure;
22 using brillo::MessageLoop;
23 using std::deque;
24 using std::string;
25 
26 namespace chromeos_update_engine {
27 
~HttpFetcher()28 HttpFetcher::~HttpFetcher() {}
29 
SetPostData(const void * data,size_t size,HttpContentType type)30 void HttpFetcher::SetPostData(const void* data,
31                               size_t size,
32                               HttpContentType type) {
33   post_data_set_ = true;
34   post_data_.clear();
35   const char* char_data = reinterpret_cast<const char*>(data);
36   post_data_.insert(post_data_.end(), char_data, char_data + size);
37   post_content_type_ = type;
38 }
39 
SetPostData(const void * data,size_t size)40 void HttpFetcher::SetPostData(const void* data, size_t size) {
41   SetPostData(data, size, kHttpContentTypeUnspecified);
42 }
43 
44 }  // namespace chromeos_update_engine
45