hyperscale / hyperpic

Fast HTTP microservice for high-level image processing.
MIT License
31 stars 2 forks source link

Incorrect Content-Type return using fm query-string #2

Closed xbgmsharp closed 5 years ago

xbgmsharp commented 5 years ago

Hello,

When using query-string fm to force the output format, the Content-Type header does not return the output format value but rather the original Content-Type.

Below 2 examples to demonstrate the issue:

JPG image convert to WebP, the content is in webp format but doesn't match Content-Type header.

$ curl -svo /dev/null "http://localhost:8000/foo.jpg?w=400&h=400&q=85&fm=webp"
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 8000 (#0)
> GET /foo.jpg?w=400&h=400&q=85&fm=webp HTTP/1.1
> Host: localhost:8000
> User-Agent: curl/7.54.0
> Accept: */*
> 
< HTTP/1.1 200 OK
< Accept-Ranges: bytes
< Content-Length: 22172
< Content-Type: image/jpeg <---------------------------------- should be image/webp
< Last-Modified: Tue, 11 Dec 2018 11:41:26 GMT
< Request-Id: bg6ta4l1hf8g00b4gao0
< Vary: Origin
< X-Content-Type-Options: nosniff
< X-Image-From: source
< Date: Mon, 10 Dec 2018 02:53:06 GMT
< 
{ [8200 bytes data]
* Connection #0 to host localhost left intact

PNG image convert to WebP, the content is in webp format but doesn't match Content-Type header.

$ curl -svo /dev/null "http://localhost:8000/bar.png?w=400&h=400&q=85&fm=webp"
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 8000 (#0)
> GET /bar.png?w=400&h=400&q=85&fm=webp HTTP/1.1
> Host: localhost:8000
> User-Agent: curl/7.54.0
> Accept: */*
> 
< HTTP/1.1 200 OK
< Accept-Ranges: bytes
< Content-Length: 24466
< Content-Type: image/png <---------------------------------- should be image/webp
< Last-Modified: Mon, 10 Dec 2018 02:52:54 GMT
< Request-Id: bg6tbv51hf8g00b4gb4g
< Vary: Origin
< X-Content-Type-Options: nosniff
< X-Image-From: cache
< Date: Mon, 10 Dec 2018 02:57:00 GMT
< 
{ [3822 bytes data]
* Connection #0 to host localhost left intact
euskadi31 commented 5 years ago

Hi @xbgmsharp,

Thank you for issue, I'm watching this problem tonight.

euskadi31 commented 5 years ago

@xbgmsharp Which version do you use?

xbgmsharp commented 5 years ago

I use the docker image. docker pull hyperscale/hyperpic

euskadi31 commented 5 years ago

ok, thank you

euskadi31 commented 5 years ago

Hi @xbgmsharp,

I corrected the problem, I will try to make a release soon.

Thanks again for the bug report.

euskadi31 commented 5 years ago

@xbgmsharp docker pull hyperscale/hyperpic:dev