|
-
Feb 2nd, 2010, 04:10 PM
#1
Thread Starter
Frenzied Member
If-Modified-Since header
GET /index.html HTTP/1.1
If-Modified-Since: Sat, 29 Oct 2010 19:43:31 GMT
User-Agent: http protocol
Host: 127.0.0.1
Cache-Control: no-cache
I am sending this header to a server, and the page is still returned even though the modified date is in the future...
Why would this be?
-
Feb 2nd, 2010, 04:43 PM
#2
Re: If-Modified-Since header
From this page:
A GET method with an If-Modified-Since header and no Range header requests that the identified entity be transferred only if it has been modified since the date given by the If-Modified-Since header. The algorithm for determining this includes the following cases:
a) If the request would normally result in anything other than a
200 (OK) status, or if the passed If-Modified-Since date is
invalid, the response is exactly the same as for a normal GET.
A date which is later than the server's current time is
invalid.
Your date is invalid; the header cannot be used in the way you're trying to use it.
-
Feb 2nd, 2010, 04:52 PM
#3
Thread Starter
Frenzied Member
Re: If-Modified-Since header
OK, even the following doesnt work:
GET /index.html HTTP/1.1
If-Modified-Since: Mon, 1 Feb 2010 19:43:31 GMT
User-Agent: http protocol
Host: 127.0.0.1
Cache-Control: no-cache
Why would this be?
-
Feb 2nd, 2010, 06:14 PM
#4
Re: If-Modified-Since header
Could you post some code showing how you're sending this request?
-
Feb 2nd, 2010, 06:25 PM
#5
Thread Starter
Frenzied Member
Re: If-Modified-Since header
Basically i am using a class module in vb6...
Is that what you are talking about?
-
Feb 2nd, 2010, 07:20 PM
#6
Thread Starter
Frenzied Member
Re: If-Modified-Since header
Will the If-Modified-Since header only work if the date modified setting is setup on the server?
-
Feb 3rd, 2010, 01:23 PM
#7
Re: If-Modified-Since header
Is that what you are talking about?
Yes, but I can't help with VB6 anyway.
Will the If-Modified-Since header only work if the date modified setting is setup on the server?
I would assume so.
Are you checking the response code for 304? Even if If-Modified-Since is false, page content could be returned from a cache, but the code should still be 304.
Last edited by SambaNeko; Feb 3rd, 2010 at 01:26 PM.
-
Feb 4th, 2010, 02:38 AM
#8
Thread Starter
Frenzied Member
Re: If-Modified-Since header
Are you checking the response code for 304
Sorry, im confused... why do i want to do that?
-
Feb 4th, 2010, 10:30 AM
#9
Re: If-Modified-Since header
[Assuming the server supports the If-Modified-Since header,] A 304 response is sent back to the requesting client if the page on the server has not been modified; this is the signal for the client to reload the page contents from its cache rather than getting a new copy from the server.
You said "the page still returned" - I'm wondering if you got a 304 response (the result you want), but the page you got was from a cache.
Edit: wait a minute, I just looked at your headers again - if you're not letting the client cache the page (Cache-Control: no-cache), then you're always going to get a new copy of the page from the server. If-Modified-Since is a comparison between the client's cached copy of the page and the server's page. If there's no cached page, no comparison can be made.
Last edited by SambaNeko; Feb 4th, 2010 at 10:36 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|