How does HTTP Deliver a Large File?

  • compress data
  • send chunked data
  • request data in a selected range

Compress data

Send chunked data

  • a Length block marks, well, the length of the current part of chunked data
  • the chunked data block
  • a CRLF separator at the end of each block
  • a Length block with the number 0 and a CRLF at the end
  • an additional CRLF

Request data in a selected range

  • Range: bytes=20 requests a range starting from 20 to the end, which equals Range: bytes=20-99.
  • Range: bytes=-20 requests the last 20 bytes of data, which equals Range: bytes=80-99.
  • A boundary block indicating, well, the boundary of the data, starting with -- and ending with a CRLF
  • Two headers, Content-Type and Content-Range, showing the property of the corresponding data piece, ending with a CRLF
  • An additional CRLF telling the client that the real data is coming
  • Finally, the data block ending with a CRLF

Takeaways

Join Medium

Further reading

--

--

--

a coder 🧑🏻‍💻

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

#7研究 UIImageView 的 Content Mode

Fixing Symfony/Doctrine upgrade 2.x to 3

Simple and Complete Module-based Laravel App

Cross-platform Frameworks for Mobile Development

Quick refactoring with Python decorator

Game of Tic-Tac-Toe with Python

To own, or not to own

Day 8 of Game Dev: The importance of naming variables and writing pseudo code!

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Carson

Carson

a coder 🧑🏻‍💻

More from Medium

Authentication for Dummies II

MySQL within Docker

What is OAuth ❓ All you need to know

Cookie and Session (I) — The basic concept