[email protected] writes:

> Say, why must HEAD go over the network, but GET needn't?
>
> Why can't HEAD just report from the cached copy according to the same
> rules determining its freshness as GETs?

The answer is that I don't know why WWWOFFLE behaves the way it does.

The handling of HEAD requests has been a problem in WWWOFFLE for a
long time.  Here are some ChangeLog notes about it in chronological
order:

Fri Dec  4 19:43:32 1998  Andrew M. Bishop  <[email protected]>

        * wwwoffles.c: Re-instate the HEAD method, but still broken.

Thu Jul  8 19:28:49 1999  Andrew M. Bishop  <[email protected]>

        * wwwoffles.c: Add support for the HTTP HEAD request method.

Tue Nov 23 17:46:14 1999  Andrew M. Bishop  <[email protected]>

        * wwwoffles.c: Fix HEAD requests in Real mode.

2004-11-28  Andrew M. Bishop  <[email protected]>

        * src/wwwoffles.c: Handle HEAD requests more intelligently.
        When online send HEAD don't cache them, when offline convert to GET if 
not cached.


Having looked at the problem I think that I have a patch that might
fix it.  The problem is that I can't be sure that it works for your
particular case.

The main problem is that WWWOFFLE will often make a conditional
request for a URL.  This means that it will ask the server to send the
new file if there is one or just let it know if the file hasn't
changed.  If you make a HEAD request then WWWOFFLE cannot make a
conditional request to the server, it must always get the real head,
not just a message telling you that the cached version hasn't changed.
Since WWWOFFLE cannot cache the HEAD that comes back in this case it
just makes a non-cached request.  Normally therefore a non-cached
request to the server is the correct thing to do.

The only time that this isn't correct is if WWWOFFLE knows that the
page in the cache will be returned instead of the server version when
a GET request is made.  This is the one case that WWWOFFLE isn't
handling.

Try this patch and let me know if it works (it moves the test for an
online HEAD request further down the logic so that it should only be
made now if a request to the server is going to be made):

-------------------- wwwoffles.c patch --------------------
--- wwwoffles.c 2009/01/14 19:52:55     2.322
+++ wwwoffles.c 2009/03/22 19:10:41
@@ -1246,13 +1246,6 @@
       }
    }
 
- /* If a HEAD request when online then don't cache */
-
- if((mode==Real || mode==RealRefresh) && head_only)
-   {
-    mode=RealNoCache;
-   }
-
  /* If not caching then only use the password version. */
 
  if(mode==RealNoCache && Urlpw)
@@ -1619,6 +1612,14 @@
     request_head->size-=1;
    }
 
+ /* If a HEAD request when online then don't cache */
+
+ if((mode==Real || mode==RealRefresh) && head_only)
+   {
+    DeleteLockWebpageSpoolFile(Url);
+    mode=RealNoCache;
+   }
+
 
  /*----------------------------------------
    mode = Spool, SpoolGet, SpoolPragma, SpoolRefresh, Real, RealRefresh, 
RealNoCache or Fetch
-------------------- wwwoffles.c patch --------------------

-- 
Andrew.
----------------------------------------------------------------------
Andrew M. Bishop                             [email protected]
                                      http://www.gedanken.demon.co.uk/

WWWOFFLE users page:
        http://www.gedanken.demon.co.uk/wwwoffle/version-2.9/user.html

Reply via email to