According to Katherine Porter:
> I'm in EST, and when I tried to crawl a TigerShark (see
> http://www.directnic.com/about/products/tigershark.php) web server,
> the request and response (htdig to the web server) communication looked
> like this:
...
>   If-Modified-Since: Wed, 31 Dec 1969 19:00:00 EST
...
> Apparently, this web server software has a problem with a year being
> less than 1970.  I realize that this seems very trivial because the web
> server should convert EST to GMT by adding five hours (i.e. EST5EDT,
> or -5 GMT) which would reveal that this is actually Thurs, 1 Jan 1970
> 00:00:00 GMT -- but it does not.
> 
> My proposed solution to this problem is to patch htnet/HtHTTP.cc, and
> converting the _modification_time to GMT, via the function ToGMTime().
> Here's my diff (-u):
> 
> --- HtHTTP.cc.orig      Fri Sep 21 00:44:22 2001
> +++ HtHTTP.cc   Fri Sep 21 00:41:47 2001
> @@ -598,6 +598,7 @@
>     // the one we already own.
>  
>     if(_modification_time)
> +        _modification_time->ToGMTime();
>          cmd << "If-Modified-Since: " << _modification_time->GetRFC1123() << "\r\n";
>  
>  ///////
> 
> After this patch, everything seemed to work just fine.  The
> "If-Modified-Since" was converted to GMT, and the client's web server
> successfully "dug".  This is not to say that this was a bug with htdig,
> however, I think that its always a good idea to talk dates in GMT when
> it comes to headers.  :-)

There is no doubt at all that this is a bug.  Actually it's two bugs.
First, dates in HTTP headers must be in GMT/UTC.  Secondly, there
shouldn't be an If-Modified-Since put out if the date is set to the epoch.
Your fix is a partial solution, but will break if _modification_time is
a null pointer.  (You need braces arount the two statements in the if.)

I think this will fix both problems:

   if(_modification_time && *_modification_time > 0)
   {
        _modification_time->ToGMTime();
        cmd << "If-Modified-Since: " << _modification_time->GetRFC1123() << "\r\n";
   }

-- 
Gilles R. Detillieux              E-mail: <[EMAIL PROTECTED]>
Spinal Cord Research Centre       WWW:    http://www.scrc.umanitoba.ca/~grdetil
Dept. Physiology, U. of Manitoba  Phone:  (204)789-3766
Winnipeg, MB  R3E 3J7  (Canada)   Fax:    (204)789-3930

_______________________________________________
htdig-dev mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/htdig-dev

Reply via email to