Solved

About If-Modified-Since

Posted on 2007-03-19
4
456 Views
Last Modified: 2010-04-20
I type in the following in command prompt
telnet www.google.com 80

and type the following as the request html header
GET / HTTP/1.1
Host: www.google.com
If-Modified-Since: Mon, 19 Mar 2007 02:43:31 GMT

and sent, but it always return me http/1.1 200 OK and the entire webpage.  

Is my syntax correct? Can somebody give me an example that will return http/1.1 304 modified with the correct syntax?
0
Comment
Question by:william007
  • 2
  • 2
4 Comments
 
LVL 11

Accepted Solution

by:
JamesCssl earned 500 total points
ID: 18754494
GET / HTTP/1.1
Host: www.cyberpear.com
If-Modified-Since: Sun, 17 Dec 2006 21:52:08 GMT



You should note that you will only get a 304 response from a page that sends a last-modified header or an ETag header.  Google doesn't do this.  Also, your timestamp has to be the exact same as the last-modified timestamp to receive the 304.

To receive a 304 from an ETag, use the If-None-Match header.
0
 
LVL 9

Author Comment

by:william007
ID: 18765647
Thanks, Your example is working great:)

But if I try to send
GET / HTTP/1.1
Host: www.cyberpear.com
If-Modified-Since: Wed, 21 Mar 2007 02:43:31 GMT

Again it gives me http/1.1 200 OK. 21 Mar 2007 is later than 17 Dec 2006, but why doesn't give me the same result?
Also, how do you know what date to put there?

I am trying to write a proxy server that check the pages in its cache whether has been modified, hence I need to understand these things in details.
0
 
LVL 9

Author Comment

by:william007
ID: 18765689
Also I discover that, for the images, it will always give me the same result, ie 304 not modified even I put different date, again, what is the reason?

GET http://www.new-dream.de/image/wallpaper/computer/apple/apple_14.jpg HTTP/1.1
Host: www.new-dream.de
If-Modified-Since: Wed, 20 Mar 2007 02:43:31 GMT

GET http://www.new-dream.de/image/wallpaper/computer/apple/apple_14.jpg HTTP/1.1
Host: www.new-dream.de
If-Modified-Since: Wed, 20 Feb 2007 02:43:31 GMT
0
 
LVL 11

Assisted Solution

by:JamesCssl
JamesCssl earned 500 total points
ID: 18767103
Some implementations of If-Modified-Since only check to see if the date in the If-Modified-Since header is exactly the same as the file modification date.  The W3C does it correctly (checking if the date is the same or later than the modification date:

GET / HTTP/1.1
Host: www.w3.org
If-Modified-Since: Wed, 21 Mar 2007 18:40:11 GMT
0

Featured Post

Flexible connectivity for any environment

The KE6900 series can extend and deploy computers with high definition displays across multiple stations in a variety of applications that suit any environment. Expand computer use to stations across multiple rooms with dynamic access.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Connect to MS-SQL server from Linux/PHP 8 89
WCAG (Web Content Accessibility Guidelines) levels 3 102
whm high memory usage in processes 7 103
Where can I find... 1 43
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question