diff options
author | Matthias Gatto <matthias.gatto@outscale.com> | 2020-01-21 17:33:51 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2020-12-21 16:28:03 +0100 |
commit | eb69797766a36e56c07c2fc4cfe064b60cdeebc0 (patch) | |
tree | 2eb7d245b02c8846685be37f93caaf718ad90899 | |
parent | 08e8455dddc5e48e58a12ade3815c01ae3da3b64 (diff) | |
download | curl-eb69797766a36e56c07c2fc4cfe064b60cdeebc0.tar.gz |
http: Make the call to v4 signature
This patch allow to call the v4 signature introduce in previous commit
Signed-off-by: Matthias Gatto <matthias.gatto@outscale.com>
-rw-r--r-- | include/curl/typecheck-gcc.h | 1 | ||||
-rw-r--r-- | lib/http.c | 13 | ||||
-rw-r--r-- | lib/setopt.c | 14 |
3 files changed, 27 insertions, 1 deletions
diff --git a/include/curl/typecheck-gcc.h b/include/curl/typecheck-gcc.h index 6d84150dc..230f4c106 100644 --- a/include/curl/typecheck-gcc.h +++ b/include/curl/typecheck-gcc.h @@ -334,6 +334,7 @@ CURLWARNING(_curl_easy_getinfo_err_curl_off_t, (option) == CURLOPT_URL || \ (option) == CURLOPT_USERAGENT || \ (option) == CURLOPT_USERNAME || \ + (option) == CURLOPT_AWS_SIGV4 || \ (option) == CURLOPT_USERPWD || \ (option) == CURLOPT_XOAUTH2_BEARER || \ (option) == CURLOPT_SSL_EC_CURVES || \ diff --git a/lib/http.c b/lib/http.c index 23618b9d7..3f7f4ba21 100644 --- a/lib/http.c +++ b/lib/http.c @@ -64,6 +64,7 @@ #include "http_ntlm.h" #include "curl_ntlm_wb.h" #include "http_negotiate.h" +#include "http_aws_sigv4.h" #include "url.h" #include "share.h" #include "hostip.h" @@ -398,6 +399,8 @@ static bool pickoneauth(struct auth *pick, unsigned long mask) pick->picked = CURLAUTH_NTLM_WB; else if(avail & CURLAUTH_BASIC) pick->picked = CURLAUTH_BASIC; + else if(avail & CURLAUTH_AWS_SIGV4) + pick->picked = CURLAUTH_AWS_SIGV4; else { pick->picked = CURLAUTH_PICKNONE; /* we select to use nothing */ picked = FALSE; @@ -664,7 +667,15 @@ output_auth_headers(struct connectdata *conn, (void)request; (void)path; #endif - +#ifndef CURL_DISABLE_CRYPTO_AUTH + if(authstatus->picked == CURLAUTH_AWS_SIGV4) { + auth = "AWS_SIGV4"; + result = Curl_output_aws_sigv4(conn, proxy); + if(result) + return result; + } + else +#endif #ifdef USE_SPNEGO if(authstatus->picked == CURLAUTH_NEGOTIATE) { auth = "Negotiate"; diff --git a/lib/setopt.c b/lib/setopt.c index b8fc4e8da..a6cc562eb 100644 --- a/lib/setopt.c +++ b/lib/setopt.c @@ -638,6 +638,20 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param) data->set.method = HTTPREQ_POST_FORM; data->set.opt_no_body = FALSE; /* this is implied */ break; + + case CURLOPT_AWS_SIGV4: + /* + * String that holds file type of the SSL certificate to use + */ + result = Curl_setstropt(&data->set.str[STRING_AWS_SIGV4], + va_arg(param, char *)); + /* + * Basic been set by default it need to be unset here + */ + if(data->set.str[STRING_AWS_SIGV4]) + data->set.httpauth = CURLAUTH_AWS_SIGV4; + break; + #endif /* CURL_DISABLE_HTTP */ case CURLOPT_MIMEPOST: |