Skip to content

Instantly share code, notes, and snippets.

@mocchira
Last active March 4, 2024 04:17
Show Gist options
  • Star 19 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save mocchira/5634938 to your computer and use it in GitHub Desktop.
Save mocchira/5634938 to your computer and use it in GitHub Desktop.
HTTP GET with Range header by curl
  • normal(explicitly specified start AND end)
  curl -v -X GET -H "range: bytes=1-8" http://localhost:8080/bbb/test
  • specified ONLY start(end will be specified at the end of file)
  curl -v -X GET -H "range: bytes=10-" http://localhost:8080/bbb/test
  • specified ONLY one negative value(last N bytes of file will be retrieved)
  curl -v -X GET -H "range: bytes=-11" http://localhost:8080/bbb/test
  • multi(specified multi ranges by using comma)
  curl -v -X GET -H "range: bytes=0-8,10-" http://localhost:8080/bbb/test
@yosukehara
Copy link

Thanks for sharing.

@xinst
Copy link

xinst commented Jan 2, 2018

thx

@jadia
Copy link

jadia commented Oct 19, 2019

Nice. Thanks!

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