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/10 11:19:23 UTC

still waiting for votes

Here's three things I'm waiting for votes on.

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 is a patch which makes it easier to generate error messages after a
failed pfopen().

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 */



Re: still waiting for votes

Posted by Brian Behlendorf <br...@organic.com>.
On Fri, 10 Jan 1997, Dean Gaudet wrote:
> Here's three things I'm waiting for votes on.

here goes...

> ---------- 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.

+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 is a patch which makes it easier to generate error messages after a
> failed pfopen().

Hmm... doesn't look like this patch actually does much by itself, other than
providing for other custom patches folks might have.  Logging that failure
would be useful however... so, +0 unless it actually logged an error.

> ---------- 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.

+1, it compiles clean on the machine I have access to.

	Brian

--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--
brian@organic.com  www.apache.org  hyperreal.com  http://www.organic.com/JOBS