HTTP_RANGE Problem.

 
Post new topic   Reply to topic    Aprelium Forum Index -> PHP
View previous topic :: View next topic  
Author Message
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3752
Location: USA, GA

PostPosted: Fri Sep 29, 2006 1:35 pm    Post subject: HTTP_RANGE Problem. Reply with quote

I can't get this header to show no matter how many times I try. I want to learn
how this thing works for download resuming. Please help, I've searched all over
Google just now with no luck what so ever.

I know the syntax:

"Content-Range: Start-Finish/Full Size"

So if I'm correct, "Content-Range: 0-4096/12288", should return the first
4096 bytes from a 12288 byte file? :/

They don't really explain this in English on the "HTTP/1.1" specification. I'm
wondering if what I'm doing is correct. I'm also wondering how to get PHP to
send $_SERVER['HTTP_RANGE'], so I can disect the value of it.

Thanks for any help on this.


Last edited by TRUSTAbyss on Fri Sep 29, 2006 2:42 pm; edited 3 times in total
Back to top View user's profile Send private message Visit poster's website
pkSML
-


Joined: 29 May 2006
Posts: 952
Location: Michigan, USA

PostPosted: Fri Sep 29, 2006 2:34 pm    Post subject: Reply with quote

You learn something new everyday!

I'm reading about it here: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.16.

When you're sending this header, the response header must be 206 Partial Content, not 200 OK.

Here's the example they give:
Code:
HTTP/1.1 206 Partial content
Date: Wed, 15 Nov 1995 06:25:24 GMT
Last-Modified: Wed, 15 Nov 1995 04:58:08 GMT
Content-Range: bytes 21010-47021/47022
Content-Length: 26012
Content-Type: image/gif

_________________
Stephen
Need a LitlURL?


http://CodeBin.yi.org
Back to top View user's profile Send private message Visit poster's website
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Fri Sep 29, 2006 2:40 pm    Post subject: Re: HTTP_RANGE Problem. Reply with quote

TRUSTAbyss,

All you have to do is to go back to the source. ;-) The HTTP protocol is explained in detail in RFC2616. The ranges related headers are discussed in:

http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.16
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3752
Location: USA, GA

PostPosted: Fri Sep 29, 2006 2:43 pm    Post subject: Reply with quote

I think I figured it out. After doing some logging from some shared
download resuming code, I was able to log the $_SERVER['HTTP_RANGE']
and I believe I know the system now.

Correct me if I'm wrong, but is this correct?

I will put this in english for others to understand the best way that I can.

Syntax: "Content-Range: Start-Stop/FromTotalSize"

46333 (45.2 KB Downloaded So Far)
198427 (We still need about 193.7 KB)
245760 (240 KB is the Total Size.)

Now I add this to the header to tell PHP that We still need 198427 bytes.
"Content-Range: 46333-198427/245760"

Note: the 46333 Bytes is the $_SERVER['HTTP_RANGE'] variable, and the
198427 Bytes is: Total subtracted from the HTTP_RANGE.

The story.

Our download starts again at "46333" bytes and we complete it at "198427"
bytes. The other part just tells you the entire size you're downloading from.
I think this is how "Download Resuming" works.
Back to top View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> PHP All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group