These are chat archives for IndySockets/Indy

7th
Jun 2017
Remy Lebeau
@rlebeau
Jun 07 2017 05:28
@mezen try setting BasicAuthentication to false. You are setting it to true, which gives TIdHTTP permission to send Basic authentication requests. That is not what the proxy is asking for.
mezen
@mezen
Jun 07 2017 05:30
Is it possible to determine before connecting if BasicAuthentication should be false? Or is it more like try and error? First try with Basic, if it is not successful do a second try without Basic?
mezen
@mezen
Jun 07 2017 05:39
And when should I set hoInProcessAuth in HTTPOptions?
Remy Lebeau
@rlebeau
Jun 07 2017 16:28
@mezen BasicAuthentication has to be set before you send a request, since it helps govern the type of authentication sent in the request. The only way to determine the server's desired authentication type(s) is to send a request, even if just HEAD, and see how the server responds. The authentication(s) are specified in the response's WWW-Authenticate and Proxy-Authenticate headers. If you plan on having TIdHTTP handle authentication, hoInProcessAuthshould always be set. At the very least, it needs to be set before the response is parsed, so you could set it dynamically in the OnHeadersAvailable event, for instance. If hoInProcessAuth is not set, you have to handle authentication manually by checking the TIdHTTP.ResponseCode and then setting the TIdHTTP.Request.Authentication or TIdHTTP.Request.CustomHeaders.Values['Authorization'] on the next request.