If you use curly to do a POST request, and the server then returns a 302 redirect, curly will attempt to continue doing a POST request to the redirected URL. This is not what curl actually does by default - curl tries to mimic the browser and converts the 302 redirect into a GET.
The reason curly does this is the OPT_CUSTOMREQUEST flag - by setting this, it effectively tells libcurl to only use the specified method to do the request.
https://curl.se/libcurl/c/CURLOPT_CUSTOMREQUEST.html has more information.
The easiest fix for this is to set the CURLFOLLOW_OBEYCODE bit in https://curl.se/libcurl/c/CURLOPT_FOLLOWLOCATION.html - so instead of 1, set 2.
Let me know what you think, happy to send a PR.
If you use curly to do a POST request, and the server then returns a 302 redirect, curly will attempt to continue doing a POST request to the redirected URL. This is not what curl actually does by default - curl tries to mimic the browser and converts the 302 redirect into a GET.
The reason curly does this is the OPT_CUSTOMREQUEST flag - by setting this, it effectively tells libcurl to only use the specified method to do the request.
https://curl.se/libcurl/c/CURLOPT_CUSTOMREQUEST.html has more information.
The easiest fix for this is to set the CURLFOLLOW_OBEYCODE bit in https://curl.se/libcurl/c/CURLOPT_FOLLOWLOCATION.html - so instead of 1, set 2.
Let me know what you think, happy to send a PR.