mirror of
https://github.com/curl/curl.git
synced 2025-02-05 14:30:10 +08:00
tool: add AWS HTTP v4 Signature support
Signed-off-by: Matthias Gatto <matthias.gatto@outscale.com>
This commit is contained in:
parent
eb69797766
commit
6b27df8269
@ -168,6 +168,8 @@ static void free_config_fields(struct OperationConfig *config)
|
||||
|
||||
Curl_safefree(config->ftp_account);
|
||||
Curl_safefree(config->ftp_alternative_to_user);
|
||||
|
||||
Curl_safefree(config->aws_sigv4_provider);
|
||||
}
|
||||
|
||||
void config_free(struct OperationConfig *config)
|
||||
|
@ -284,6 +284,7 @@ struct OperationConfig {
|
||||
0 is valid. default: CURL_HET_DEFAULT. */
|
||||
bool haproxy_protocol; /* whether to send HAProxy protocol v1 */
|
||||
bool disallow_username_in_url; /* disallow usernames in URLs */
|
||||
char *aws_sigv4_provider;
|
||||
struct GlobalConfig *global;
|
||||
struct OperationConfig *prev;
|
||||
struct OperationConfig *next; /* Always last in the struct */
|
||||
|
@ -113,6 +113,7 @@ static const struct LongShort aliases[]= {
|
||||
{"*t", "proxy-ntlm", ARG_BOOL},
|
||||
{"*u", "crlf", ARG_BOOL},
|
||||
{"*v", "stderr", ARG_FILENAME},
|
||||
{"*V", "aws-sigv4", ARG_STRING},
|
||||
{"*w", "interface", ARG_STRING},
|
||||
{"*x", "krb", ARG_STRING},
|
||||
{"*x", "krb4", ARG_STRING},
|
||||
@ -803,6 +804,10 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
|
||||
config->crlf = toggle;
|
||||
break;
|
||||
|
||||
case 'V': /* --aws-sigv4 */
|
||||
config->authtype |= CURLAUTH_AWS_SIGV4;
|
||||
GetStr(&config->aws_sigv4_provider, nextarg);
|
||||
break;
|
||||
case 'v': /* --stderr */
|
||||
if(strcmp(nextarg, "-")) {
|
||||
FILE *newfile = fopen(nextarg, FOPEN_WRITETEXT);
|
||||
|
@ -817,6 +817,8 @@ static const struct helptxt helptext[] = {
|
||||
{"-A, --user-agent <name>",
|
||||
"Send User-Agent <name> to server",
|
||||
CURLHELP_IMPORTANT | CURLHELP_HTTP},
|
||||
{" --aws-sigv4 <provider1[:provider2]>",
|
||||
"Use HTTP AWS V4 Signature", CURLHELP_HTTP},
|
||||
{"-v, --verbose",
|
||||
"Make the operation more talkative",
|
||||
CURLHELP_IMPORTANT | CURLHELP_VERBOSE},
|
||||
|
@ -1661,6 +1661,8 @@ static CURLcode single_transfer(struct GlobalConfig *global,
|
||||
my_setopt_str(curl, CURLOPT_SSLKEYTYPE, config->key_type);
|
||||
my_setopt_str(curl, CURLOPT_PROXY_SSLKEYTYPE,
|
||||
config->proxy_key_type);
|
||||
my_setopt_str(curl, CURLOPT_AWS_SIGV4,
|
||||
config->aws_sigv4_provider);
|
||||
|
||||
if(config->insecure_ok) {
|
||||
my_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
|
||||
|
Loading…
Reference in New Issue
Block a user