blob: 34caba4d5184c95133ce8fa3abe6d55c6d18f13d [file] [log] [blame]
Alex Deymoaea4c1c2015-08-19 20:24:43 -07001//
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//
Andrew de los Reyes45168102010-11-22 11:13:50 -080016
Alex Deymo39910dc2015-11-09 17:04:30 -080017#include "update_engine/common/http_fetcher.h"
Andrew de los Reyes45168102010-11-22 11:13:50 -080018
Alex Deymo60ca1a72015-06-18 18:19:15 -070019#include <base/bind.h>
20
Alex Vakulenko4906c1c2014-08-21 13:17:44 -070021using base::Closure;
Alex Vakulenko3f39d5c2015-10-13 09:27:13 -070022using brillo::MessageLoop;
Andrew de los Reyes45168102010-11-22 11:13:50 -080023using std::deque;
24using std::string;
25
26namespace chromeos_update_engine {
27
Kelvin Zhangc7a1d1f2022-07-29 13:36:29 -070028HttpFetcher::~HttpFetcher() {}
Andrew de los Reyesf3ed8e72011-02-16 10:35:46 -080029
Amin Hassanib2689592019-01-13 17:04:28 -080030void HttpFetcher::SetPostData(const void* data,
31 size_t size,
Gilad Arnold9dd1e7c2012-02-16 12:13:36 -080032 HttpContentType type) {
Andrew de los Reyes45168102010-11-22 11:13:50 -080033 post_data_set_ = true;
34 post_data_.clear();
Alex Deymo60ca1a72015-06-18 18:19:15 -070035 const char* char_data = reinterpret_cast<const char*>(data);
Andrew de los Reyes45168102010-11-22 11:13:50 -080036 post_data_.insert(post_data_.end(), char_data, char_data + size);
Gilad Arnold9dd1e7c2012-02-16 12:13:36 -080037 post_content_type_ = type;
38}
39
40void HttpFetcher::SetPostData(const void* data, size_t size) {
41 SetPostData(data, size, kHttpContentTypeUnspecified);
Andrew de los Reyes45168102010-11-22 11:13:50 -080042}
43
Andrew de los Reyes45168102010-11-22 11:13:50 -080044} // namespace chromeos_update_engine