Hi Sven - 

This is in Pharo 6.1.

There is an API I'm using which sometimes returns a string only containing a 
single instance of the number 0 in the "Expires" field, so the 
#expiresTimeStamp method sends that to #parseHttpDate: and since it can't be 
parsed into a date an error is thrown.  Seems like Zinc should be able to 
handle that based on the spec here: 
https://tools.ietf.org/html/rfc7234#section-5.3


Would you rather I changed the implementation of parseHttpDate: to add an empty 
check on the parsed tokens e.g.


parseHttpDate: string
        "self parseHttpDate: 'Tue, 13 Sep 2011 08:04:49 GMT'."
        "self parseHttpDate: 'Tue, 13-Sep-2011 08:04:51 GMT'."
        "self parseHttpDate: 'Tue Jan 01 00:00:01 2036 GMT'."
        
        | tokens day month year hour minute second months map yearToken |
        string size = 1 ifTrue:[ ^DateAndTime epoch ].
        tokens := (string findTokens: #( $ $- $: $, )) allButFirst.
        
        ...


Or add a string size guard check in #expiresTimeStamp ? e.g.

expiresTimeStamp
        self expires
                ifNil: [ ^ DateAndTime now + 1 day ]
                ifNotNil: [ :exp | 
                        exp size = 1
                                ifTrue: [ ^ DateAndTime epoch ].
                        ^ ZnUtils parseHttpDate: exp ]


Thanks

Paul

Reply via email to