mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-06-04 00:38:27 +02:00
SSL sockets: propagate socket error on SSL_ERROR_SYSCALL (SSL_ERROR_SYSCALL means an error happened on the underlying socket)
This commit is contained in:
parent
75338da133
commit
38537fe27f
@ -305,6 +305,7 @@ function TOpenSSLSocketHandler.Send(Const Buffer; Count: Integer): Integer;
|
|||||||
var
|
var
|
||||||
e: integer;
|
e: integer;
|
||||||
begin
|
begin
|
||||||
|
FLastError:=0;
|
||||||
FSSLLastError := 0;
|
FSSLLastError := 0;
|
||||||
FSSLLastErrorString:='';
|
FSSLLastErrorString:='';
|
||||||
repeat
|
repeat
|
||||||
@ -314,7 +315,11 @@ begin
|
|||||||
if (E=SSL_ERROR_ZERO_RETURN) then
|
if (E=SSL_ERROR_ZERO_RETURN) then
|
||||||
Result:=0
|
Result:=0
|
||||||
else if (e<>0) then
|
else if (e<>0) then
|
||||||
|
begin
|
||||||
FSSLLastError:=e;
|
FSSLLastError:=e;
|
||||||
|
if e=SSL_ERROR_SYSCALL then
|
||||||
|
FLastError:=socketerror;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TOpenSSLSocketHandler.Recv(Const Buffer; Count: Integer): Integer;
|
function TOpenSSLSocketHandler.Recv(Const Buffer; Count: Integer): Integer;
|
||||||
@ -322,6 +327,7 @@ function TOpenSSLSocketHandler.Recv(Const Buffer; Count: Integer): Integer;
|
|||||||
var
|
var
|
||||||
e: integer;
|
e: integer;
|
||||||
begin
|
begin
|
||||||
|
FLastError:=0;
|
||||||
FSSLLastError:=0;
|
FSSLLastError:=0;
|
||||||
FSSLLastErrorString:= '';
|
FSSLLastErrorString:= '';
|
||||||
repeat
|
repeat
|
||||||
@ -333,7 +339,11 @@ begin
|
|||||||
if (E=SSL_ERROR_ZERO_RETURN) then
|
if (E=SSL_ERROR_ZERO_RETURN) then
|
||||||
Result:=0
|
Result:=0
|
||||||
else if (e<>0) then
|
else if (e<>0) then
|
||||||
|
begin
|
||||||
FSSLLastError:=e;
|
FSSLLastError:=e;
|
||||||
|
if e=SSL_ERROR_SYSCALL then
|
||||||
|
FLastError:=socketerror;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TOpenSSLSocketHandler.BytesAvailable: Integer;
|
function TOpenSSLSocketHandler.BytesAvailable: Integer;
|
||||||
|
Loading…
Reference in New Issue
Block a user