Re: [twsocket] Exception in THttpCli when server responds with Status = 0

2016-02-13 Thread Doug Billi
Thanks Angus,

Doug

-Original Message-
From: Angus Robertson - Magenta Systems Ltd [mailto:an...@magsys.co.uk] 
Sent: Saturday, February 13, 2016 1:27 AM
To: twsocket@lists.elists.org
Subject: Re: [twsocket] Exception in THttpCli when server responds with Status 
= 0

> I was getting a response from an HTTP Server where the Status was set 
> to 0 (instead of 1xx-5xx).  This was causing an exception in my 
> application.
> 
> Although this is an error on the server side, shouldn't the code be 
> changed from:
>  
> procedure THttpCli.GetHeaderLineNext;
> [...]
>   FStatusCode   := StrToInt(Copy(FLastResponse, tmpInt, 3));
> [...]
> 
> To:
> 
> [...]
>   FStatusCode   := StrToIntDef(Copy(FLastResponse, tmpInt, 3), 
> 0); [...]

ICS generally uses atoi instead of StrToInt which stops processing when a 
non-numeric character is found, I'll change it. 

Angus


-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Exception in THttpCli when server responds with Status = 0

2016-02-13 Thread Angus Robertson - Magenta Systems Ltd
> I was getting a response from an HTTP Server where the Status was 
> set to 0 (instead of 1xx-5xx).  This was causing an exception in 
> my application.
> 
> Although this is an error on the server side, shouldn't the code 
> be changed from:
>  
> procedure THttpCli.GetHeaderLineNext;
> [...]
>   FStatusCode   := StrToInt(Copy(FLastResponse, tmpInt, 3));
> [...]
> 
> To:
> 
> [...]
>   FStatusCode   := StrToIntDef(Copy(FLastResponse, tmpInt, 3), 
> 0); [...]

ICS generally uses atoi instead of StrToInt which stops processing when
a non-numeric character is found, I'll change it. 

Angus

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


[twsocket] Exception in THttpCli when server responds with Status = 0

2016-02-12 Thread Doug Billi
I was getting a response from an HTTP Server where the Status was set to 0 
(instead of 1xx-5xx).  This was causing an exception in my application.

Although this is an error on the server side, shouldn't the code be changed 
from:
 
procedure THttpCli.GetHeaderLineNext;
[...]
  FStatusCode   := StrToInt(Copy(FLastResponse, tmpInt, 3));
[...]

To:

[...]
  FStatusCode   := StrToIntDef(Copy(FLastResponse, tmpInt, 3), 0); 
[...]

Might there also be conditions (e.g. a timeout) where partial header data could 
be returned, leading to this error?

Thanks,
Doug
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be