You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Dean Gaudet <dg...@arctic.org> on 1997/01/13 00:12:29 UTC

[PATCH] 3 patches

Ok cool, there's three patches here that I've been trying to get in for a
while.  So far they only have +1, +0, +1 from Brian. 

The first patch also fixes another bug from a user ... something having to
do with timestamps and SSI. 

Dean

---------- Forwarded message ----------
Date: Sun, 29 Dec 1996 14:24:49 -0800 (PST)
From: Dean Gaudet <dg...@hotwired.com>
Reply-To: new-httpd@hyperreal.com
To: new-httpd@apache.org
Subject: mod_log_config: odd values for %T (fwd)

Two problems.  The first is that every call to make_sub_request wasn't
copying the original request's request_time.  The second was that
mod_log_config was defaulting to "do not want_orig" for %T (i.e. %>T was
default not %<T).  Try the following patch or use %<T.

I considered copying the time right inside make_sub_request.  I also
considered making make_sub_request a static function.  Both may be the
right thing to do...   In hotwired's code I keep track of time statistics
and other stuff that is "global" to a particular request in the conn_rec
structure.  Mostly because I am lazy.  But it does avoid this problem
where you have to copy the values from request to sub request.

I'm willing to make up a different patch that takes one of those approaches...

Dean

*** http_request.c.dist	Sun Dec 29 14:09:12 1996
--- http_request.c	Sun Dec 29 14:09:57 1996
***************
*** 568,573 ****
--- 568,574 ----
      char *udir;
      
      rnew = make_sub_request (r);
+     rnew->request_time = r->request_time;
      rnew->connection = r->connection; 
      rnew->server = r->server;
      rnew->request_config = create_request_config (rnew->pool);
***************
*** 651,657 ****
  
      rnew = make_sub_request (r);
      fdir = make_dirstr (rnew->pool, r->filename, count_dirs (r->filename));
!     
      rnew->connection = r->connection; /* For now... */
      rnew->server = r->server;
      rnew->request_config = create_request_config (rnew->pool);
--- 652,659 ----
  
      rnew = make_sub_request (r);
      fdir = make_dirstr (rnew->pool, r->filename, count_dirs (r->filename));
! 
!     rnew->request_time = r->request_time;
      rnew->connection = r->connection; /* For now... */
      rnew->server = r->server;
      rnew->request_config = create_request_config (rnew->pool);
*** mod_log_config.c.dist	Sun Dec 29 14:17:05 1996
--- mod_log_config.c	Sun Dec 29 14:17:21 1996
***************
*** 345,351 ****
      { 'l', log_remote_logname, 0 },
      { 'u', log_remote_user, 0 },
      { 't', log_request_time, 0 },
!     { 'T', log_request_duration, 0 },
      { 'r', log_request_line, 1 },
      { 'f', log_request_file, 0 },
      { 'U', log_request_uri, 1 },
--- 345,351 ----
      { 'l', log_remote_logname, 0 },
      { 'u', log_remote_user, 0 },
      { 't', log_request_time, 0 },
!     { 'T', log_request_duration, 1 },
      { 'r', log_request_line, 1 },
      { 'f', log_request_file, 0 },
      { 'U', log_request_uri, 1 },




---------- Forwarded message ----------
Date: Thu, 2 Jan 1997 17:50:46 -0800 (PST)
From: Dean Gaudet <dg...@arctic.org>
To: new-httpd@apache.org
Subject: Re: pfopen errno patch (take 2)

Um, ahem.  Take 2.  The last one was a somewhat hasty patch made in the
middle of an upgrade of hotwired's code to 1.2 from 1.1.1+lots_of_crap.

This patch lets people do more verbose logging after a pfopen failure if
they want to.  On its own it doesn't add anything useful.

Dean

*** apache_1.2b4/src/alloc.c	Sat Dec 14 12:28:45 1996
--- apache_new/src/alloc.c	Thu Jan  2 17:49:31 1997
***************
*** 62,67 ****
--- 62,68 ----
  #include "alloc.h"
  
  #include <stdarg.h>
+ #include <errno.h>
  
  /*****************************************************************
   *
***************
*** 777,782 ****
--- 778,784 ----
  {
    FILE *fd = NULL;
    int baseFlag, desc;
+   int save_errno;
  
    block_alarms();
  
***************
*** 785,799 ****
--- 787,805 ----
      baseFlag = (*(mode+1) == '+') ? O_RDWR : O_WRONLY;
      desc = open(name, baseFlag | O_APPEND | O_CREAT,
  		S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
+     save_errno = errno;
      if (desc >= 0) {
        fd = fdopen(desc, mode);
+       save_errno = errno;
      }
    } else {
      fd = fopen(name, mode);
+     save_errno = errno;
    }
  
    if (fd != NULL) note_cleanups_for_file (a, fd);
    unblock_alarms();
+   errno = save_errno;
    return fd;
  }
  




---------- Forwarded message ----------
Date: Thu, 2 Jan 1997 22:40:31 -0800 (PST)
From: Dean Gaudet <dg...@arctic.org>
To: new-httpd@apache.org
Subject: warning from irix 6.2 cc

cfe: Warning 851: util.c, line 109: constant initializer expression is
invalid (refers to automatic variables).
     struct tm gmt = *gmtime(&tt);
 ----^

Interesting.  I'd have to dig out my copy of the ansi c standard to see
if this is valid -- but I'm tempted to believe the compiler because this
is a structure initialization, not a scalar.  Patch included.

Someone should test with HAS_GMTOFF defined.

Dean

*** util.c.dist	Thu Jan  2 22:32:02 1997
--- util.c	Thu Jan  2 22:37:33 1997
***************
*** 103,127 ****
  }
  
  /* What a pain in the ass. */
  struct tm *get_gmtoff(int *tz) {
      time_t tt = time(NULL);
- #if !defined(HAS_GMTOFF)
-     struct tm gmt = *gmtime(&tt);
- #endif
      struct tm *t = localtime(&tt);
  
- #if defined(HAS_GMTOFF)
      *tz = (int) (t->tm_gmtoff / 60);
  #else
      /* Assume we are never more than 24 hours away. */
!     int days = t->tm_yday - gmt.tm_yday;
!     int hours = ((days < -1 ? 24 : 1 < days ? -24 : days * 24)
  		 + t->tm_hour - gmt.tm_hour);
!     int minutes = hours * 60 + t->tm_min - gmt.tm_min;
      *tz = minutes;
- #endif
      return t;
  }
  
  
  /* Match = 0, NoMatch = 1, Abort = -1 */
--- 103,134 ----
  }
  
  /* What a pain in the ass. */
+ #if defined(HAS_GMTOFF)
  struct tm *get_gmtoff(int *tz) {
      time_t tt = time(NULL);
      struct tm *t = localtime(&tt);
  
      *tz = (int) (t->tm_gmtoff / 60);
+     return t;
+ }
  #else
+ struct tm *get_gmtoff(int *tz) {
+     time_t tt = time(NULL);
+     struct tm gmt;
+     struct tm *t;
+     int days, hours, minutes;
+ 
      /* Assume we are never more than 24 hours away. */
!     gmt = *gmtime(&tt); /* remember gmtime/localtime return ptr to static */
!     t = localtime(&tt); /* buffer... so be careful */
!     days = t->tm_yday - gmt.tm_yday;
!     hours = ((days < -1 ? 24 : 1 < days ? -24 : days * 24)
  		 + t->tm_hour - gmt.tm_hour);
!     minutes = hours * 60 + t->tm_min - gmt.tm_min;
      *tz = minutes;
      return t;
  }
+ #endif
  
  
  /* Match = 0, NoMatch = 1, Abort = -1 */