27#ifndef _bes_http_CURL_UTILS_H_
28#define _bes_http_CURL_UTILS_H_ 1
38#include "EffectiveUrl.h"
52void http_get_and_write_resource(
const std::shared_ptr<http::url> &target_url,
int fd,
53 std::vector<std::string> *http_response_headers);
55void http_get(
const std::string &target_url, std::vector<char> &buf);
57bool http_head(
const std::string &target_url,
int tries = 3,
unsigned long wait_time_us = 1'000'000);
58void http_get(
const std::string &target_url, std::string &buf);
60void super_easy_perform(CURL *ceh);
63std::shared_ptr<http::EffectiveUrl> get_redirect_url(
const std::shared_ptr<http::url> &url);
65std::string filter_aws_url(
const std::string &eff_url);
67CURL *init(
const std::string &target_url,
const curl_slist *http_request_headers,
68 std::vector<std::string> *resp_hdrs);
70void set_error_buffer(CURL *ceh,
char *error_buffer);
72std::string get_netrc_filename();
74std::string get_cookie_filename();
76bool is_retryable(
const std::string &url);
78unsigned long max_redirects();
80std::string hyrax_user_agent();
82void eval_curl_easy_setopt_result(CURLcode result,
const std::string &msg_base,
const std::string &opt_name,
83 const char *ebuf,
const std::string &file,
unsigned int line);
85std::string get_range_arg_string(
const unsigned long long &offset,
const unsigned long long &size);
87std::string error_message(CURLcode response_code,
const char *error_buf);
89void read_data(CURL *c_handle);
91curl_slist *append_http_header(curl_slist *slist,
const std::string &header_name,
const std::string &value);
93curl_slist *add_edl_auth_headers(curl_slist *request_headers);
95curl_slist *sign_s3_url(
const std::string &target_url, http::AccessCredentials *ac, curl_slist *req_headers);
98curl_slist *sign_s3_url(
const std::shared_ptr<http::url> &target_url, http::AccessCredentials *ac,
99 curl_slist *req_headers);
101bool is_url_signed_for_s3(
const std::string &url);
102bool is_url_signed_for_s3(
const std::shared_ptr<http::url> &target_url);
Parse a URL into the protocol, host, path and query parts.
utility class for the HTTP catalog module