cvs commit: apachen/src/main http_log.c http_log.h

1997-12-07 Thread pcs
pcs 97/12/07 07:48:01

  Modified:src/main http_log.c http_log.h
  Log:
  The current aplog_error() function cannot report on errors returned by
  Win32 functions. These functions do not bother setting errno - instead,
  you have to make a call to GetLastError() to get the error code, then call
  FormatMessage() to get the corresponding string. I already added code to
  do this in os/win32/service.c, but this was specific to reporting errors
  to standard error during apache -i or -u calls.
  
  The patch below updates aplog_error() to enable generic logging of
  Win32 errors to the same place as other errors. It adds a new flag,
  APLOG_WIN32ERROR which if given in the _second_ argument to aplog_error()
  causes the Win32 error code and error string to be logged. Here is an
  example call (this is from worker_main()):
  
  if (SetEvent(ev[i]) == 0)
  aplog_error(APLOG_MARK,APLOG_WIN32ERROR, server_conf,
  SetEvent for child process in slot #%d, i);
  
  Reviewed by:  Ben Laurie, Martin Kraemer
  
  Revision  ChangesPath
  1.44  +43 -0 apachen/src/main/http_log.c
  
  Index: http_log.c
  ===
  RCS file: /export/home/cvs/apachen/src/main/http_log.c,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- http_log.c1997/11/06 21:54:08 1.43
  +++ http_log.c1997/12/07 15:47:59 1.44
  @@ -319,6 +319,49 @@
len += ap_snprintf(errstr + len, sizeof(errstr) - len,
(%d)%s: , save_errno, strerror(save_errno));
   }
  +#ifdef WIN32
  +if (level  APLOG_WIN32ERROR) {
  + int nChars;
  + int nErrorCode;
  +
  + nErrorCode = GetLastError();
  + len += ap_snprintf(errstr + len, sizeof(errstr) - len,
  + (%d), nErrorCode);
  +
  + nChars = FormatMessage( 
  + FORMAT_MESSAGE_FROM_SYSTEM,
  + NULL,
  + nErrorCode,
  + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
  + (LPTSTR) errstr + len,
  + sizeof(errstr) - len,
  + NULL 
  + );
  + len += nChars;
  + if (nChars == 0) {
  + /* Um, error occurred, but we can't recurse to log it again
  +  * (and it would probably only fail anyway), so lets just
  +  * log the numeric value.
  +  */
  + nErrorCode = GetLastError();
  + len += ap_snprintf(errstr + len, sizeof(errstr) - len,
  + (FormatMessage failed with code %d): , nErrorCode);
  + }
  + else {
  + /* FormatMessage put the message in the buffer, but it may
  +  * have appended a newline (\r\n). So remove it and use
  +  * :  instead like the Unix errors. The error may also
  +  * end with a . before the return - if so, trash it.
  +  */
  + if (len  1  errstr[len-2] == '\r'  errstr[len-1] == '\n') {
  + if (len  2  errstr[len-3] == '.')
  + len--;
  + errstr[len-2] = ':';
  + errstr[len-1] = ' ';
  + }
  + }
  +}
  +#endif
   
   va_start(args, fmt);
   len += ap_vsnprintf(errstr + len, sizeof(errstr) - len, fmt, args);
  
  
  
  1.20  +5 -0  apachen/src/main/http_log.h
  
  Index: http_log.h
  ===
  RCS file: /export/home/cvs/apachen/src/main/http_log.h,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- http_log.h1997/10/22 20:29:39 1.19
  +++ http_log.h1997/12/07 15:48:00 1.20
  @@ -81,6 +81,11 @@
   #endif
   
   #define APLOG_NOERRNO(APLOG_LEVELMASK + 1)
  +#ifdef WIN32
  +/* Set to indicate that error msg should come from Win32's GetLastError(),
  + * not errno. */
  +#define APLOG_WIN32ERROR ((APLOG_LEVELMASK+1) * 2)
  +#endif
   
   #ifndef DEFAULT_LOGLEVEL
   #define DEFAULT_LOGLEVEL APLOG_ERR
  
  
  


cvs commit: apachen/src/main alloc.c

1997-12-07 Thread ben
ben 97/12/07 13:28:49

  Modified:src  CHANGES
   src/main alloc.c
  Log:
  Cure filehandle leak in Win32 CGI.
  PR: 1523
  Submitted by: Peter Tillemans [EMAIL PROTECTED]
  
  Revision  ChangesPath
  1.523 +2 -0  apachen/src/CHANGES
  
  Index: CHANGES
  ===
  RCS file: /export/home/cvs/apachen/src/CHANGES,v
  retrieving revision 1.522
  retrieving revision 1.523
  diff -u -r1.522 -r1.523
  --- CHANGES   1997/11/25 22:00:40 1.522
  +++ CHANGES   1997/12/07 21:28:46 1.523
  @@ -1,5 +1,7 @@
   Changes with Apache 1.3b4
   
  +  *) WIN32: Cure file leak in CGIs. [Peter Tillemans [EMAIL PROTECTED]] 
PR#1523
  +
 *) proxy_ftp: the directory listings generated by the proxy ftp module
now have a title in which the path components are clickable and allow
quick navigation to the clicked-on directory on the currently listed
  
  
  
  1.59  +9 -0  apachen/src/main/alloc.c
  
  Index: alloc.c
  ===
  RCS file: /export/home/cvs/apachen/src/main/alloc.c,v
  retrieving revision 1.58
  retrieving revision 1.59
  diff -u -r1.58 -r1.59
  --- alloc.c   1997/11/12 23:22:05 1.58
  +++ alloc.c   1997/12/07 21:28:48 1.59
  @@ -1318,11 +1318,20 @@
   
/* restore the original stdin, stdout and stderr */
if (pipe_in)
  + {
dup2(hStdIn, fileno(stdin));
  + close(hStdIn);
  + }
if (pipe_out)
  + {
dup2(hStdOut, fileno(stdout));
  + close(hStdOut);
  + }
if (pipe_err)
  + {
dup2(hStdErr, fileno(stderr));
  + close(hStdErr);
  + }
   
   if (pid) {
note_subprocess(p, pid, kill_how);
  
  
  


cvs commit: apachen/src/main alloc.c

1997-12-07 Thread ben
ben 97/12/07 13:33:19

  Modified:src/main alloc.c
  Log:
  Arg! Oh God! Get the formatting right before righteous bolts smite me.
  
  Revision  ChangesPath
  1.60  +6 -9  apachen/src/main/alloc.c
  
  Index: alloc.c
  ===
  RCS file: /export/home/cvs/apachen/src/main/alloc.c,v
  retrieving revision 1.59
  retrieving revision 1.60
  diff -u -r1.59 -r1.60
  --- alloc.c   1997/12/07 21:28:48 1.59
  +++ alloc.c   1997/12/07 21:33:18 1.60
  @@ -1317,21 +1317,18 @@
}
   
/* restore the original stdin, stdout and stderr */
  - if (pipe_in)
  - {
  + if (pipe_in) {
dup2(hStdIn, fileno(stdin));
close(hStdIn);
  - }
  - if (pipe_out)
  - {
  +}
  + if (pipe_out) {
dup2(hStdOut, fileno(stdout));
close(hStdOut);
  - }
  - if (pipe_err)
  - {
  + }
  + if (pipe_err) {
dup2(hStdErr, fileno(stderr));
close(hStdErr);
  - }
  + }
   
   if (pid) {
note_subprocess(p, pid, kill_how);
  
  
  


cvs commit: apachen/src/main util_script.c

1997-12-07 Thread ben
ben 97/12/07 13:49:55

  Modified:src  CHANGES
   src/main util_script.c
  Log:
  WIN32: Allow spaces to prefix the interpreter in #! lines.
  PR: 1101
  
  Revision  ChangesPath
  1.524 +3 -0  apachen/src/CHANGES
  
  Index: CHANGES
  ===
  RCS file: /export/home/cvs/apachen/src/CHANGES,v
  retrieving revision 1.523
  retrieving revision 1.524
  diff -u -r1.523 -r1.524
  --- CHANGES   1997/12/07 21:28:46 1.523
  +++ CHANGES   1997/12/07 21:49:52 1.524
  @@ -1,5 +1,8 @@
   Changes with Apache 1.3b4
   
  +  *) WIN32: Allow spaces to prefix the interpreter in #! lines.
  + [Ben Laurie] PR#1101
  +
 *) WIN32: Cure file leak in CGIs. [Peter Tillemans [EMAIL PROTECTED]] 
PR#1523
   
 *) proxy_ftp: the directory listings generated by the proxy ftp module
  
  
  
  1.86  +3 -0  apachen/src/main/util_script.c
  
  Index: util_script.c
  ===
  RCS file: /export/home/cvs/apachen/src/main/util_script.c,v
  retrieving revision 1.85
  retrieving revision 1.86
  diff -u -r1.85 -r1.86
  --- util_script.c 1997/11/16 15:45:22 1.85
  +++ util_script.c 1997/12/07 21:49:54 1.86
  @@ -723,6 +723,9 @@
break;
}
interpreter[i] = 0;
  + for (i = 2; interpreter[i] == ' '; ++i)
  + ;
  + memmove(interpreter+2,interpreter+i,strlen(interpreter+i)+1);
}
else {
/*
  
  
  


Re: cvs commit: apachen/src/main alloc.c

1997-12-07 Thread Marc Slemko
On 7 Dec 1997 [EMAIL PROTECTED] wrote:

 ben 97/12/07 13:28:49
 
   Modified:src  CHANGES
src/main alloc.c
   Log:
   Cure filehandle leak in Win32 CGI.
   PR: 1523
   Submitted by:   Peter Tillemans [EMAIL PROTECTED]
   
   Revision  ChangesPath
   1.523 +2 -0  apachen/src/CHANGES
   

I think there are another couple of PRs complaining about this
somewhere.  They should be closed too.

I, however, am another one of those odd people studying for finals.



cvs commit: apachen/htdocs/manual/mod mod_alias.html

1997-12-07 Thread coar
coar97/12/07 15:03:46

  Modified:htdocs/manual/mod mod_alias.html
  Log:
Correct missing keyword on ScriptAliasMatch example.
  
  PR:   1512
  Submitted by: Ronnie Brunner [EMAIL PROTECTED]
  
  Revision  ChangesPath
  1.14  +1 -1  apachen/htdocs/manual/mod/mod_alias.html
  
  Index: mod_alias.html
  ===
  RCS file: /export/home/cvs/apachen/htdocs/manual/mod/mod_alias.html,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- mod_alias.html1997/10/25 22:35:13 1.13
  +++ mod_alias.html1997/12/07 23:03:45 1.14
  @@ -248,7 +248,7 @@
   matches into the given string and use it as a filename. For example,
   to activate the standard code/cgi-bin/code, one might use:
   pre
  -ScriptAlias ^/cgi-bin(.*) /usr/local/apache/cgi-bin$1
  +ScriptAliasMatch ^/cgi-bin(.*) /usr/local/apache/cgi-bin$1
   /pre
   /p