Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP::StaticFileHandler should support 206 Partial Content feature #8954

Closed
636f7374 opened this issue Mar 27, 2020 · 5 comments · Fixed by #12886
Closed

HTTP::StaticFileHandler should support 206 Partial Content feature #8954

636f7374 opened this issue Mar 27, 2020 · 5 comments · Fixed by #12886

Comments

@636f7374
Copy link

636f7374 commented Mar 27, 2020

Summary

  • This feature is very useful, many sites are using this feature.
  • I have not used this feature for the time being,
    • so I have not implemented it for the time being.
  • For more explanation about this feature, please refer to References.
  • This may require using some seek (File).
    • This feature often appears in (E.g. Restful APIs).

Specifications

Sample

  • Request (I.e. Single, Range)
GET /audio/... HTTP/1.1
Host: audio-akp-quic-control-spotify-com.akamaized.net
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache
Sec-Fetch-Dest: empty
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36
DNT: 1
Accept: */*
Origin: https://open.spotify.com
Sec-Fetch-Site: cross-site
Sec-Fetch-Mode: cors
Referer: https://open.spotify.com/
Accept-Encoding: identity
Accept-Language: zh-TW,zh;q=0.9,en-US;q=0.8,en;q=0.7
Range: bytes=495259-660589
  • Response (I.e. Single, Content-Range)
HTTP/1.1 206 Partial Content
Last-Modified: Thu, 21 Nov 2019 19:49:02 GMT
ETag: "..."
Content-Type: application/octet-stream
Accept-Ranges: bytes
Cache-Control: no-transform, max-age=30745172
Cache-Control: max-age=315360000, no-transform
Date: Fri, 27 Mar 2020 18:53:39 GMT
Connection: keep-alive
Access-Control-Max-Age: 86400
Access-Control-Allow-Headers: range, pragma, cache-control
Access-Control-Allow-Methods: GET
Access-Control-Allow-Origin: *
Expires: Mon, 25 Mar 2030 18:53:39 GMT
Content-Range: bytes 495259-660589/3592935
Content-Length: 165331
  • Request (I.e. Several, Range)
GET http://localhost:8080/traditional/small.dat HTTP/1.1
Host: localhost:8080
Connection: close
Accept: */*
Accept-Encoding: gzip
User-Agent: Jetty/9.4.19.v20190610
Range: bytes=2275-4550,6825-9100,11375-13650,15925-18200
  • Response (I.e. Several, Content-Type: multipart/byteranges, Content-Range)
HTTP/1.1 206 Partial Content
Date: Wed, 15 Nov 2015 06:25:24 GMT
Last-Modified: Wed, 15 Nov 2015 04:58:08 GMT
Content-Length: 1741
Content-Type: multipart/byteranges; boundary=String_separator

--String_separator
Content-Type: application/pdf
Content-Range: bytes 234-639/8000

...the first range...
--String_separator
Content-Type: application/pdf
Content-Range: bytes 4590-7999/8000

...the second range
--String_separator--

References

@rdp
Copy link
Contributor

rdp commented Apr 1, 2020

@636f7374
Copy link
Author

636f7374 commented Apr 1, 2020

@rdp Yes, but lack support for Several Range, and Crystal HTTP::StaticFileHandler should also support this feature. :)

@636f7374
Copy link
Author

636f7374 commented Apr 1, 2020

@rdp Because it is more convenient to use HTTP::StaticFileHandler directly, low size. :)

@asterite
Copy link
Member

asterite commented Apr 1, 2020

It's so weird that they use skip in Kemal... can't they use file.pos = ...?

@636f7374
Copy link
Author

636f7374 commented Apr 1, 2020

@asterite I think seek is better because other languages are implemented using seek. (Kemal maybe? ...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants