Apache set max Content-Range

The Question:

Client asks for:

Range:bytes=0-

Server responds with:

Content-Length:8396748
Content-Range:bytes 0-8396747/8396748

I want to limit that Content-Range to 1MB chunks so the server would respond like this:

Content-Length:1000000
Content-Range:bytes 0-999999/8396748

How can I make Apache/2.2.22 do this?

Regarding “What are you trying to accomplish?”:

It is desirable if for (one of many) examples a user returns to an HTML5 video with auto play, pauses the video and is only interested in responding to a comment on the same page. In this example it would be unnecessarily costly to transfer the whole 128GB (current YouTube max) when the user only consumes a few MB.

Regarding “Is that valid rfc7233?”:

  • One of the 4 Authors of rfc7233 said it’s valid and that

    the protocol anticipates that the server might not send the
    same range[s] as requested

  • It works in Firefox and Chrome.
  • Not supporting it would break resuming an interrupted download.

Answer

Apache has not implemented this feature yet.

I write my own implementation in php., works nicely and is only about 20 lines.

One could use any language though (module/php/perl/python/etc).

Attribution
Source : Link , Question Author : user1133275 , Answer Author : user1133275

Leave a Comment