Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDL-82136 curl: Send credentials to redirect URL if allowed
Curl has the option CURLOPT_UNRESTRICTED_AUTH. If true, curl will send the credentials to a different host. If false, they will not be sent. CURLOPT_UNRESTRICTED_AUTH can only work if the CURLOPT_FOLLOWLOCATION option is true. The filelib forces the CURLOPT_FOLLOWLOCATION option to be false, because all redirects are emulated at the PHP level. So, in this case, the CURLOPT_UNRESTRICTED_AUTH option is only being used in our logic and will not work as you might expect it to. This patch works almost the same as CURLOPT_UNRESTRICTED_AUTH in ideal conditions. It will check whether the host is different. If so, the system will check what value CURLOPT_UNRESTRICTED_AUTH has. If it is not specified, then by default, it will be false. If false, then credentials will not be sent.
- Loading branch information