You are not logged in.
Hi,
in SynNodeBinding_HTTPClient
is used TWinHTTP for Windows and TCurlHTTP for Linux
Is it problem to add in
TCurlHTTP.InternalSendRequest
curl.easy_setopt(fHandle,coFollowLocation,1)
to achieve the same behavior?
Because under Windows the result is 200 (auto redirection), under Linux 302 and Location: .... in headers
in case the requested site uses internal redirection
Last edited by mapes (2019-02-18 11:15:29)
Offline
Hm, really default value for WinHttpRequestOption_EnableRedirects is true.
@ab - I agree with @mapes - to have the same behavior for both classes we can add
curl.easy_setopt(fHandle,coFollowLocation,1)
to
TCurlHTTP.InternalCreateRequest
I don`t think it's broke something
Offline
I found that with TCurlHTTP Basic Authentication does not work.
Server does not receive Authorization header.
{$IFDEF WINDOWS}
THTTPClient = TWinHTTP;
{$ELSE IF UNIX}
THTTPClient = TCurlHTTP;
{$ENDIF}
// ...
function TCTR.GetConnector(): THTTPClient;
begin
Result := THTTPClient.Create(Settings.BackendUrl, Settings.ProxyServer, '', 60 {sec} * 1000, 60 {sec} * 1000, 60 {sec} * 1000, False);
Result.AuthScheme := THttpRequestAuthentication.wraBasic;
Result.AuthUserName := 'AuthUserName ';
Result.AuthPassword := 'AuthPassword ';
end;
Offline
Lazarus + FPC
Cross compiled Win32 -> Linux64 (CentOS)
I'm having strange behavior when making requests to https.
curl.easy_perform(fHandle) raise an exception.
Same application works fine for http requests.
Curl in comand line works fine for http and https requests
I activate coVerbose to see more info:
* About to connect() to httpbin.org port 443 (#0)
* Trying 52.3.32.149...
* Connected to httpbin.org (52.3.32.149) port 443 (#0)
And after that:
An unhandled exception occurred at $00007F08E251ED00:
EAccessViolation: Access violation
$00007F08E251ED00
Any tips on what it might be?
It does not seem to be related to a certificate because the Exception would not occur in this case.
And making the request with Curl on the command line is ok.
Offline
Thanks @mpv
Solved by upgrading libcurl.
PS: Really weird the AV
Offline
I found TCurlHTTP ignores send and receive timeouts - this cause my server to wait forever in case resource I call has a bugs (a real life situation).
I create a patch what sets CURLOPT_TIMEOUT to SendTimeout + ReceiveTimeout - this is better than hangs in any case - see https://github.com/synopse/mORMot/pull/404
Also I add usage of CURLOPT_TIMEOUT_MS (available since libcurl 7.16.2 - April 11 2007, so exists in all systems)
@ab - I think it will be good to do the same for mORMot2
Last edited by mpv (2021-09-13 10:58:53)
Offline