diff mbox series

channel_curl: Add CURLOPT_POSTREDIR option

Message ID 20201007111409.98814-1-sava.jakovljev@teufel.de
State New
Headers show
Series channel_curl: Add CURLOPT_POSTREDIR option | expand

Commit Message

Sava Jakovljev Oct. 7, 2020, 11:14 a.m. UTC
Prevent libcurl channel from changing POST requests
to GET after redirections from the server.

Signed-off-by: Sava Jakovljev <sava.jakovljev@teufel.de>
---
 corelib/channel_curl.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Stefano Babic Oct. 12, 2020, 1:59 p.m. UTC | #1
On 07.10.20 13:14, Sava Jakovljev wrote:
> Prevent libcurl channel from changing POST requests
> to GET after redirections from the server.
> 
> Signed-off-by: Sava Jakovljev <sava.jakovljev@teufel.de>
> ---
>  corelib/channel_curl.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/corelib/channel_curl.c b/corelib/channel_curl.c
> index c329a14..a4e9a98 100644
> --- a/corelib/channel_curl.c
> +++ b/corelib/channel_curl.c
> @@ -510,7 +510,10 @@ channel_op_res_t channel_set_options(channel_t *this, channel_data_t *channel_da
>  			      channel_data->sslkey) != CURLE_OK) ||
>  	    (curl_easy_setopt(channel_curl->handle,
>  			      CURLOPT_SSLCERT,
> -			      channel_data->sslcert) != CURLE_OK)) {
> +			      channel_data->sslcert) != CURLE_OK) ||
> +        (curl_easy_setopt(channel_curl->handle,
> +                  CURLOPT_POSTREDIR,
> +                  CURL_REDIR_POST_ALL) != CURLE_OK)) {
>  		result = CHANNEL_EINIT;
>  		goto cleanup;
>  	}
> 

Applied to -master, thanks !

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/corelib/channel_curl.c b/corelib/channel_curl.c
index c329a14..a4e9a98 100644
--- a/corelib/channel_curl.c
+++ b/corelib/channel_curl.c
@@ -510,7 +510,10 @@  channel_op_res_t channel_set_options(channel_t *this, channel_data_t *channel_da
 			      channel_data->sslkey) != CURLE_OK) ||
 	    (curl_easy_setopt(channel_curl->handle,
 			      CURLOPT_SSLCERT,
-			      channel_data->sslcert) != CURLE_OK)) {
+			      channel_data->sslcert) != CURLE_OK) ||
+        (curl_easy_setopt(channel_curl->handle,
+                  CURLOPT_POSTREDIR,
+                  CURL_REDIR_POST_ALL) != CURLE_OK)) {
 		result = CHANNEL_EINIT;
 		goto cleanup;
 	}