You are not logged in.
Pages: 1
I need some Help with TWinHTTP from SynCrtSock.
I have procedure :
procedure TServiceRequest.GetService(const FullURL: string;
var ResponseCode: Integer; var ResponseHeader, ResponseData: SockString);
var
aURI: TURI;
CESHTTPClient: TWinHTTP;
begin
// Event fired on some Service
CESHTTPClient := nil;
try
try
aURI.From(FullURL);
CESHTTPClient := TWinHTTP.Create(aURI.Server, aURI.Port, aURI.Https );
CESHTTPClient.IgnoreSSLCertificateErrors := true;
ResponseCode := CESHTTPClient.Request( aURI.Address,'GET', 0, '', '', '', ResponseHeader, ResponseData);
except
on E: Exception do
begin
Log('Request not successful! Exception: ' + E.Message);
end;
end;
finally
aURI.Clear;
if Assigned(CESHTTPClient) then
CESHTTPClient.Free;
end;
end;
...and everything works just fine , until I have some error like wrong server name for example.
In that fall I will get error 12019 from winhttp.dll
The same error 12019 I have when ReciveTime is bigger than those defined in Request for example...
Question is, how to become real Error Message (fore example Server doesnot response or something like that)?
Offline
And it is clear bug - after short research I found it.
Actually I do not understand this piece of logic there Also, in SynCrtSock , procedure TWinHTTP.InternalSendRequest if Request is HTTPS, than errors are just ignored. Why?! I just didn't get it!
In my situation I have real errors 12007 or 12002 and they MUST be reported. All others sure must be reported too...
Last edited by Avatarx (2017-09-21 14:31:09)
Offline
What I mean is that there are very serious bugs in SynCrtSock.
Actually errors are just ignored and for sure no one need such code. What I've expected was to work with WinHTTP and to receive needed information correctly.
OK. I've made some little changes in your code. Must I send them to git or you can fix errors alone?
Problem is very clear described: in procedure TWinHTTP.InternalSendRequest, if HTTPS is True mostly error codes received from WinHTTP are just ignored.
Offline
I see!
But if server doesn't exist (winhttp error code 12007) than I become error 12019. If it must be so and you mean that this is correct, than I will change my code only - I still need correct error code at end
Why must it be so designed!?
Last edited by Avatarx (2017-09-21 18:47:00)
Offline
Pages: 1