Re: [Pharo-users] ZnClient - receiving/parsing malformed cookie 'expires' value

2018-03-22 Thread Sven Van Caekenberghe
Hi Paul,

> On 20 Mar 2018, at 01:45, PAUL DEBRUICKER  wrote:
> 
> Hi -  This is more of an FYI than anything
> 
> 
> I'm interacting with an API that is sending "expires=0" value as part of the 
> only cookie of their response.  
> 
> 
> Changing  #expiresTimeStamp to 
> 
> 
> (self expires isNil or:[self expires size<28] ) ifTrue:[ ^ DateAndTime now + 
> 1 day ].
>   ^ ZnUtils parseHttpDate: self expires
> 
> 
> fixes my issue but maybe there's a better way to handle cookie parsing errors 
> 
> 
> Paul

HTTP Cookies are pretty tricky, and ZnCookie seems like a crude implementation, 
but I don't want to fix that right now, as it works. So I tried to fix your 
issue a bit like you suggested:

===
Name: Zinc-HTTP-SvenVanCaekenberghe.474
Author: SvenVanCaekenberghe
Time: 22 March 2018, 5:05:39.517798 pm
UUID: 55204037-6424-0d00-9e5a-3eaa0cba9811
Ancestors: Zinc-HTTP-SvenVanCaekenberghe.473

fix ZnCookie>>#isExpired with expires=0 attribute, so that

(ZnCookie name: 'foo' value: '123') expires: '0'; isExpired. 

returns false.

Cookies with missing or bogus expire attribute never expire.

Thx Paul De Bruicker
===

I hope this works for you.

Thx,

Sven




[Pharo-users] ZnClient - receiving/parsing malformed cookie 'expires' value

2018-03-19 Thread PAUL DEBRUICKER
Hi -  This is more of an FYI than anything


I'm interacting with an API that is sending "expires=0" value as part of the 
only cookie of their response.  


Changing  #expiresTimeStamp to 


(self expires isNil or:[self expires size<28] ) ifTrue:[ ^ DateAndTime now + 1 
day ].
^ ZnUtils parseHttpDate: self expires


fixes my issue but maybe there's a better way to handle cookie parsing errors 


Paul