mirror of
https://github.com/moparisthebest/curl
synced 2024-11-11 12:05:06 -05:00
796ce293de
- Add support services without region and service prefixes in the URL endpoint (ex. Min.IO, GCP, Yandex Cloud, Mail.Ru Cloud Solutions, etc) by providing region and service parameters via aws-sigv4 option. - Add [:region[:service]] suffix to aws-sigv4 option; - Fix memory allocation errors. - Refactor memory management. - Use Curl_http_method instead() STRING_CUSTOMREQUEST. - Refactor canonical headers generating. - Remove repeated sha256_to_hex() usage. - Add some docs fixes. - Add some codestyle fixes. - Add overloaded strndup() for debug - curl_dbg_strndup(). - Update tests. Closes #6524
98 lines
3.7 KiB
Groff
98 lines
3.7 KiB
Groff
.\" **************************************************************************
|
|
.\" * _ _ ____ _
|
|
.\" * Project ___| | | | _ \| |
|
|
.\" * / __| | | | |_) | |
|
|
.\" * | (__| |_| | _ <| |___
|
|
.\" * \___|\___/|_| \_\_____|
|
|
.\" *
|
|
.\" * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
|
|
.\" *
|
|
.\" * This software is licensed as described in the file COPYING, which
|
|
.\" * you should have received as part of this distribution. The terms
|
|
.\" * are also available at https://curl.haxx.se/docs/copyright.html.
|
|
.\" *
|
|
.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
|
.\" * copies of the Software, and permit persons to whom the Software is
|
|
.\" * furnished to do so, under the terms of the COPYING file.
|
|
.\" *
|
|
.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
.\" * KIND, either express or implied.
|
|
.\" *
|
|
.\" **************************************************************************
|
|
.\"
|
|
.TH CURLOPT_AWS_SIGV4 3 "03 Jun 2020" "libcurl 7.75.0" "curl_easy_setopt options"
|
|
.SH NAME
|
|
CURLOPT_AWS_SIGV4 \- V4 signature
|
|
.SH SYNOPSIS
|
|
.nf
|
|
#include <curl/curl.h>
|
|
|
|
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_AWS_SIGV4, char *param);
|
|
.fi
|
|
.SH DESCRIPTION
|
|
Provides AWS V4 signature authentication on HTTP(S) header.
|
|
.PP
|
|
Pass a char * that is the collection of specific arguments are used for
|
|
creating outgoing authentication headers.
|
|
The format of the param option is:
|
|
.IP provider1[:provider2[:region[:service]]]
|
|
.IP provider1,\ provider2
|
|
The providers arguments are used for generating some authentication parameters
|
|
such as "Algorithm", "date", "request type" and "signed headers".
|
|
.IP region
|
|
The argument is a geographic area of a resources collection.
|
|
It is extracted from the host name specified in the URL if omitted.
|
|
.IP service
|
|
The argument is a function provided by a cloud.
|
|
It is extracted from the host name specified in the URL if omitted.
|
|
.PP
|
|
NOTE: This call set \fICURLOPT_HTTPAUTH(3)\fP to CURLAUTH_AWS_SIGV4.
|
|
Calling \fICURLOPT_HTTPAUTH(3)\fP with CURLAUTH_AWS_SIGV4 is the same
|
|
as calling this with "aws:amz" in parameter.
|
|
.PP
|
|
Example with "Test:Try", when curl will do the algorithm, it will generate
|
|
"TEST-HMAC-SHA256" for "Algorithm", "x-try-date" and "X-Try-Date" for "date",
|
|
"test4_request" for "request type",
|
|
"SignedHeaders=content-type;host;x-try-date" for "signed headers"
|
|
.PP
|
|
If you use just "test", instead of "test:try",
|
|
test will be use for every strings generated
|
|
.SH DEFAULT
|
|
By default, the value of this parameter is NULL.
|
|
Calling \fICURLOPT_HTTPAUTH(3)\fP with CURLAUTH_AWS_SIGV4 is the same
|
|
as calling this with "aws:amz" in parameter.
|
|
.SH PROTOCOLS
|
|
HTTP
|
|
.SH EXAMPLE
|
|
.nf
|
|
CURL *curl = curl_easy_init();
|
|
|
|
struct curl_slist *list = NULL;
|
|
|
|
if(curl) {
|
|
curl_easy_setopt(curl, CURLOPT_URL,
|
|
"https://service.region.example.com/uri");
|
|
curl_easy_setopt(c, CURLOPT_AWS_SIGV4, "provider1:provider2");
|
|
|
|
/* service and region also could be set in CURLOPT_AWS_SIGV4 */
|
|
/*
|
|
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/uri");
|
|
curl_easy_setopt(c, CURLOPT_AWS_SIGV4,
|
|
"provider1:provider2:region:service");
|
|
*/
|
|
|
|
curl_easy_setopt(c, CURLOPT_USERPWD, "MY_ACCESS_KEY:MY_SECRET_KEY");
|
|
curl_easy_perform(curl);
|
|
}
|
|
.fi
|
|
.SH AVAILABILITY
|
|
Added in 7.75.0
|
|
.SH RETURN VALUE
|
|
Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
|
|
.SH NOTES
|
|
This option overrides the other auth types you might have set in CURL_HTTPAUTH
|
|
which should be highlighted as this makes this auth method special.
|
|
This method can't be combined with other auth types.
|
|
.SH "SEE ALSO"
|
|
.BR CURLOPT_HEADEROPT "(3), " CURLOPT_HTTPHEADER "(3), "
|