Results 1 to 9 of 9

Thread: If-Modified-Since header

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Sep 2008
    Posts
    1,260

    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?

  2. #2
    Frenzied Member
    Join Date
    Apr 2009
    Location
    CA, USA
    Posts
    1,516

    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.

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Sep 2008
    Posts
    1,260

    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?

  4. #4
    Frenzied Member
    Join Date
    Apr 2009
    Location
    CA, USA
    Posts
    1,516

    Re: If-Modified-Since header

    Could you post some code showing how you're sending this request?

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Sep 2008
    Posts
    1,260

    Re: If-Modified-Since header

    Basically i am using a class module in vb6...

    Is that what you are talking about?

  6. #6

    Thread Starter
    Frenzied Member
    Join Date
    Sep 2008
    Posts
    1,260

    Re: If-Modified-Since header

    Will the If-Modified-Since header only work if the date modified setting is setup on the server?

  7. #7
    Frenzied Member
    Join Date
    Apr 2009
    Location
    CA, USA
    Posts
    1,516

    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.

  8. #8

    Thread Starter
    Frenzied Member
    Join Date
    Sep 2008
    Posts
    1,260

    Re: If-Modified-Since header

    Are you checking the response code for 304
    Sorry, im confused... why do i want to do that?

  9. #9
    Frenzied Member
    Join Date
    Apr 2009
    Location
    CA, USA
    Posts
    1,516

    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
  •  



Click Here to Expand Forum to Full Width