Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


How to implement 206 partial content?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 JohnnyCode   Members   -  Reputation: 291

Like
0Likes
Like

Posted 29 April 2012 - 03:50 PM

Hello

I have a tiny http server and I would like to serve GET requests for large files with partial content. My problem is, What should be headers I add to response to make client make partial requests. As far as I have red, you can only inform the client that you accept partial request with :

Accepet-Ranges: bytes

header. But the client acts ignoring it and makes standard 200 request, so that if I close connection sending no content to the client, no other request is fired on my server. If I get a request for a large file I send only header portion and no content. This is the header portion I send:

HTTP/1.1 200 OK
Accept-Ranges: bytes
Date: Fri, 27 Apr 2012 14:56:08 GMT
ETag: "cc718c-5217-439cf1c245800"
Content-Length: 97240519
Content-Type: application/octet-stream
Connection: Close


I then close the connection, sending no content. This seems to not work and I cannot find out how to make the browsers fire request with Range header on me. I do not understand technique, How do I respond? I send no content or only part after the initial request?

Sponsor:

#2 ApochPiQ   Moderators   -  Reputation: 16382

Like
0Likes
Like

Posted 29 April 2012 - 08:30 PM

You don't "force" the client to do anything in server programming, ever.

You must always assume, in any client/server protocol, that clients are free to do whatever the hell they want with your connection, and react appropriately. If your client supports ranged requests and knows enough to make them, it will make them; if it doesn't, there is no magic you can do on your server to change that.

#3 JohnnyCode   Members   -  Reputation: 291

Like
0Likes
Like

Posted 30 April 2012 - 08:21 AM

thanks for the answer.

But still, modern browsers support this feature, and I can't seem to find this certain behaviour on my side after which browsers partialy request content.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS