Hi Mariano,

I am pretty sure that 'Content-Type' is a required header that cannot be empty. 
It seems to be in an AWS S3 response, which is pretty weird (maybe you uploaded 
with an empty one in the first place).

On the other hand, maybe Zn could be a bit more robust. But what should Zn do 
in this case ? There is no content type that matches nil, maybe 
application/octet-stream (ZnMimeType default) ?

Sven

> On 22 Jul 2015, at 16:15, Mariano Martinez Peck <[email protected]> wrote:
> 
> Hi,
> 
> I am using Zinc to get the contents of a file. The code works correct in 
> GemStone (because I think it uses a different/older) version but in Pharo it 
> throws an error in:
> 
> ZnHeaders >> contentType
>       ^ ZnMimeType fromString: (self headers at: 'Content-Type')
>       
> The error there is in the #fromString:  since  " (self headers at: 
> 'Content-Type')"  answers an empty string.
> The error inside #fromString is in this line:
> 
> sub := aString copyFrom: main size + 2 to: endOfSub.
> 
> that fails of course since 'aString' is an empty string. 
> 
> Curl shows indeed that the url I am getting has an empty content type defined:
> 
> < HTTP/1.1 200 OK
> < x-amz-id-2: eBymTYeSNAPTsgOYDvpbqj/gIPcPpuSb6F0ca/zVjLUG+P2hLZJy/IbU+4MX42sW
> < x-amz-request-id: F82747AD31A40F4E
> < Date: Wed, 22 Jul 2015 14:02:00 GMT
> < Last-Modified: Tue, 21 Jul 2015 20:42:44 GMT
> < ETag: "a9fc27157bca2863a58c331e0eae27fb"
> < Content-Type:
> < Content-Length: 437013
> < Server: AmazonS3
> 
> So...while it may be "server's fault" because it may be doing something 
> wrong, is still need to get it. I haven't found any workaround in Zinc that 
> it wasn't changing code. 
> 
> I am fine with changing code / override if this is a bug and will be fixed 
> later. But if there is a setting or something I would be glad to know it.
> 
> Thanks, 
> 
> 
> -- 
> Mariano
> http://marianopeck.wordpress.com


Reply via email to