Solved

About If-Modified-Since

Posted on 2007-03-19
4
465 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

740 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