informatics-isi-edu / hatrac

Simple object storage for collaborations
Apache License 2.0
3 stars 1 forks source link

Content-Type is not set in the response for the requests having the Range header #43

Closed svoinea closed 6 years ago

svoinea commented 7 years ago

The Safari browser fails to load videos from hatrac.

The curl request sent is something like:

curl 'https://dev.rebuildingakidney.org/hatrac/resources/immunofluorescence/videos/2017/352970ba8928bde2353ef6437899cf3f' \
-XGET \
-H 'Referer: https://www.google.com/' \
-H 'Range: bytes=22478848-22578762' \
-H 'Host: dev.rebuildingakidney.org' \
-H 'Accept: /' \
-H 'Connection: keep-alive' \
-H 'Accept-Language: en-us' \
-H 'Accept-Encoding: identity' \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Safari/604.1.38' \
-H 'Cookie: webauthn_track=490fd837.55a9a0c8617c1' \
-H 'X-Playback-Session-Id: 191DF680-492A-4567-B456-47EA78ECEEA9'

for which the response header looks like:

HTTP/1.1 206 Partial Content
Date: Mon, 09 Oct 2017 22:03:24 GMT
Server: Apache/2.4.27 (Fedora) OpenSSL/1.0.2k-fips mod_wsgi/4.5.15 Python/2.7
WWW-Authenticate: Webauthn: preauth=https://dev.rebuildingakidney.org/authn/preauth?referrer=/hatrac/resources/immunofluorescence/videos/2017/352970ba8928bde2353ef6437899cf3f
Vary: Host,cookie,User-Agent
Upgrade: h2
Connection: Upgrade, Keep-Alive
Content-Range: bytes 22478848-22578762/22578763
Content-Length: 99915
Content-Location: /hatrac/resources/immunofluorescence/videos/2017/352970ba8928bde2353ef6437899cf3f:TDTXMBLZPBZDDHN3NZF2OSBZAM
ETag: "TDTXMBLZPBZDDHN3NZF2OSBZAM"
Keep-Alive: timeout=5, max=100
Content-Type: text/plain; charset=UTF-8

For chunk responses, hatrac does not set the Content-Type, and the default gets in that case Content-Type: text/plain; charset=UTF-8.

I checked curl with the Range header for a video static file, and it returns Content-Type: video/mp4.

karlcz commented 6 years ago

A fix for this is pushed to master. Please confirm that it works for you. @svoinea

svoinea commented 6 years ago

Tested on Safari and it works as expected.