easy:SetOpt_FollowLocation(enable)
libcurl will issue another request for the new URL and follow new Location:
headers all the way until no more such headers are returned.
#CURLOPT_MAXREDIRS
can be used to limit the number of redirects
libcurl will follow.
libcurl limits what protocols it automatically follows to. The accepted
protocols are get with #CURLOPT_REDIR_PROTOCOLS
. By default libcurl
will allow all protocols on redirect except those disabled for security
reasons: Since 7.19.4 FILE and SCP are disabled, and since 7.40.0 SMB and SMBS
are also disabled.
When following a Location:, the 3xx response code that redirected it also
dictates which request method it will use in the subsequent request: For 301,
302 and 303 responses libcurl will switch method to GET unless
#CURLOPT_POSTREDIR
instructs libcurl otherwise. All other 3xx codes
will make libcurl send the same method again.
For users who think the existing location following is too naive, too simple
or just lacks features, it is very easy to instead implement your own redirect
follow logic with the use of easy:GetInfo()'s
#CURLINFO_REDIRECT_URL
option instead of using
#CURLOPT_FOLLOWLOCATION
.