diff -Naur apache_1.3.12/10xpatchlevel-orig apache_1.3.12/10xpatchlevel --- apache_1.3.12/10xpatchlevel-orig +++ apache_1.3.12/10xpatchlevel Fri Mar 3 11:12:16 2000 @@ -0,0 +1,5 @@ +This file contains the patch level for the Accelerating Apache patches +available from + http://oss.sgi.com/projects/apache/ + +10xpatchlevel=1.3.12-0 diff -Naur apache_1.3.12/ABOUT_APACHE-orig apache_1.3.12/ABOUT_APACHE --- apache_1.3.12/ABOUT_APACHE-orig Wed Mar 31 16:42:14 1999 +++ apache_1.3.12/ABOUT_APACHE Wed Feb 9 17:34:31 2000 @@ -104,7 +104,8 @@ Other major contributors - Howard Fear (mod_include), Florent Guillaume (language negotiation), + Mike Abbott (performance), Howard Fear (mod_include), + Florent Guillaume (language negotiation), Koen Holtman (rewrite of mod_negotiation), Kevin Hughes (creator of all those nifty icons), Rasmus Lerdorf (mod_info, mod_php, mod_php3), diff -Naur apache_1.3.12/conf/httpd.conf-dist-orig apache_1.3.12/conf/httpd.conf-dist --- apache_1.3.12/conf/httpd.conf-dist-orig Sun Feb 20 23:30:46 2000 +++ apache_1.3.12/conf/httpd.conf-dist Wed Mar 1 17:12:35 2000 @@ -185,6 +185,14 @@ #BindAddress * # +# SingleListen: Require that each child process listen to a single IP +# address and port, from the list specified using Listen options. +# Listen addresses are distributed evenly across child processes. This +# avoids the whole serialized accept problem. +# +SingleListen off + +# # Dynamic Shared Object (DSO) Support # # To be able to use the functionality of a module which was built as a DSO you @@ -207,6 +215,16 @@ # Off) when the "server-status" handler is called. The default is Off. # #ExtendedStatus On + +# +# QSC: Enable the Quick Shortcut Cache. The QSC caches response +# headers and data together for very fast response to requests for +# static content. It is tightly integrated with and requires the +# mmap_static module. +# + + QSC on + ### Section 2: 'Main' server configuration # diff -Naur apache_1.3.12/htdocs/index.html.ca-orig apache_1.3.12/htdocs/index.html.ca --- apache_1.3.12/htdocs/index.html.ca-orig Thu Sep 2 04:03:37 1999 +++ apache_1.3.12/htdocs/index.html.ca Wed Feb 9 17:34:31 2000 @@ -47,5 +47,8 @@
+
+ +
diff -Naur apache_1.3.12/htdocs/index.html.cz-orig apache_1.3.12/htdocs/index.html.cz --- apache_1.3.12/htdocs/index.html.cz-orig Thu Dec 9 07:56:34 1999 +++ apache_1.3.12/htdocs/index.html.cz Wed Feb 9 17:34:31 2000 @@ -47,5 +47,8 @@
+
+ +
diff -Naur apache_1.3.12/htdocs/index.html.de-orig apache_1.3.12/htdocs/index.html.de --- apache_1.3.12/htdocs/index.html.de-orig Wed Aug 18 05:00:56 1999 +++ apache_1.3.12/htdocs/index.html.de Wed Feb 9 17:34:31 2000 @@ -57,5 +57,8 @@
Powered by Apache!
+
+ +
diff -Naur apache_1.3.12/htdocs/index.html.dk-orig apache_1.3.12/htdocs/index.html.dk --- apache_1.3.12/htdocs/index.html.dk-orig Thu Aug 19 02:19:27 1999 +++ apache_1.3.12/htdocs/index.html.dk Wed Feb 9 17:34:31 2000 @@ -43,5 +43,8 @@
+
+ +
diff -Naur apache_1.3.12/htdocs/index.html.ee-orig apache_1.3.12/htdocs/index.html.ee --- apache_1.3.12/htdocs/index.html.ee-orig Fri Aug 20 13:28:46 1999 +++ apache_1.3.12/htdocs/index.html.ee Wed Feb 9 17:34:31 2000 @@ -49,5 +49,8 @@
+
+ +
diff -Naur apache_1.3.12/htdocs/index.html.en-orig apache_1.3.12/htdocs/index.html.en --- apache_1.3.12/htdocs/index.html.en-orig Sat Nov 20 13:29:40 1999 +++ apache_1.3.12/htdocs/index.html.en Wed Feb 9 17:34:31 2000 @@ -34,5 +34,9 @@ You are free to use the image below on an Apache-powered web server. Thanks for using Apache!
+ +
+ Performance tuned by SGI +
diff -Naur apache_1.3.12/htdocs/index.html.es-orig apache_1.3.12/htdocs/index.html.es --- apache_1.3.12/htdocs/index.html.es-orig Fri Aug 27 04:08:59 1999 +++ apache_1.3.12/htdocs/index.html.es Wed Feb 9 17:34:31 2000 @@ -47,5 +47,8 @@
+
+ +
diff -Naur apache_1.3.12/htdocs/index.html.fr-orig apache_1.3.12/htdocs/index.html.fr --- apache_1.3.12/htdocs/index.html.fr-orig Wed Aug 18 07:46:23 1999 +++ apache_1.3.12/htdocs/index.html.fr Wed Feb 9 17:34:31 2000 @@ -49,5 +49,8 @@
+
+ +
diff -Naur apache_1.3.12/htdocs/index.html.it-orig apache_1.3.12/htdocs/index.html.it --- apache_1.3.12/htdocs/index.html.it-orig Sun Jan 30 11:59:38 2000 +++ apache_1.3.12/htdocs/index.html.it Wed Mar 1 17:04:16 2000 @@ -34,5 +34,8 @@

+
+ +
diff -Naur apache_1.3.12/htdocs/index.html.ja.jis-orig apache_1.3.12/htdocs/index.html.ja.jis --- apache_1.3.12/htdocs/index.html.ja.jis-orig Sun Jan 30 08:18:35 2000 +++ apache_1.3.12/htdocs/index.html.ja.jis Wed Mar 1 17:07:07 2000 @@ -38,5 +38,8 @@
+
+ +
diff -Naur apache_1.3.12/htdocs/index.html.lu-orig apache_1.3.12/htdocs/index.html.lu --- apache_1.3.12/htdocs/index.html.lu-orig Fri Aug 20 13:28:47 1999 +++ apache_1.3.12/htdocs/index.html.lu Wed Feb 9 17:34:31 2000 @@ -33,5 +33,8 @@ Apache-powered Web server ze presenteieren. Merci dat Dir Apache benotzt!
+
+ +
diff -Naur apache_1.3.12/htdocs/index.html.nl-orig apache_1.3.12/htdocs/index.html.nl --- apache_1.3.12/htdocs/index.html.nl-orig Wed Aug 18 07:46:23 1999 +++ apache_1.3.12/htdocs/index.html.nl Wed Feb 9 17:34:31 2000 @@ -50,5 +50,8 @@
Klein 'Powered by Apache' Logotje
+
+ +
diff -Naur apache_1.3.12/htdocs/index.html.po.iso-pl-orig apache_1.3.12/htdocs/index.html.po.iso-pl --- apache_1.3.12/htdocs/index.html.po.iso-pl-orig Sun Jan 30 08:18:35 2000 +++ apache_1.3.12/htdocs/index.html.po.iso-pl Wed Mar 1 17:07:07 2000 @@ -50,5 +50,8 @@
Powered by Apache!
+
+ +
diff -Naur apache_1.3.12/htdocs/index.html.pt-orig apache_1.3.12/htdocs/index.html.pt --- apache_1.3.12/htdocs/index.html.pt-orig Mon Jan 31 15:23:27 2000 +++ apache_1.3.12/htdocs/index.html.pt Wed Mar 1 17:13:47 2000 @@ -38,5 +38,8 @@

A imagem abaixo pode ser usada livremente em qualquer site presente num servidor com o Apache Web Server instalado. Obrigado por usar o Apache Web Server!

+
+ +
diff -Naur apache_1.3.12/htdocs/index.html.pt-br-orig apache_1.3.12/htdocs/index.html.pt-br --- apache_1.3.12/htdocs/index.html.pt-br-orig Sun Jan 30 11:59:38 2000 +++ apache_1.3.12/htdocs/index.html.pt-br Wed Mar 1 17:07:07 2000 @@ -51,5 +51,8 @@
+
+ +
diff -Naur apache_1.3.12/htdocs/index.html.se-orig apache_1.3.12/htdocs/index.html.se --- apache_1.3.12/htdocs/index.html.se-orig Wed Aug 18 07:44:57 1999 +++ apache_1.3.12/htdocs/index.html.se Wed Feb 9 17:34:31 2000 @@ -39,5 +39,8 @@
+
+ +
diff -Naur apache_1.3.12/htdocs/manual/64-bit.html-orig apache_1.3.12/htdocs/manual/64-bit.html --- apache_1.3.12/htdocs/manual/64-bit.html-orig +++ apache_1.3.12/htdocs/manual/64-bit.html Thu Feb 17 10:55:41 2000 @@ -0,0 +1,511 @@ + + + + + Guide to 64-Bit Apache + + + +

+

[APACHE DOCUMENTATION]

+

+Apache HTTP Server Version 1.3

+

+

+

+Guide to 64-Bit Apache

+

+Mike Abbott - mja@sgi.com
+Accelerating Apache Project

+

+

+Apache/1.3.7 and beyond can be compiled as either a 32-bit or a 64-bit +application, allowing use of a full 64-bit virtual address space and +native 64-bit arithmetic. (However, neither 32-bit nor 64-bit Apache +can serve files larger than about 2 GB; see below + for details.) Currently Apache supports only SGI's +64-bit application binary interface (ABI) but undoubtedly other +vendors will port it to their own 64-bit ABIs.

+

+Compiling

+

+By default Apache compiles as a 32-bit application. To compile Apache +as a 64-bit application, just enable configure's IRIX64 rule and run +make as usual:

+
+  $ configure --enable-rule=IRIX64
+  $ make
+
+

+However, there are some complications.

+ +

+Rules and ABIs

+

+Apache can be compiled using any of SGI's three ABIs -- known as old +32-bit or O32, new 32-bit or N32, and 64-bit + or 64 (sometimes called new 64-bit or N64) +-- on platforms that support them. Two of configure's rules, IRIXN32 +and IRIX64, select the ABI for which Apache is compiled. The IRIX64 +rule overrides the IRIXN32 rule. By default IRIXN32 is enabled and +IRIX64 is disabled so Apache is compiled for the N32 ABI.

+
+ + + + + + + + + + + + + + + + + + + + + +
Apache ABIIRIXN32 ruleIRIX64 rule
64-bit (64 or N64)don't careenabled
new 32-bit + (N32)enabled + (default)disabled + (default)
old 32-bit (O32)disableddisabled (default)
+
+

+On non-SGI platforms Apache can be compiled using only a 32-bit ABI and +the above rules do not apply.

+

+Programming

+

+SGI's 64-bit ABI -- and therefore 64-bit Apache -- uses an LP64 + model, wherein long ints and all pointers are 64 bits +wide (8 bytes) and ints are 32 bits wide (4 bytes). Other +types remain the same.

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type32-bit ABI Size64-bit ABI Size
char8 bits8 bits
short1616
int3232
long3264
pointer3264
float3232
double6464
+
+

+The discussion and examples below will help you to write code that +works in both 32-bit and 64-bit Apache, but this is not a complete +porting guide. There is no substitute for passing code through a picky +64-bit compiler and cleaning up the warnings and errors. I recommend +always using the compiler option that produces the pickiest warnings +and fixing all the warnings it generates. The option to SGI's compilers +is -fullwarn, used by default.

+

+Standard Typedefs

+

+Programmers accustomed to 32-bit programming often assume that int + and long are interchangeable, and that certain types +defined by the development environment are defined in certain ways. +Examples relevant to 64-bit Apache are the standard types size_t, ssize_t, off_t, +and time_t.

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Type NameActual TypeAssumed Type
size_tunsigned longunsigned int
ssize_tlongint
off_tlongint
time_tintlong
+
+

+All of the following examples compile and run fine under 32-bit ABIs +but induce compiler errors or warnings and can produce erroneous +results under the 64-bit ABI:

+
+  int length = strlen(str);            /* oops: strlen() returns size_t */
+
+  int r = read(fd, buf, n);            /* oops: read() returns ssize_t */
+
+  struct stat sb;                      /* ok */
+  stat(filename, &sb);                 /* ok */
+  printf("%d\n", sb.st_size);          /* oops: sb.st_size is off_t */
+       /* this produces a warning under SGI's N32 ABI too, see below */
+
+  long now;
+  time(&now);                          /* oops: time() takes (time_t *) */
+
+

+Here are the same examples, corrected for clean 32-bit and 64-bit +compilation and operation:

+
+  size_t length = strlen(str);         /* better */
+  int length = (int) strlen(str);      /* an alternative */
+  int length = ap_strlen(str);         /* another alternative */
+
+  int r = (int) read(fd, buf, n);      /* better - see below */
+
+  struct stat sb;                      /* ok */
+  stat(filename, &sb);                 /* ok */
+  printf("%ld\n", (long) sb.st_size);  /* better - see below */
+
+  time_t now;
+  time(&now);                          /* better */
+
+

+The general rule is: always use the appropriate type (size_t, +etc.), not the base type you think that type is defined as. However, +most character strings are shorter than 2 GB so using int + to store a strlen() result (with a cast to appease the +compiler) is just fine. ap_strlen() is a convenience macro +that just casts strlen()'s result to int.

+

+See the sections below for the rule exceptions for file +sizes and printfs.

+

+Apache Typedefs

+

+Apache defines four types that are guaranteed to be the right size for +certain uses. These types are defined in the source file src/include/ap_types.h.

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Type NameDescriptionUse
ap_int32signed 32-bit integerwhen at most or exactly 32 bits are required
ap_uint32unsigned 32-bit integerwhen at most or exactly 32 bits are required
ap_ptrunsigned pointer-sized integer
+ (size varies)
for storing and performing arithmetic on addresses
ap_atomicunsigned atomically-updatable integer
+ (at least as large as ap_ptr)
for atomic operations
+
+

+Use ap_int32 and ap_uint32 instead of int/long + and unsigned int/long when you need at most +or exactly 32 bits. (You could use int or unsigned +int in SGI's 64-bit ABI, but future 64-bit ABIs may define int + as 64 bits.)

+
+  struct binary_log_entry {     /* on-disk binary log entry format */
+    ap_uint32  ip_addr;         /* IP address of requester */
+    ap_int32   time;            /* time requested */
+    ap_int32   nbytes;          /* number of body bytes in response */
+      /* ... */
+  };
+
+  #define FLAG0  ((ap_uint32) 0x00000001)
+  #define FLAG1  ((ap_uint32) 0x00000002)
+    /* ... */
+  #define FLAG30 ((ap_uint32) 0x40000000)
+  #define FLAG31 ((ap_uint32) 0x80000000)
+    /* (ap_uint32) cast avoids accidental 64-bit sign extension on FLAG31 */
+
+

+That reminds me: Avoid using the L or UL + suffix on constants; cast the constant to ap_int32 or ap_uint32 + instead. Beware constants with bit 31 (0x80000000) set, including -1 + and ~0. Broken examples:

+
+  #define FOO    4096UL                    /* oops: scales */
+  #define BIG    0xFFFFFFFFL               /* oops: sign-extends */
+
+  /* oops: in 64-bit Apache INADDR_NONE is 0xFFFFFFFFFFFFFF but
+   * inet_addr() returns 0xFFFFFFFF on failure */
+  #define INADDR_NONE ((unsigned long) -1)
+  unsigned long my_addr;
+  if ((my_addr = inet_addr(w)) != INADDR_NONE) /* ... */;
+
+

+Fixed examples:

+
+  #define FOO    ((ap_uint32) 4096)        /* better */
+  #define BIG    ((ap_uint32) 0xFFFFFFFF)  /* better */
+
+  /* better */
+  #define INADDR_NONE ((ap_uint32) -1)
+  ap_uint32 my_addr;
+  if ((my_addr = inet_addr(w)) != INADDR_NONE) /* ... */;
+
+

+Use ap_ptr for storing and performing arithmetic on +addresses. See below for details.

+

+Use ap_atomic for atomically-updatable data.

+

+Pointers

+

+Pointers are the same size as ints in 32-bit but not +64-bit programming environments. The following common constructs cause +problems:

+
+  int length = string2 - string1;          /* oops: result is long */
+
+  unsigned int address = (unsigned int) &anything;
+                                           /* oops: pointer is long */
+
+

+Corrected examples:

+
+  size_t length = string2 - string1;       /* better */
+  int length = (int) (string2 - string1);  /* an alternative */
+
+  unsigned long address = (unsigned long) &anything;  /* better */
+  ap_ptr address = (ap_ptr) &anything;     /* an alternative */
+
+

+Use ap_ptr, size_t, or ptrdiff_t + for pointer manipulation unless you're sure the result of pointer +subtraction is a small integer in which case cast and assign the result +to int.

+

+To store a constant or integer value into a variable having a pointer +type without compiler warnings, you must first cast the data to the +scaling type ap_ptr and then cast that to the pointer +type, like this:

+
+  void *vp = (void *) (ap_ptr) 1;
+  struct myfd *fp = (struct myfd *) (ap_ptr) fd;   /* fd is int */
+
+

+(I think this is yucky but I couldn't find a better way.)

+

+File Sizes

+

+In SGI's 64-bit ABI file sizes (off_t) are 64 bits wide, +i.e., files can be larger than 4 GB (theoretically up to 16 exabytes +[EB]). (Incidentally, off_t is 64 bits wide in SGI's N32 +ABI too, but not SGI's O32 ABI.) However, 64-bit Apache currently +forbids serving files whose sizes overflow 32 bits. It is possible to +enhance Apache to serve very large files but I chose not to do so. The +function ap_oversized_file() returns nonzero if a file is +too large to serve. Here is an example, heavily trimmed for clarity, of +how to serve a file in both 32-bit and 64-bit Apache:

+
+  struct stat sb;
+  int fd, nbytes;
+
+  stat(filename, &sb);
+  if (ap_oversized_file(sb.st_size)) {
+    ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, request,
+      "%s: File too large", filename);
+    return HTTP_NOT_IMPLEMENTED;
+  }
+
+  fd = open(filename, O_RDONLY);
+  while ((nbytes = (int) read(fd, buf, bufsiz)) > 0)
+    ap_rwrite(request, buf, nbytes);
+  close(fd);
+  return OK;
+
+

+The example checks the validity of the file size first, and safely +truncates the result from read() to an int.

+

+Printf Conversions

+

+At first glance it seems difficult to format output using printf(), sprintf(), +and the like without a priori knowledge of type sizes. In a 32-bit ABI %d + (and %o, %u, and %x) and %ld + (and %lo, %lu, and %lx) convert +a 32-bit integer, but in a 64-bit ABI %d (et al) converts +a 32-bit integer and %ld (et al) converts a 64-bit +integer. The following example is erroneous under both ABIs:

+
+  struct stat sb;                            /* ok */
+  stat(filename, &sb);                       /* ok */
+  printf("size is %d\n", sb.st_size);        /* oops: st_size scales */
+  printf("mod time is %ld\n", sb.st_mtime);  /* oops: st_mtime is int */
+
+

+There are solutions that I consider messy, such as using #ifdef + to select between different format strings or using #define + to select conversion strings and string concatenation to insert them +into the output string, and one that I think is simple and clean: +Always use the long form conversions (%ld, %lx, +etc.) and cast the data to long or unsigned long, +no matter what its original type.

+
+  struct stat sb;                            /* ok */
+  stat(filename, &sb);                       /* ok */
+  printf("size is %ld\n", (long) sb.st_size);  /* better */
+  printf("mod time is %ld\n", (long) sb.st_mtime);  /* better */
+
+  printf("pid is %ld\n", (long) getpid());
+  printf("address is %#lx\n", (unsigned long) &mumble);
+  printf("sent %lu bytes\n", (unsigned long) nbytes);
+
+

+SGI's 64-bit compiler checks printf-like format conversions against the +type of the corresponding arguments and generates warnings when they +don't match (%d with an argument of type long, +for instance). If you write your own formatting routine, preface its +definition and declarations with the lint-style comment /*PRINTFLIKEn*/ + to allow the compiler to compare the conversions with the arguments. n + is the ordinal of the format string.

+
+  /*PRINTFLIKE2*/
+  extern int myprintf(int mystuff, const char *fmt, ...);
+  myprintf(xyz, "this page visited %ld times\n", (long) count);
+
+

+General

+

+Beware shifting, anding or oring (<< >> & | + operators) beyond 32 bits and performing arithmetic (+ - * / + operators) that might over- or underflow 32 bits. Truncation to 32 +bits is implicit in a 32-bit ABI but not in a 64-bit ABI.

+

+SGI's struct timeval (defined in <sys/time.h>) +is defined such that the tv_sec field is 32 bits and the tv_usec + field is 64 bits. I have no idea why; it seems wrong to me. But +anyway, this causes the compiler to warn about the following construct:

+
+  tv.tv_sec = tv.tv_usec = 0;   /* oops: assigning 64 bits to 32 */
+
+

+The simple workaround is to separate this into two lines:

+
+  tv.tv_sec = 0;                /* better */
+  tv.tv_usec = 0;
+
+

+Performance

+

+64-bit Apache actually runs slightly slower than 32-bit Apache due to +the increased word size but it allows the mmap_static module to map enormous +amounts of file data.

+

+Porting to Other 64-bit ABIs

+

+As mentioned above, the only 64-bit ABI Apache supports currently is +SGI's. Porting to other 64-bit ABIs that use the LP64 model should be +straightforward, probably consisting mostly of enabling the equivalent +of the -fullwarn compiler option to identify problem areas +and modifying Apache's source code to handle your system's type quirks (size_t, off_t, +etc.) if they differ from SGI's. Porting to an ILP64 model, where ints +are also 64 bits, will require a larger effort to change all uses of int.

+

+See also

+

+SGI's MIPSpro +64-Bit Porting and Transition Guide contains excellent detailed +information about porting 32-bit applications to 64 bits.

+

+Refer to your system's programming documentation for details about its +64-bit implementation.

+
+

+Apache HTTP Server Version 1.3

+

+Index

+ + diff -Naur apache_1.3.12/htdocs/manual/bind.html-orig apache_1.3.12/htdocs/manual/bind.html --- apache_1.3.12/htdocs/manual/bind.html-orig Wed Feb 23 15:11:39 2000 +++ apache_1.3.12/htdocs/manual/bind.html Wed Feb 9 17:34:31 2000 @@ -72,7 +72,7 @@ Syntax: Listen [ port | IP-address:port ]
+>Syntax: Listen [ port | IP-address:port ] [ CPU-num ]
Port directive. If an IP address is given as well as a port, the server -will listen on the given port and interface.

Multiple Listen +will listen on the given port and interface. + +

The optional CPU-num argument specifies a CPU to which child +processes listening to this address should be bound, when the SingleListen option is +on. + +

Multiple Listen directives may be used to specify a number of addresses and ports to listen to. The server will respond to requests from any of the listed addresses and ports.

@@ -131,6 +138,7 @@ Virtual Hosts, BindAddress directive, Port directive, +SingleListen directive, DNS Issues and <VirtualHost> section. diff -Naur apache_1.3.12/htdocs/manual/index.html-orig apache_1.3.12/htdocs/manual/index.html --- apache_1.3.12/htdocs/manual/index.html-orig Wed Feb 23 15:11:39 2000 +++ apache_1.3.12/htdocs/manual/index.html Wed Feb 9 17:34:31 2000 @@ -47,6 +47,8 @@

  • Special purpose environment variables
  • The Apache API
  • Using SetUserID Execution for CGI +
  • Guide to 64-bit Apache +
  • The Quick Shortcut Cache

    Other Notes

    diff -Naur apache_1.3.12/htdocs/manual/invoking.html-orig apache_1.3.12/htdocs/manual/invoking.html --- apache_1.3.12/htdocs/manual/invoking.html-orig Wed Feb 23 15:11:39 2000 +++ apache_1.3.12/htdocs/manual/invoking.html Wed Feb 9 17:34:31 2000 @@ -139,6 +139,10 @@
    Windows only: signal Apache to restart or shutdown. option is one of "shutdown" or "restart". (Apache 1.3.3 and later). +
    -i +
    For testing: Do not daemonize (i.e., do not fork and exit on startup). +(Apache 1.3.X and later.) +
    -?
    Print a list of the httpd options, and then exit (up to Apache 1.3.3. Later version use -h instead). diff -Naur apache_1.3.12/htdocs/manual/misc/API.html-orig apache_1.3.12/htdocs/manual/misc/API.html --- apache_1.3.12/htdocs/manual/misc/API.html-orig Wed Feb 23 15:11:39 2000 +++ apache_1.3.12/htdocs/manual/misc/API.html Wed Feb 9 17:34:31 2000 @@ -36,6 +36,9 @@ some cases, they really are things I just haven't gotten around to yet. Welcome to the bleeding edge.

    +See also the Guide to 64-Bit Apache for +tips on how to program for both 32-bit and 64-bit versions of Apache.

    + Finally, here's an outline, to give you some bare idea of what's coming up, and in what order: diff -Naur apache_1.3.12/htdocs/manual/misc/client_block_api.html-orig apache_1.3.12/htdocs/manual/misc/client_block_api.html --- apache_1.3.12/htdocs/manual/misc/client_block_api.html-orig Wed Feb 23 15:11:39 2000 +++ apache_1.3.12/htdocs/manual/misc/client_block_api.html Wed Feb 9 17:34:31 2000 @@ -41,7 +41,7 @@

        int ap_setup_client_block (request_rec *, int read_policy);
        int ap_should_client_block (request_rec *);
    -   long ap_get_client_block (request_rec *, char *buffer, int buffer_size);
    +   ap_int32 ap_get_client_block (request_rec *, char *buffer, int buffer_size);
     
      diff -Naur apache_1.3.12/htdocs/manual/misc/fin_wait_2.html-orig apache_1.3.12/htdocs/manual/misc/fin_wait_2.html --- apache_1.3.12/htdocs/manual/misc/fin_wait_2.html-orig Wed Feb 23 15:11:39 2000 +++ apache_1.3.12/htdocs/manual/misc/fin_wait_2.html Wed Feb 9 17:34:31 2000 @@ -189,7 +189,8 @@ support a timeout. For IRIX 5.3, 6.2, and 6.3, use patches 1654, 1703 and 1778 respectively. If you have trouble locating these patches, please contact your - SGI support channel for help. + SGI support channel for help. IRIX 6.5 supports the timeout + without needing a patch.
    1. NCR's MP RAS Unix 2.xx and 3.xx both have FIN_WAIT_2 timeouts. In 2.xx it is non-tunable at 600 seconds, while in 3.xx it defaults to 600 seconds and diff -Naur apache_1.3.12/htdocs/manual/misc/perf-mja.html-orig apache_1.3.12/htdocs/manual/misc/perf-mja.html --- apache_1.3.12/htdocs/manual/misc/perf-mja.html-orig +++ apache_1.3.12/htdocs/manual/misc/perf-mja.html Thu Feb 17 10:58:50 2000 @@ -0,0 +1,536 @@ + + + + + Making Apache Ten Times Faster + + + +

      +

      [APACHE DOCUMENTATION]

      +

      +Apache HTTP Server Version 1.3

      +

      +

      +

      +Making Apache Ten Times Faster

      +

      +Mike Abbott - mja@sgi.com
      +Accelerating Apache Project

      +

      +

      +I have contributed a bunch of +patches to the Apache Project that together increase the performance +of the Apache HTTP server up to 900%. This document summarizes how to +maximize the performance of Apache using my patches. The measure of +performance in this document is the SPECweb96 benchmark, which +measures only the number of static HTTP/1.0 GET requests a web server +can service per second. This paper assumes a working knowledge of Apache +internals.

      +
      +The advice that follows may or may not apply to your system and may +increase or decrease your system's performance depending on factors +beyond the scope of this document. Use this guide only in conjunction +with a clear understanding of your performance goals and overriding +needs.
      +

      +Contents

      + +

      +Introduction

      +

      +The patches + I contributed to the Apache Project modify Apache's source code and +standard configuration files to speed up the processing of HTTP +requests in various ways. Still, Apache must be configured, compiled, +and tuned to achieve the best performance on a given system. The +following sections describe the configurable options relevant for high +performance.

      +

      +The options fall into four categories by what they control: the QSC, +Apache's child processes, direct I/O, and other.

      +

      +Tuning the QSC

      +

      +The Quick Shortcut Cache (QSC) cuts out +unnecessary processing for requests to cached static content. It sports +a number of configurable options. +Two of these, QSC_HASH_SIZE and QSC_MAX_SIZE, +limit the maximum size of the cache and almost certainly need to be +increased from their default values to provide the maximum benefit for +a given system. A third, QSC_HEADER_GRAIN (which normally +uses the same value as CACHE_ALIGNMENT), regulates +alignment and padding and can improve performance more than you might +think when set correctly. See the QSC +documentation for details on these +options and for instructions on using +the QSC.

      +

      +Also, the QSC can manage the very large amounts of data enabled by a 64-bit address space although with a slight +performance penalty.

      +

      +As patched, Apache's standard run-time configuration file httpd.conf + enables the QSC when the mmap_static module is installed. Leave the QSC +on directive as is.

      +

      +Summary of options in this section:

      + +

      +Tuning Child Processes

      +

      +Under heavy load, a system can spend most of its computing power +creating, destroying, and scheduling Apache +child processes. Eliminating all this overhead allows the system to +spend more of its time processing HTTP requests but reduces Apache's +ability to adapt to a changing load.

      +

      +As patched, Apache's standard run-time configuration file httpd.conf + removes the limit on the number of requests each child process handles +before terminating itself and forcing the parent Apache process to fork +a replacement. Leave the MaxRequestsPerChild + 0 directive as is.

      +

      +Choose a number of processes and force Apache always to use that +number, never more or less. Set the MinSpareServers, MaxSpareServers, StartServers, +and MaxClients + options all to the same value and ignore the resulting warning:

      +
      +server reached MaxClients setting, consider raising the +MaxClients setting
      +

      +The number you use is up to you but remember, sometimes having fewer +processes runs faster than having more. Start with, say, two per +network interface and increase from there as necessary.

      +

      +Bind interrupts from network interface devices to specific processors +(distributing them as evenly as possible across all the processors) and +bind the Apache child processes listening to those interfaces to the +same processors using the Listen + directive. Force each child process to listen only to its designated +interface -- and eliminate performance-sapping accept serialization + -- by turning SingleListen + on.

      +

      +Summary of options in this section:

      + +

      +Direct I/O

      +

      +Direct I/O is the name for reading or writing data directly into +and out of user space without using the system's buffer cache.

      +

      +Normally Apache reads or memory-maps disk files containing content it +serves. The system DMAs data from disk into a system buffer. If Apache +uses read() the system copies the data into Apache's +memory; if Apache uses mmap() it and the system share the +system buffer's memory. Either way, the system maintains the cache of +buffered data which it manages without guidance from Apache. In +particular, the system can choose to invalidate any data in its buffer +cache when it needs to insert new data into a full cache. If the system +chooses poorly, it quickly becomes disk-bound re-reading data it just +had in its cache that it evicted to make room for other data. This +problem does not occur when the system has enough memory to store all +the files Apache serves (at once), a configuration I recommend. But +when memory is tight, direct I/O can help.

      +

      +Direct I/O bypasses the system's buffer cache. When Apache uses direct +I/O read() the system DMAs data from disk directly into +Apache's memory. Judicious use can reduce thrashing of the buffer +cache, but overuse can lead to similarly degraded performance because +every read() causes disk I/O. (Memory mapping cannot be +used with direct I/O.)

      +

      +At this time Apache supports only SGI's Irix implementation of direct +I/O.

      +

      +When USE_DIRECT_IO is defined, Apache's default request +handler will attempt to use direct I/O to serve files that are DIRECT_THRESHOLD + bytes in size or larger (default 64 MB). I say "attempt" +because direct I/O requires stringent data alignment which certain +types of requests (in particular, data ranges) violate. If Apache +cannot use direct I/O it falls back to using either mmap() + or read(). Note that only the default handler tries +direct I/O and that, in particular, the mmap_static module's handler +does not. To make Apache try direct I/O you must not include an mmapfile + directive for that file.

      +

      +Apache limits its use of direct I/O to large files on the assumption +that it serves small files more often than large ones, and because +under low memory conditions a single large file blows away many small +files in the system's buffer cache. This scheme increases the chance +that small files will remain buffered, helping performance.

      +

      +Two other parameters help control Apache's use of direct I/O. MAX_DIRECT_ALIGN + sets the maximum alignment boundary permissible when using direct I/O, +in bytes (default 4 KB). MAX_DIRECT_BUFSIZE sets the size +of the buffer Apache uses when performing direct I/O, in bytes (default IOBUFSIZE). +If the file's alignment restrictions exceed these parameters Apache +will log a warning and not use direct I/O for that file. Both +parameters must be powers of two greater than zero and can be changed +at will.

      +

      +Summary of options in this section:

      +
        +
      • + configure options: +
          +
        • + none +
        +
      • + Compilation options: +
          +
        • + -DUSE_DIRECT_IO +
        • + -DDIRECT_THRESHOLD=something +
        • + -DMAX_DIRECT_ALIGN=something +
        • + -DMAX_DIRECT_BUFSIZE=something +
        +
      • + Run-time configuration options: +
          +
        • + omit mmapfile directives for files on which you + want Apache to try direct I/O +
        +
      +

      +General Tuning

      +

      +Always compile optimized.

      +

      +Define SPEED_DAEMON which defines all of these other +tokens:

      +
        +
      • + USE_QSC - enables the QSC +
      • + FAST_TIME - speeds up time-keeping +
      • + BUFFERED_LOGS - buffers server log entries +
      • + NO_GRACEFUL - eliminates signal overhead but disables graceful restarts +
      • + USE_QUICK_LOG - accelerates logging in common-log format +
      +

      +Define the value of LOG_BUFSIZE + to be some multiple of the system's page size, less a few dozen bytes +or so for overhead.

      +

      +Use only the Common Log Format.

      +

      +Raise the limit on the number of response bytes written at a time by +defining the value of MMAP_SEGMENT_SIZE to be larger than +the largest cached file -- but not on Linux, where this actually slows +things down!

      +

      +Make the listen queue size as large as possible using the ListenBacklog + directive.

      +

      +Summary of options in this section:

      + +

      +Example

      +

      +Here is the configuration I use to achieve maximum SPECweb96 +performance on an SGI Origin200 server running Irix 6.5 with two +processors, two gigabytes of memory, and four 100BaseT network +interfaces. Without any patching or tuning Apache on this system +handles 240 operations per second; with my patches and the following +tuning it handles 2400*.

      +
      +* These are actual SPECweb96 results and while I believe they are +accurate and meaningful, they have not been submitted to SPEC for +review or publication. The following is for illustrative purposes only +and is not a SPECweb96 disclosure.
      +
        +
      • + configure options: +
          +
        • + --enable-module=mmap_static --enable-module=info +
        +
      • + Compilation options: +
          +
        • + -O2 +
        • + -DSPEED_DAEMON +
        • + -DLOG_BUFSIZE=65500 +
        • + -DMMAP_SEGMENT_SIZE=1048576 +
        • + -DQSC_HASH_SIZE=32768 +
        • + -DQSC_MAX_SIZE=5000000 +
        +
      • + Run-time configuration options: +
        +ServerType standalone
        +ServerName something
        +ServerAdmin root
        +ServerRoot /a/apache
        +ServerSignature Off
        +PidFile /a/apache/logs/httpd.pid
        +ScoreBoardFile /a/apache/logs/httpd.scoreboard
        +Timeout 300
        +KeepAlive On
        +MaxKeepAliveRequests 0
        +KeepAliveTimeout 15
        +MinSpareServers 12
        +MaxSpareServers 12
        +StartServers 12
        +MaxClients 12
        +MaxRequestsPerChild 0
        +User nobody
        +Group nobody
        +Port 80
        +Listen 100.100.100.101:80 0
        +Listen 100.100.100.102:80 0
        +Listen 100.100.100.103:80 1
        +Listen 100.100.100.104:80 1
        +ListenBacklog 1000
        +SingleListen on
        +QSC on
        +
        +ClearModuleList
        +AddModule mod_mmap_static.c
        +AddModule mod_log_config.c
        +
        +DocumentRoot "/a/htdocs"
        +<Directory />
        +    Options FollowSymLinks
        +    AllowOverride None
        +</Directory>
        +UseCanonicalName Off
        +DefaultType text/plain
        +HostnameLookups Off
        +ErrorLog /b/logs/errors-apache
        +LogLevel warn
        +LogFormat "%a %l %u %t \"%r\" %>s %b" quick
        +CustomLog /b/logs/access-apache quick
        +
        +AddModule mod_mime.c
        +AddModule mod_status.c
        +AddModule mod_info.c
        +<Location /server-status>
        +    SetHandler server-status
        +</Location>
        +<Location /server-info>
        +    SetHandler server-info
        +</Location>
        +
        +mmapfile /a/htdocs/spec/file_set/dir0/class0_0
        +mmapfile /a/htdocs/spec/file_set/dir0/class0_1
        +mmapfile /a/htdocs/spec/file_set/dir0/class0_2
        +mmapfile /a/htdocs/spec/file_set/dir0/class0_3
        + ...
        +mmapfile /a/htdocs/spec/file_set/dir223/class3_5
        +mmapfile /a/htdocs/spec/file_set/dir223/class3_6
        +mmapfile /a/htdocs/spec/file_set/dir223/class3_7
        +mmapfile /a/htdocs/spec/file_set/dir223/class3_8
        +AddModuleInfo mod_mmap_static.c "Configured for 2500 SPECweb96 ops/sec"
        +
        +
      +

      +Direct I/O is neither needed nor used because the entire SPECweb96 file +set fits in memory in this example. If the system had less memory I +would add:

      +
        +
      • + Compilation options: +
          +
        • + -DUSE_DIRECT_IO +
        • + -DDIRECT_THRESHOLD=800000 +
        • + -DMAX_DIRECT_BUFSIZE=65536 +
        +
      +

      +and delete the mmapfile directives for all class3_8 files:

      +
        +
      • + Run-time configuration options: +
        +# mmapfile /a/htdocs/spec/file_set/dir0/class3_8
        + ...
        +# mmapfile /a/htdocs/spec/file_set/dir223/class3_8
        +
        +
      +

      +and maybe class3_7, class3_6, and others too +until the system performs as few disk reads as possible during the +benchmark run.

      +

      +See also

      + +
      +

      +Apache HTTP Server Version 1.3

      +

      +Index

      + + diff -Naur apache_1.3.12/htdocs/manual/misc/perf-tuning.html-orig apache_1.3.12/htdocs/manual/misc/perf-tuning.html --- apache_1.3.12/htdocs/manual/misc/perf-tuning.html-orig Wed Feb 23 15:11:39 2000 +++ apache_1.3.12/htdocs/manual/misc/perf-tuning.html Thu Feb 10 15:21:06 2000 @@ -39,6 +39,13 @@ performance out of Apache's current model, and want to understand why it does some things which slow it down. +

      Mike Abbott from SGI has increased Apache's performance ten-fold for +static HTTP GET requests such as those issued by the SPECweb96 benchmark. See +his tuning document and SGI's Web Server Performance Tuning +Guide for more information. +

      Note that this is tailored towards Apache 1.3 on Unix. Some of it applies to Apache on NT. Apache on NT has not been tuned for performance yet, in fact it probably performs very poorly because NT performance requires @@ -238,7 +245,7 @@ contains timing indications. For highest performance, set ExtendedStatus off (which is the default). -

      accept Serialization - multiple sockets

      +

      accept Serialization - multiple sockets

      This discusses a shortcoming in the Unix socket API. Suppose your diff -Naur apache_1.3.12/htdocs/manual/misc/perf.html-orig apache_1.3.12/htdocs/manual/misc/perf.html --- apache_1.3.12/htdocs/manual/misc/perf.html-orig Wed Feb 23 15:11:39 2000 +++ apache_1.3.12/htdocs/manual/misc/perf.html Thu Feb 10 15:21:06 2000 @@ -33,6 +33,7 @@

    2. BSD-based (BSDI, FreeBSD, etc)
    3. Digital UNIX
    4. HPUX +
    5. SGI IRIX
    6. Linux
    7. Solaris
    8. SunOS 4.x @@ -73,6 +74,15 @@
    9. We have some newsgroup postings on how to tune Digital UNIX 3.2 and 4.0. + +


      +

      +IRIX +

      + +See Mike Abbott's performance tuning +document and SGI's Web Server +Performance Tuning Guide.


      diff -Naur apache_1.3.12/htdocs/manual/mod/core.html-orig apache_1.3.12/htdocs/manual/mod/core.html --- apache_1.3.12/htdocs/manual/mod/core.html-orig Wed Feb 23 15:11:39 2000 +++ apache_1.3.12/htdocs/manual/mod/core.html Wed Mar 1 17:04:18 2000 @@ -76,6 +76,7 @@
    10. Options
    11. PidFile
    12. Port +
    13. QSC
    14. require
    15. ResourceConfig
    16. RLimitCPU @@ -93,6 +94,7 @@
    17. ServerSignature
    18. ServerTokens
    19. ServerType +
    20. SingleListen
    21. StartServers
    22. ThreadsPerChild
    23. ThreadStackSize @@ -1432,7 +1434,7 @@ Apache 1.3.2 and later.

      -Number is a long integer from 0 (meaning unlimited) to 2147483647 +Number is an integer from 0 (meaning unlimited) to 2147483647 (2GB). The default value is defined by the compile-time constant DEFAULT_LIMIT_REQUEST_BODY (0 as distributed).

      @@ -1604,7 +1606,7 @@ HREF="directive-dict.html#Syntax" REL="Help" >Syntax: -Listen [IP address:]port number
      +Listen [IP address:]port number [CPU-num]
      Compatibility: Listen is only available in Apache -1.1 and later.

      +1.1 and later. +The optional CPU-num argument is only available in Apache 1.3.7 and later.

      The Listen directive instructs Apache to listen to more than one IP address or port; by default it responds to requests on all IP @@ -1657,6 +1660,11 @@ Listen 192.170.2.5:8000 +

      The optional CPU-num argument specifies the CPU to which Apache child +processes listening exclusively to this address/port should be bound. +See the SingleListen directive for +detailed information. +

      See Also: DNS Issues
      See Also: @@ -2376,6 +2384,34 @@ root whilst handling connections, your site may be open to a major security attack.


      +

      QSC directive

      + +Syntax: QSC on|off
      +Default: <IfModule mod_mmap_static.c> QSC on </IfModule> else QSC off
      +Context: server config
      +Status: core
      +Compatibility: The QSC is only available in Apache +1.3.X and later. +

      +This directive enables or disables the Quick Shortcut Cache. +

      +


      +

      require directive

      + +
      +

      SingleListen directive

      + +Syntax: SingleListen on|off
      +Default: SingleListen off
      +Context: server config
      +Status: core
      +Compatibility: SingleListen is only available in Apache +1.3.7 and later. +

      +This directive controls the set of IP addresses (and ports) to which +child processes listen. When SingleListen is on, each child process +listens to a single IP address and port from the list specified using +Listen directives. Listen addresses are distributed evenly across child +processes. This is a high-performance, but not necessarily +general-purpose, way to solve the thorny accept-serialization +problem found with multiple Listen addresses. When off, the +default, each child process listens to all Listen addresses +simultaneously. +

      +This directive also enables another performance optimization for systems +with multiple CPUs and multiple network interfaces. When the device +interrupts from each network interface are bound to particular CPUs and +the Apache child processes listening for requests from those interfaces +are bound to the same CPUs, performance is increased due to +cache-warming. (Listen directives specify IP-address/CPU-number pairs.) +This optimization is particularly helpful on cache-coherent non-uniform +memory access (ccNUMA) systems such as SGI's Origin series because it +also increases memory reference locality. CPU binding is disabled if +SingleListen is off. +

      +Here is an example of this: +

      Listen 111.22.33.44 0
      +Listen 111.22.33.45 1
      +Listen 111.22.33.46 2
      +Listen 111.22.33.47 3
      +SingleListen on
      +
      +Apache child processes listening to requests from 111.22.33.44 are bound +to CPU 0, child processes listening to 111.22.33.45 are bound to CPU 1, +and so on. When this configuration is used on a four-CPU system where +interrupts from the network controller for 111.22.33.44 are bound to CPU +0, interrupts from 111.22.33.45 are bound to CPU 1, and so on, +performance is increased over a system lacking such binding. Note that +binding child processes to CPUs other than those to which the network +interrupts are bound may result in worse performance. +

      +See also the Listen directive, +the status module, and +the performance tuning guide. +

      +


      StartServers directive

      diff -Naur apache_1.3.12/htdocs/manual/mod/directives.html-orig apache_1.3.12/htdocs/manual/mod/directives.html --- apache_1.3.12/htdocs/manual/mod/directives.html-orig Wed Feb 23 15:11:39 2000 +++ apache_1.3.12/htdocs/manual/mod/directives.html Wed Mar 1 17:04:18 2000 @@ -171,6 +171,7 @@
    24. ProxyRemote
    25. ProxyRequests
    26. ProxyVia +
    27. QSC
    28. ReadmeName
    29. Redirect
    30. RedirectMatch @@ -215,6 +216,7 @@
    31. SetEnvIf
    32. SetEnvIfNoCase
    33. SetHandler +
    34. SingleListen
    35. StartServers
    36. ThreadsPerChild
    37. TimeOut diff -Naur apache_1.3.12/htdocs/manual/mod/mod_log_config.html-orig apache_1.3.12/htdocs/manual/mod/mod_log_config.html --- apache_1.3.12/htdocs/manual/mod/mod_log_config.html-orig Wed Feb 23 15:11:39 2000 +++ apache_1.3.12/htdocs/manual/mod/mod_log_config.html Wed Feb 9 17:34:31 2000 @@ -179,9 +179,10 @@

      Note that the common log format is defined by the string "%h %l -%u %t \"%r\" %s %b", which can be used as the basis for +%u %t \"%r\" %>s %b", which can be used as the basis for extending for format if desired (e.g., to add extra fields at the end). -NCSA's extended/combined log format would be "%h %l %u %t \"%r\" %s %b \"%{Referer}i\" \"%{User-agent}i\"". +NCSA's extended/combined log format would be "%h %l %u %t \"%r\" +%>s %b \"%{Referer}i\" \"%{User-agent}i\"".

      @@ -212,6 +213,33 @@ See the examples below.

      +

      Performance Issues

      + +When Apache is compiled with USE_QUICK_LOG defined, logging +in Common Log Format (CLF) is extra fast. This module recognizes and +accelerates two variants of CLF: + +
        +
      • standard CLF ("%h %l %u %t \"%r\" %>s %b") +
      • numeric CLF ("%a %l %u %t \"%r\" %>s %b") +
      + +Numeric CLF is the same as using standard CLF with HostNameLookups off: +both log IP addresses rather than host names. Logging IP addresses is +much faster than logging host names. + +

      Buffering log entries also increases performance, but at the cost of +delaying writing those entries to disk. Compile Apache with +BUFFERED_LOGS defined to buffer log entries. The standard +amount buffered is PIPE_BUF bytes (a POSIX defined +constant). For an even faster web server you can increase the buffering +by defining LOG_BUFSIZE to be the number of bytes you want +buffered. Beware though: increase LOG_BUFSIZE beyond +PIPE_BUF only if you know you're not using piped logs and +your system can write more than PIPE_BUF bytes atomically +to disk at once +

      Security Considerations

      See the security tips @@ -370,7 +398,7 @@ HREF="directive-dict.html#Default" REL="Help" >Default: LogFormat "%h %l %u %t \"%r\" -%s %b"
      +%>s %b"

      +

      + Use of this module allows use of the Quick Shortcut (or Static-content) + Cache (QSC) for very fast static-content serving. + See the QSC documentation for details. +

      +

      Summary

      This is an experimental module and should be used with @@ -42,6 +48,8 @@ call is available on most modern Unix derivates, but not on all. There are sometimes system-specific limits on the size and number of files that can be mmap()d, experimentation is probably the easiest way to find out. + 64-bit Apache can map more data than 32-bit + Apache can, but neither can map files larger than around 2 GB.

      This mmap()ing is done once at server start or restart, only. So whenever @@ -55,6 +63,10 @@ this. The reason why this modules doesn't take care of changes to the files is that this check would need an extra stat() every time which is a waste and against the intent of I/O reduction. +

      +

      + Note that mapping a large number of files greatly increases server + start-up and restart time.

      Directives

      diff -Naur apache_1.3.12/htdocs/manual/mod/mod_status.html-orig apache_1.3.12/htdocs/manual/mod/mod_status.html --- apache_1.3.12/htdocs/manual/mod/mod_status.html-orig Wed Feb 23 15:11:39 2000 +++ apache_1.3.12/htdocs/manual/mod/mod_status.html Wed Feb 9 17:34:31 2000 @@ -47,6 +47,8 @@
    38. The current percentage CPU used by each child and in total by Apache (*)
    39. The current hosts and requests being processed (*) +
    40. QSC statistics, if the QSC is +present and enabled. A compile-time option must be used to display the details marked "(*)" as diff -Naur apache_1.3.12/htdocs/manual/qsc.html-orig apache_1.3.12/htdocs/manual/qsc.html --- apache_1.3.12/htdocs/manual/qsc.html-orig +++ apache_1.3.12/htdocs/manual/qsc.html Thu Feb 17 10:58:50 2000 @@ -0,0 +1,706 @@ + + + + + The Quick Shortcut Cache (QSC) + + + +

      +

      [APACHE DOCUMENTATION]

      +

      +Apache HTTP Server Version 1.3

      +

      +

      +

      +The Quick Shortcut Cache (QSC)

      +

      +Also known as the Quick Static-content Cache

      +

      +Mike Abbott - mja@sgi.com
      +Accelerating Apache Project

      +

      +

      +Apache/1.3.X and beyond support a very fast cache of static content and +HTTP response headers known as the Quick Shortcut (or Static-content) +Cache, or QSC. The QSC is meant for sites that serve lots of data as-is +from disk, such as images, unparsed HTML, and plain text. Sites that +serve mostly dynamically-generated content, such as CGI output or +on-disk content with headers or footers generated on the fly, probably +should not use the QSC.

      +

      +Contents

      + +

      +QSC Primer

      +

      +Normally Apache processes an HTTP request by following a long list of rules, such as converting the URI to a +file name, authenticating the request, generating HTTP headers for the +response, sending the response, and logging information about the +transaction. Apache performs all these steps (more or less) for every +request, even if it has handled the same request previously. This +memory-less behavior is required for steps such as authentication but +is unnecessary for URI-to-file translation and HTTP response header +generation when the response consists of static content. The QSC adds +memory to Apache, allowing it to shortcut the processing of +previously-seen requests for static content.

      +

      +Operation

      +

      +After Apache reads an HTTP request and locates the appropriate virtual host context in which to handle +the request, it checks whether the QSC can respond to the request -- +whether the request is cachable and whether the +URI and virtual host match a cached entry. If so, the QSC bypasses all +unnecessary processing and sends the previously-generated HTTP response +quickly, then Apache logs the transaction and moves on to the next +request.

      +

      +When the QSC cannot respond quickly, Apache continues processing the +request normally. When such normal processing results in the mmap_static module sending the +HTTP response, that module tries to insert the request and response +into the QSC -- which succeeds only if the request and response are cachable and the cache isn't full. +Finally, as with the cached response, Apache logs the transaction and +moves on to the next request. Note that the QSC caches both the +response headers and the response body.

      +

      +Interaction with the mmap_static Module

      +

      +Only the mmap_static module inserts entries into the QSC, for a number +of reasons:

      +
        +
      • + The mmap_static module keeps file contents mapped into memory so + sending the response body is simple and quick. (QSC entries point to + the memory-mapped file contents held by the mmap_static module; the QSC + sends this data as the HTTP response body.) +
      • + The mmap_static module responds only to requests for static content. +
      • + The mmap_static module responds only to requests for + explicitly-designated files. The administrator has full control. +
      • + Both the QSC and the mmap_static module reset themselves upon server + restarts. +
      • + Both the QSC and the mmap_static module share a sole purpose: to + increase performance. +
      +

      +Virtual Hosts

      +

      +When looking for a cache entry to satisfy a request, the QSC matches +the virtual host as well as the URI because different virtual hosts can +map the same URI to different files.

      +

      +Response Headers

      +

      +Each QSC entry contains two nearly identical sets of HTTP response +headers, one for keep-alive connections (the headers contain a Connection: +keep-alive header) and one for non-keep-alive connections (the +headers contain a Connection: close header). Caching both +versions allows the QSC to respond quickly regardless of the nature of +the connection and without having to generate the HTTP headers for each +request -- a key ingredient for quick response.

      +

      +Furthermore, the QSC aligns both sets of response headers on a certain +memory boundary and pads them out to a certain length. Generally this +alignment is the secondary cache line size of the system on which +Apache runs. When asked to send data out on a network, operating +systems typically align misaligned data by copying it. The QSC +pre-aligns the headers (and the mmap_static module automatically aligns +the body due to the nature of memory-mapping files) and pads the +headers (by adding spaces to the Server header value) to +eliminate this overhead. You can adjust or disable the +header alignment manually.

      +

      +Using the QSC

      +

      +This section describes how to compile and enable QSC support in your +Apache server.

      +

      +The QSC requires the mmap_static +module. In the standard Apache distribution neither the QSC nor the +mmap_static module are compiled into the server. You must add them both +to the compilation configuration to use the QSC:

      +
      +  $ CFLAGS=-DUSE_QSC configure --enable-module=mmap_static
      +  $ make
      +
      +

      +(The QSC is an enhancement to core Apache, while mmap_static is an +Apache module.) There are also advanced +options to controlling QSC behavior, described below.

      +

      +In addition, a run-time configuration directive, QSC, enables and disables +the QSC. By default the QSC is off (disabled) +but this snippet from the standard httpd.conf file enables it when the +mmap_static module is also compiled into the server:

      +
      +  <IfModule mod_mmap_static.c>
      +      QSC on
      +  </IfModule>
      +
      +

      +In other words, compiling both the QSC and the mmap_static module +automatically enables the QSC. The QSC directive exists to +allow you to disable it.

      +

      +You must also configure the mmap_static module by adding an mmapfile directive for +each file you want cached.

      +

      +Once configured the QSC will operate automatically.

      +

      +Shared Memory

      +

      +All of the data the QSC stores is in shared memory (memory accessible +to all of Apache's subprocesses) so that the cache is not duplicated +for each Apache child process. Systems that do not support anonymous +shared memory (that define neither HAVE_MMAP nor HAVE_SHMGET) +cannot use the QSC.

      +

      +Atomic Compare-and-Swap

      +

      +The QSC requires one piece of functionality that is completely new to +Apache and so has not had the benefit of years of multi-platform +porting: a way to compare and swap (cas) two values atomically +(i.e., in a thread-safe manner). All of the QSC's internal data +structures are stored in shared memory so every update to that data +must be done in a way that is guaranteed to be safe and correct for all +the child processes. If your attempt to compile the QSC fails with the +error "need atomic compare-and-swap function," you must port +the function qsc_cas() to your system.

      +

      +Monitoring the QSC

      +

      +The QSC gathers statistics about its operation. You can view these +statistics on the page that the status +module generates in response to requests of the form:

      +
      +  http://your.server.name/server-status
      +
      +

      +This section has examples and explanations of this information.

      +

      +This is what the status page looks like when the QSC is disabled:

      +
      +  Quick Shortcut Cache (QSC) Status:
      +  QSC disabled
      +
      +

      +There may be an explanation why the QSC is disabled in the server's +error log. The next example shows the statistics from a freshly-started +server with the QSC enabled:

      +
      +  Quick Shortcut Cache (QSC) Status:
      +    hit ratio            0/1 (0.00%)
      +    uncachable           1/1 (100.00%)
      +    uncachable misses    1/1 (100.00%)
      +    uncachable requests  0/1 (0.00%)
      +    uncachable responses 0/1 (0.00%)
      +    resets               1
      +  Hash table
      +    failed insertions    0
      +    entries              0
      +    duplicate entries    0
      +    bucket use           0/32768 (0.00%)
      +    hash effectiveness   0/0 (0.00%)
      +    longest chain        0
      +    avg. chain           0.0
      +    avg. nonempty chain  0.0
      +    Chain length histogram:
      +          1     2     3     4     5+
      +          0     0     0     0     0 
      +  Memory use (in bytes)
      +    table + misc         131104
      +    entries              0
      +    URIs                 0
      +    headers              0
      +    total                135264/5000000 (2.71%)
      +    mapped file data     0
      +    mapped file vaddrs   0 (0 16384-byte pages)
      +
      +

      +It's pretty clear that the cache is empty at this point. The next +example shows the statistics from the same server after running for a +while:

      +
      +  Quick Shortcut Cache (QSC) Status:
      +    hit ratio            2104749/2112853 (99.62%)
      +    uncachable           40/2112853 (0.00%)
      +    uncachable misses    40/8104 (0.49%)
      +    uncachable requests  0/2112853 (0.00%)
      +    uncachable responses 0/2112853 (0.00%)
      +    resets               1
      +  Hash table
      +    failed insertions    0
      +    entries              8064
      +    duplicate entries    0
      +    bucket use           7923/32768 (24.18%)
      +    hash effectiveness   7923/8064 (98.25%)
      +    longest chain        2
      +    avg. chain           0.2
      +    avg. nonempty chain  1.0
      +    Chain length histogram:
      +          1     2     3     4     5+
      +       7782   141     0     0     0 
      +  Memory use (in bytes)
      +    table + misc         131104
      +    entries              322560
      +    URIs                 246024
      +    headers              4128768
      +    total                4844640/5000000 (96.89%)
      +    mapped file data     1146761280
      +    mapped file vaddrs   1229455360 (75040 16384-byte pages)
      +
      +

      +The QSC computes some of the statistics (such as the hash chain +lengths, histogram, and memory use) only when requested, and computing +them frequently may interfere with normal server operation. You can +view a condensed statistics page that skips the computation by +appending ?qsc=quick to your request, like this:

      +
      +  http://your.server.name/server-status?qsc=quick
      +
      +

      +which produces this output:

      +
      +  Quick Shortcut Cache (QSC) Status:
      +    hit ratio            2104749/2112854 (99.62%)
      +    uncachable requests  0/2112854 (0.00%)
      +    uncachable responses 0/2112854 (0.00%)
      +    resets               1
      +  Hash table
      +    failed insertions    0
      +
      +

      +Alternatively, you can view detailed QSC information by appending ?qsc=full, +like this:

      +
      +  http://your.server.name/server-status?qsc=full
      +
      +

      +which produces this output (with a large portion omitted for brevity):

      +
      +  Quick Shortcut Cache (QSC) Status:
      +    hit ratio            2104749/2112855 (99.62%)
      +    uncachable           42/2112855 (0.00%)
      +    uncachable misses    42/8106 (0.52%)
      +    uncachable requests  0/2112855 (0.00%)
      +    uncachable responses 0/2112855 (0.00%)
      +    resets               1
      +  Hash table
      +    failed insertions    0
      +    entries              8064
      +    duplicate entries    0
      +    bucket use           7923/32768 (24.18%)
      +    hash effectiveness   7923/8064 (98.25%)
      +    longest chain        2
      +    avg. chain           0.2
      +    avg. nonempty chain  1.0
      +    Chain length histogram:
      +          1     2     3     4     5+
      +       7782   141     0     0     0 
      +  Memory use (in bytes)
      +    table + misc         131104
      +    entries              322560
      +    URIs                 246024
      +    headers              4128768
      +    total                4844640/5000000 (96.89%)
      +    mapped file data     1146761280
      +    mapped file vaddrs   1229455360 (75040 16384-byte pages)
      +  Full entry info
      +    server * URI @ hash-bucket -> keep-alive-header-bytes;non-keep-alive-header-bytes + body-bytes file-name
      +    main * /spec/file_set/dir115/class0_0 @ 37 -> 256;256 + 102 /a/htdocs/spec/file_set/dir115/class0_0
      +    main * /spec/file_set/dir115/class0_1 @ 38 -> 256;256 + 204 /a/htdocs/spec/file_set/dir115/class0_1
      +    main * /spec/file_set/dir115/class0_2 @ 39 -> 256;256 + 306 /a/htdocs/spec/file_set/dir115/class0_2
      +    main * /spec/file_set/dir115/class0_3 @ 40 -> 256;256 + 408 /a/htdocs/spec/file_set/dir115/class0_3
      +    ... thousands of lines elided for brevity ...
      +    main * /spec/file_set/dir214/class3_8 @ 32752 -> 256;256 + 921600 /a/htdocs/spec/file_set/dir214/class3_8
      +
      +

      +What Do the Statistics Mean?

      +

      +This section explains the final example above in great detail.

      +
      +    hit ratio            2104749/2112855 (99.62%)
      +
      +

      +The hit ratio is the ratio of the number of requests +successfully served by the QSC to the total number of requests made to +the server. The number in parentheses is the ratio expressed as a +percentage. In this case there were 2,112,855 total requests, 2,104,749 +or 99.62% of which were cache hits -- the QSC responded to the requests +quickly -- and 8,106 or 0.38% were cache misses -- Apache processed the +requests without assistance from the QSC.

      +
      +    uncachable           42/2112855 (0.00%)
      +    uncachable misses    42/8106 (0.52%)
      +    uncachable requests  0/2112855 (0.00%)
      +    uncachable responses 0/2112855 (0.00%)
      +
      +

      +These explain the cache misses. Of the 2,112,855 total requests, 42 +were uncachable meaning that not only did they miss (were not +in) the cache but also the QSC could not enter them into its cache for +some reason. In this case, all 42 uncachable requests were uncachable +misses meaning some handler other than the mmap_static module's +handled the request. For instance, all server-status requests are +handled by the status module and so are uncachable misses. (You can see +the number of uncachable misses increasing by one for each example +above.) Other reasons requests may be uncachable are uncachable +requests and uncachable responses.

      +

      +The QSC caches responses to HTTP requests only +when both the request and the response meet certain criteria. To be +cachable a request must:

      +
        +
      • + be an HTTP GET request, and +
      • + not have been marked uncachable by any module (e.g., r->no_cache + == 0), and +
      • + not contain any of the following headers: +
          +
        • + Authorization: ... +
        • + Cache-Control: ... +
        • + If-Modified-Since: ... +
        • + If-None-Match: ... +
        • + If-Range: ... +
        • + Pragma: no-cache +
        • + Range: ... +
        +
      +

      +and its response must:

      +
        +
      • + have status 200 OK, and +
      • + not be chunked, and +
      • + not have been marked uncachable by any module (e.g., r->no_cache + == 0), and +
      • + not contain any of the following headers: +
          +
        • + Cache-Control: ... +
        • + Content-Range: ... +
        • + ETag: W/... (that is, strong etags are cachable, weaks ones are not) +
        • + Expires: ... +
        • + Pragma: no-cache +
        • + Vary: ... +
        +
      +

      +For example, pressing the "Reload" button on some popular +browsers causes them to issue requests with a Pragma: no-cache + and/or Cache-control header which are meant to bypass +caching mechanisms such as the QSC.

      +
      +    resets               1
      +
      +

      +The QSC counts the number of times it has been reset. The counter +starts at zero but Apache's normal startup procedures cause one reset. +Each time the server is restarted the QSC clears its cache completely, +zeros-out all the statistics except this counter, and increments this +counter. Thus, the statistics displayed are since the last reset, not +since the server was started.

      +
      +  Hash table
      +    failed insertions    0
      +
      +

      +This is the number of times the QSC tried to insert a new entry into +its cache and failed. Failure can occur when, for example, the QSC has +consumed all the memory it is allowed to use (i.e., the cache is full). +If you see a large number of failed insertions, consider increasing +your QSC's cache size.

      +
      +    entries              8064
      +    duplicate entries    0
      +
      +

      +This shows you how many entries are in the cache, and how many of those +entries are duplicates of one another. Duplicate entries are harmless +aside from wasting a little memory.

      +
      +    bucket use           7923/32768 (24.18%)
      +    hash effectiveness   7923/8064 (98.25%)
      +    longest chain        2
      +    avg. chain           0.2
      +    avg. nonempty chain  1.0
      +    Chain length histogram:
      +          1     2     3     4     5+
      +       7782   141     0     0     0 
      +
      +

      +The above information describes the effectiveness of the QSC's hash +algorithm. This particular instance has 32,768 cache buckets of which +7,923 or 24.18% have at least one entry (the rest are empty). The +effectiveness of the hash function is the ratio of the number of +buckets over which entries are spread to the number of entries, in this +case 7,923 to 8,064 or 98.25% effective. Higher effectiveness means +shorter hash chains which are faster when looking up entries. The +longest hash chain has only two entries which is very good. If your +server shows a low hash efficiency and long hash chains, consider +increasing your QSC's number of hash buckets. The +average (arithmetic mean) chain length is just 0.2 entries per bucket, +including empty buckets, and the average chain length of non-empty +buckets is 1.0 which is excellent. The histogram displays the number of +hash buckets having chains with one, two, three, four, and five-or-more +entries. You can control the number of histogram bins.

      +
      +  Memory use (in bytes)
      +    table + misc         131104
      +
      +

      +The QSC carefully manages the amount of memory it uses and this part of +the report explains where all the bytes are going. This line accounts +for the empty hash table -- the size of which is directly related to +the number of hash buckets -- and other data structures necessary for +the QSC's operation such as the statistics counters. In this example +there are 32,768 hash buckets each of which is four bytes in size so +the whole table consumes 131,072 bytes. The remaining 32 bytes (for a +total of 131,104) are for the statistics counters and other overhead.

      +
      +    entries              322560
      +
      +

      +This line accounts for the memory used for the hash entry data +structures. In this example each entry consumes 40 bytes and there are +8,064 of them for a total of 322,560 bytes.

      +
      +    URIs                 246024
      +
      +

      +Each hash entry maps a URI and virtual host to HTTP response headers +and data. This counts the amount of memory consumed by remembering +those URIs. The average cached URI length in this example is 246,024 +bytes divided by 8,064 entries or about 31 bytes.

      +
      +    headers              4128768
      +
      +

      +This is the number of bytes consumed by remembering the HTTP response +headers for each cached entry. This is approximately double the number +of bytes of header information sent in response to a cached entry +because the QSC keeps two sets of headers, +one for keep-alive connections and one for non-keep-alive connections. +The average number of bytes of cached headers is 4,128,768 bytes +divided by 8,064 entries or exactly 512 bytes (two sets of 256-byte +headers per entry). This number is so tidy because of header +padding and alignment.

      +
      +    total                4844640/5000000 (96.89%)
      +
      +

      +This line displays the total amount of memory that the QSC is using and +the maximum amount to which it limits itself. In this case the cache is +pretty close to full. You can control the maximum +cache size.

      +
      +    mapped file data     1146761280
      +    mapped file vaddrs   1229455360 (75040 16384-byte pages)
      +
      +

      +The QSC itself manages only the hash table, the URI strings, and the +headers. The mmap_static module manages the cache of memory-mapped file +contents. These two lines count the number of bytes of response body +data (in this case 1,146,761,280 bytes for an average file size of +142,208 bytes) and the number of bytes of virtual memory consumed +(1,229,455,360 bytes). The latter is larger because memory-mapping a +file whose size is not an exact multiple of the machine's page size +wastes the space between the end of the file and the end of the page. +In this case the machine's page size is 16 KB and 75,040 pages are used +to map the file contents.

      +
      +  Full entry info
      +    server * URI @ hash-bucket -> keep-alive-header-bytes;non-keep-alive-header-bytes + body-bytes file-name
      +    main * /spec/file_set/dir115/class0_0 @ 37 -> 256;256 + 102 /a/htdocs/spec/file_set/dir115/class0_0
      +    main * /spec/file_set/dir115/class0_1 @ 38 -> 256;256 + 204 /a/htdocs/spec/file_set/dir115/class0_1
      +    main * /spec/file_set/dir115/class0_2 @ 39 -> 256;256 + 306 /a/htdocs/spec/file_set/dir115/class0_2
      +    main * /spec/file_set/dir115/class0_3 @ 40 -> 256;256 + 408 /a/htdocs/spec/file_set/dir115/class0_3
      +    ... thousands of lines elided for brevity ...
      +    main * /spec/file_set/dir214/class3_8 @ 32752 -> 256;256 + 921600 /a/htdocs/spec/file_set/dir214/class3_8
      +
      +

      +This final section, available using the ?qsc=full + server-status extension, lists all of the information known about each +cache entry. There were as many lines as there are cache entries so +most of them were omitted for brevity. The following information is +printed for each entry, as the list's header notes:

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      serverThe file name and line number where the virtual server was + defined (for lack of better virtual host identification), or main + for the main server.
      URIThe URI for which the response is cached.
      hash-bucketThe ordinal of the bucket into which the URI hashes.
      keep-alive-header-bytesThe number of bytes of HTTP response header cached for a + keep-alive response.
      non-keep-alive-header-bytesThe number of bytes of HTTP response header cached for a + non-keep-alive (i.e., Connection: close) response.
      body-bytesThe number of bytes of HTTP response body.
      file-nameThe name of the cached file, available only when the QSC is + compiled with QSC_DEBUG enabled. Without QSC_DEBUG + n/a is displayed ("not available").
      +

      +Advanced Options

      +

      +All of the following are compile-time options. The first two must be +defined manually. The rest are defined in the QSC source code.

      + + + + + +
      USE_QSC

      + Compiles the QSC into Apache.

      + Default: USE_QSC is not defined so the QSC is + disabled.
      +

      +Debugging / Additional Information

      + + + + + + + + + +
      QSC_DEBUG

      + Enables internal consistency checks.

      +

      + Makes the QSC keep track of the name of the file mapped by the + mmap_static module for each entry. The file name is displayed on the full status page.

      + Default: QSC_DEBUG is not defined so debugging + is disabled.
      QSC_HIST_SIZE

      + Sets the number of hash bucket histogram bins the status page displays.

      + Default: 5.
      +

      +Size Restriction

      + + + + + + + + + +
      QSC_MAX_SIZE

      + Sets the maximum number of bytes of memory the QSC will consume. Note + that this does not include mapped file data.

      + Default: 4194304 (4 MB).
      QSC_HASH_SIZE

      + Sets the number of hash buckets.

      + Default: 128.
      +

      +Header Alignment

      + + + + + + + + + + + + + + + + + +
      QSC_HEADER_GRAIN

      + Sets both the virtual address alignment boundary of cached HTTP + response headers and the number of bytes to which the headers are + padded. For best performance make this equal to the size of the largest + cache line size on the system on which Apache runs. Must be a power of + two. The special value 0 disables alignment and padding.

      + Default: system dependent (typically 32 or 128).
      QSC_GRAIN

      + Sets both the virtual address alignment boundary of internal memory + allocations and the number of bytes to which the allocations are + padded. Must be a power of two at least as large as the larger of a + pointer and a long. Same idea as CLICK_SZ in + Apache's own memory management subsystem.

      + Default: system dependent (typically 4 or 8).
      QSC_MAX_ALLOC

      + Sets the maximum single-allocation size in bytes. Internal memory + allocations larger than this will fail and the request/response will + not be cached.

      + Default: 512.
      QSC_RED_ZONE

      + Sets the number of bytes of safety margin required between the two + internal memory allocation zones. Should be a small multiple of QSC_MAX_ALLOC + for safety.

      + Default: 4096.
      +

      +See also

      +

      +Apache API, mmap_static module, status module, virtual hosts

      +
      +

      +Apache HTTP Server Version 1.3

      +

      +Index

      + + diff -Naur apache_1.3.12/htdocs/manual/stopping.html-orig apache_1.3.12/htdocs/manual/stopping.html --- apache_1.3.12/htdocs/manual/stopping.html-orig Wed Feb 23 15:11:39 2000 +++ apache_1.3.12/htdocs/manual/stopping.html Wed Feb 9 17:34:31 2000 @@ -125,6 +125,11 @@ complete for users on low bandwidth links then you could wait 15 minutes before doing anything with the old log. +

      Supporting graceful restarts slows Apache down somewhat. You can +increase performance by compiling apache with the +NO_GRACEFUL flag, which disables graceful restarts. +USR1 will behave like HUP. +

      Note: If your configuration file has errors in it when you issue a restart then your parent will not restart, it will exit with an error. diff -Naur apache_1.3.12/htdocs/manual/vhosts/index.html-orig apache_1.3.12/htdocs/manual/vhosts/index.html --- apache_1.3.12/htdocs/manual/vhosts/index.html-orig Wed Feb 23 15:11:39 2000 +++ apache_1.3.12/htdocs/manual/vhosts/index.html Wed Feb 9 17:34:31 2000 @@ -48,6 +48,7 @@

    41. In-Depth Discussion of Virtual Host Matching
    42. File Descriptor Limits
    43. Dynamically Configured Mass Virtual Hosting +
    44. QSC Interaction with Virtual Hosts

      Configuration directives

      diff -Naur apache_1.3.12/htdocs/sgi_performance.gif.uu-orig apache_1.3.12/htdocs/sgi_performance.gif.uu --- apache_1.3.12/htdocs/sgi_performance.gif.uu-orig +++ apache_1.3.12/htdocs/sgi_performance.gif.uu Thu Feb 10 16:11:02 2000 @@ -0,0 +1,46 @@ +begin 444 sgi_performance.gif +M1TE&.#EA!0%'`,3_``"O3A"T62"Y9#"^;T##>E#(AFG0EW_7IH_ +M:*JN;.N^<"S/=&W?>*[O?.__P*!P2"P:C\BD$PNF\_HM'K-;KO?\+A\3J_;[_B\7@N93"![@6D0%AT=%8""BET/)1,: +MAAH3BY17#Q(5%A6-(A,8AAB3E:-1$16&'1H4)!09&:NDL4T2%Z@:%Q(E$8FR +MO3,/$+LO$,&U'1L6%+R^S#1]%)D5%!++)9?0F9$5NA+=W1$-EQ(1#^#-YPVF +MJ+85YKH5D.L=&,L0%1D8^1D6NQ7^$Q;0-8M0"!6'=?QT%31T,%)"$03E8@SLB*<-)"P%'.ZFN\#&F$9! +M`&"J'`4`KB:I>S>OC0@9.G"XR9"243^#5 +M2^-!063*4DS(C%)TP0RE$Z.&HIKUX\A*8IN8?6-"PPX +M>.Z-$&`*"S`V@/\"QC%(0H+]'2"@"><5F!Z!RI4P6W<)N+>`<2,@4)\)%,3# +MT#XY=<);:"6,!IQ:PM5@0``"U`5``/^)4("-`"`@P@(T\N@`9#P.T,`"-=:% +MXP@#)%G75`G`9:-4/+Z&I(T!C-AD`%..V(!J-OJ8'I=U#6"A"&#:*%>&Q8FP +M99PW4&.D!E!ZI)*8%R"5GI`8HF8"HCC4P +MP`$*["C`CTJR%VL`(UBJ0`*:BL`EKK'^.4*"G3K8`)NKJ7JCKS<&VRG_IL4V +MD*P"#B1Y9Z231INJ"+&*B4($$U1@3"0Y16!49Q'$PGKT8.HQ$'.0EFR`874#"!4@UAT-G0-4"M=%T'))YLRTRC +M;9SA4I,=]6M<*[>``59EJ[;7;W=-0.('U`AB_]E2,]YTR52OG9?B;9=^=LQQ +M2\VE"'B9ZP)UAY``CRT9F"B)"833`#G2>$K=^<##HTGUT8Y#K'*4>*(.HNJR +M%;]\U:Z3K/STG!=_E=N-PXV]9+$*^#$*`*78B4>%BK"0/$"9A52,PGL]N>DG +M'.]T\E>78'7E*N/2?[:6NNY5CS8J`-_IMB>^UY'N3YWK6NPD\R\&-.P$%M`` +M!P3GB)_P1&\HN0`D4%2-^8&":##@7P3U]SC[*4UR_Z,:96(HO09V#FH)S![3 +M",@]O71.@0<OTL7*,3LR5P(` +M%K[^1:UNVI(9#$L'0/]5[<02QJM$<1X`9AF#`'Q;@#4K,89N/1%$%%#"(O5Z` +METX=8$>`9%AC#J":,[X-2,!"VZU`29XQ4DZ&*GM+`100J\@54"]`&J5J4EG* +M`\SH82?@4JV(9`!4U44R:Q1E,4M)KAOY4DTH4,TJ;^0>Z)T1?2:"7U`,Q1L* +M1.";X"SASWJ&BH>D4$IU$8"7%.`D`I`G`*DLP9*:ELX1[6B.5HO5B.")MB<- +M@)=4BU*.KG1,]]1R6BD@5AH-1"8<$>",7!-HU=II4"P1JU8FD!-L4`8!Z@D90P]K(M(.SO&&D,Q&+VLR>0 +M`&^"THUTL0NTJ#V!1E*ACW)V)K6HI:PD;6&!L,(6M>FR@&XUD9O;^O:WP`VN +K<(=+W.(:][C(3:YRE\OZ"MC-KG:WRUT1A```.PVN +` +end diff -Naur apache_1.3.12/src/Configuration-orig apache_1.3.12/src/Configuration --- apache_1.3.12/src/Configuration-orig Wed Feb 23 15:09:35 2000 +++ apache_1.3.12/src/Configuration Wed Feb 9 17:34:31 2000 @@ -124,7 +124,7 @@ # functions. The format is: Rule RULE=value # # At present, only the following RULES are known: WANTHSREGEX, SOCKS4, -# SOCKS5, IRIXNIS, IRIXN32, PARANOID, and DEV_RANDOM. +# SOCKS5, IRIXNIS, IRIXN32, IRIX64, PARANOID, and DEV_RANDOM. # # For all Rules except DEV_RANDOM, if set to "yes", then Configure knows # we want that capability and does what is required to add it in. If set @@ -152,6 +152,10 @@ # If you are running a version of IRIX and Configure detects # n32 libraries, it will use those instead of the o32 ones. # +# IRIX64: +# Build 64-bit (-64) rather than 32-bit (-o32 or -n32). Takes +# precedence over IRIXN32. +# # PARANOID: # New with version 1.3, during Configure modules can run # pre-programmed shell commands in the same environment that @@ -171,6 +175,7 @@ Rule SOCKS5=no Rule IRIXNIS=no Rule IRIXN32=yes +Rule IRIX64=no Rule PARANOID=no Rule EXPAT=default diff -Naur apache_1.3.12/src/Configuration.tmpl-orig apache_1.3.12/src/Configuration.tmpl --- apache_1.3.12/src/Configuration.tmpl-orig Sat Aug 14 01:35:43 1999 +++ apache_1.3.12/src/Configuration.tmpl Wed Feb 9 17:34:31 2000 @@ -124,7 +124,7 @@ # functions. The format is: Rule RULE=value # # At present, only the following RULES are known: WANTHSREGEX, SOCKS4, -# SOCKS5, IRIXNIS, IRIXN32, PARANOID, and DEV_RANDOM. +# SOCKS5, IRIXNIS, IRIXN32, IRIX64, PARANOID, and DEV_RANDOM. # # For all Rules except DEV_RANDOM, if set to "yes", then Configure knows # we want that capability and does what is required to add it in. If set @@ -152,6 +152,10 @@ # If you are running a version of IRIX and Configure detects # n32 libraries, it will use those instead of the o32 ones. # +# IRIX64: +# Build 64-bit (-64) rather than 32-bit (-o32 or -n32). Takes +# precedence over IRIXN32. +# # PARANOID: # New with version 1.3, during Configure modules can run # pre-programmed shell commands in the same environment that @@ -171,6 +175,7 @@ Rule SOCKS5=no Rule IRIXNIS=no Rule IRIXN32=yes +Rule IRIX64=no Rule PARANOID=no Rule EXPAT=default diff -Naur apache_1.3.12/src/Configure-orig apache_1.3.12/src/Configure --- apache_1.3.12/src/Configure-orig Sat Feb 5 17:27:19 2000 +++ apache_1.3.12/src/Configure Wed Mar 1 17:04:21 2000 @@ -228,6 +228,7 @@ RULE_SOCKS5=`./helpers/CutRule SOCKS5 $file` RULE_IRIXNIS=`./helpers/CutRule IRIXNIS $file` RULE_IRIXN32=`./helpers/CutRule IRIXN32 $file` +RULE_IRIX64=`./helpers/CutRule IRIX64 $file` RULE_PARANOID=`./helpers/CutRule PARANOID $file` RULE_EXPAT=`./helpers/CutRule EXPAT $file` RULE_SHARED_CORE=`./helpers/CutRule SHARED_CORE $file` @@ -376,50 +377,38 @@ DEF_WANTHSREGEX=yes LIBS="$LIBS -lm" ;; - *-sgi-irix64) - # Note: We'd like to see patches to compile 64-bit, but for now... - echo "You are running 64-bit Irix. For now, we will compile 32-bit" - echo "but if you would care to port to 64-bit, send us the patches." + *-sgi-irix*) DEF_WANTHSREGEX=yes DBM_LIB="" - if [ "x$RULE_IRIXNIS" = "xyes" ]; then - OS='SGI IRIX-64 w/NIS' - CFLAGS="$CFLAGS -DIRIX" - LIBS="$LIBS -lsun" - else - OS='SGI IRIX-64' - CFLAGS="$CFLAGS -DIRIX" - fi - ;; - *-sgi-irix32) - DEF_WANTHSREGEX=yes - DBM_LIB="" - if [ "x$RULE_IRIXN32" = "xyes" ]; then - if [ "x$RULE_IRIXNIS" = "xyes" ]; then - OS='SGI IRIX-32 w/NIS' + IRIXREL=`uname -r` + IRIXNUM=`uname -r | sed 's/^\([0-9]\)\.\([0-9]\).*$/\1\2/'` + CFLAGS="$CFLAGS -DIRIX=$IRIXNUM" + OS="SGI IRIX $IRIXREL ($IRIXNUM)" + case "$PLAT" in + *-sgi-irix64) + if [ "x$RULE_IRIX64" = "xyes" ]; then + OS="$OS, 64-bit ABI" + elif [ "x$RULE_IRIXN32" = "xyes" ]; then + OS="$OS, N32 ABI" else - OS='SGI IRIX-32' + OS="$OS, O32 ABI" fi - else - if [ "x$RULE_IRIXNIS" = "xyes" ]; then - OS='SGI IRIX w/NIS' + CC=cc + ;; + *-sgi-irix32) + if [ "x$RULE_IRIXN32" = "xyes" ]; then + OS="$OS, N32 ABI" else - OS='SGI IRIX' + OS="$OS, O32 ABI" fi - fi - CC='cc' - CFLAGS="$CFLAGS -DIRIX" - ;; - *-sgi-irix) - DEF_WANTHSREGEX=yes - DBM_LIB="" + CC=cc + ;; + esac if [ "x$RULE_IRIXNIS" = "xyes" ]; then - OS='SGI IRIX w/NIS' - CFLAGS="$CFLAGS -DIRIX" - LIBS="$LIBS -lsun" - else - OS='SGI IRIX' - CFLAGS="$CFLAGS -DIRIX" + OS="$OS w/NIS" + case "$PLAT" in + *-sgi-irix) LIBS="$LIBS -lsun" ;; + esac fi ;; *-linux2) @@ -1123,41 +1112,22 @@ LDFLAGS_MOD_SHLIB=$LDFLAGS_SHLIB LDFLAGS_SHLIB_EXPORT="" ;; - *-sgi-irix32) - case $CC in - */gcc|gcc ) - CFLAGS_SHLIB="-fpic" - N32FLAG="" - ;; - */cc|cc ) - CFLAGS_SHLIB="-KPIC" - N32FLAG="-n32" - ;; - esac - if [ "x$RULE_IRIXN32" = "xyes" ]; then - LDFLAGS_SHLIB="$N32FLAG -shared" - else - LDFLAGS_SHLIB="-shared" - fi - LDFLAGS_MOD_SHLIB=$LDFLAGS_SHLIB - LDFLAGS_SHLIB_EXPORT="" - ;; - *-sgi-irix64) + *-sgi-irix32 | *-sgi-irix64) case $CC in */gcc|gcc ) CFLAGS_SHLIB="-fpic" - N32FLAG="" + ABIFLAG="" ;; */cc|cc ) CFLAGS_SHLIB="-KPIC" - N32FLAG="-n32" + case "$OS" in + SGI\ IRIX*64-bit\ ABI*) ABIFLAG="-64" ;; + SGI\ IRIX*N32\ ABI*) ABIFLAG="-n32" ;; + SGI\ IRIX*O32\ ABI*) ABIFLAG="-o32" ;; + esac ;; esac - if [ "x$RULE_IRIXN32" = "xyes" ]; then - LDFLAGS_SHLIB="$N32FLAG -shared" - else - LDFLAGS_SHLIB="-shared" - fi + LDFLAGS_SHLIB="$ABIFLAG -shared" LDFLAGS_MOD_SHLIB=$LDFLAGS_SHLIB LDFLAGS_SHLIB_EXPORT="" ;; @@ -1417,25 +1387,23 @@ ;; esac ;; - *IRIX-64*) - if [ "x$RULE_IRIXN32" = "xyes" ]; then - case "$CC" in - */cc|cc ) - CFLAGS="$CFLAGS -n32" - LDFLAGS="$LDFLAGS -n32" - ;; - esac - fi - ;; - *IRIX-32*) - if [ "x$RULE_IRIXN32" = "xyes" ]; then - case "$CC" in - */cc|cc ) - CFLAGS="$CFLAGS -n32" - LDFLAGS="$LDFLAGS -n32" + SGI\ IRIX*64-bit\ ABI*) + CFLAGS="$CFLAGS -64 -fullwarn" + LDFLAGS="$LDFLAGS -64" + ;; + SGI\ IRIX*N32\ ABI*) + CFLAGS="$CFLAGS -n32 -fullwarn" + LDFLAGS="$LDFLAGS -n32" + ;; + SGI\ IRIX*O32\ ABI*) + CFLAGS="$CFLAGS -o32 -fullwarn" + LDFLAGS="$LDFLAGS -o32" + ;; + Linux) + case $CC in + gcc) CFLAGS="$CFLAGS -Wall" ;; - esac - fi + esac ;; IBM?AIX?4.[123]) case $CC in diff -Naur apache_1.3.12/src/Makefile.tmpl-orig apache_1.3.12/src/Makefile.tmpl --- apache_1.3.12/src/Makefile.tmpl-orig Thu Dec 9 09:19:31 1999 +++ apache_1.3.12/src/Makefile.tmpl Wed Feb 9 17:34:31 2000 @@ -125,10 +125,12 @@ # DO NOT REMOVE buildmark.o: buildmark.c include/ap_config.h include/ap_mmn.h \ - include/ap_config_auto.h os/unix/os.h include/ap_ctype.h \ - include/hsregex.h include/httpd.h include/alloc.h include/buff.h \ - include/ap.h include/util_uri.h -modules.o: modules.c include/httpd.h include/ap_config.h \ - include/ap_mmn.h include/ap_config_auto.h os/unix/os.h \ - include/ap_ctype.h include/hsregex.h include/alloc.h include/buff.h \ - include/ap.h include/util_uri.h include/http_config.h + include/ap_config_auto.h os/unix/os.h os/unix/os-inline.c \ + include/ap_ctype.h include/hsregex.h include/httpd.h \ + include/ap_types.h include/alloc.h include/buff.h include/ap.h \ + include/util_uri.h +modules.o: modules.c include/httpd.h include/ap_types.h \ + include/ap_config.h include/ap_mmn.h include/ap_config_auto.h \ + os/unix/os.h os/unix/os-inline.c include/ap_ctype.h include/hsregex.h \ + include/alloc.h include/buff.h include/ap.h include/util_uri.h \ + include/http_config.h diff -Naur apache_1.3.12/src/ap/Makefile.tmpl-orig apache_1.3.12/src/ap/Makefile.tmpl --- apache_1.3.12/src/ap/Makefile.tmpl-orig Sun Aug 8 10:59:28 1999 +++ apache_1.3.12/src/ap/Makefile.tmpl Wed Feb 9 17:34:31 2000 @@ -39,16 +39,25 @@ && rm Makefile.new # DO NOT REMOVE -ap_cpystrn.o: ap_cpystrn.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ - $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h -ap_execve.o: ap_execve.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ - $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h +ap_base64.o: ap_base64.c $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ + $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(OSDIR)/os-inline.c \ + $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/ap.h +ap_checkpass.o: ap_checkpass.c $(INCDIR)/httpd.h \ + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ + $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(OSDIR)/os-inline.c \ + $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/alloc.h \ + $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/ap_md5.h $(INCDIR)/ap_sha1.h +ap_cpystrn.o: ap_cpystrn.c $(INCDIR)/httpd.h $(INCDIR)/ap_types.h \ + $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ + $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(OSDIR)/os-inline.c \ + $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/alloc.h \ + $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h +ap_execve.o: ap_execve.c $(INCDIR)/httpd.h $(INCDIR)/ap_types.h \ + $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ + $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(OSDIR)/os-inline.c \ + $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/alloc.h \ + $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h ap_fnmatch.o: ap_fnmatch.c $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(OSDIR)/os-inline.c \ $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/fnmatch.h @@ -55,24 +64,29 @@ ap_getpass.o: ap_getpass.c $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(OSDIR)/os-inline.c \ $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/ap.h -ap_md5c.o: ap_md5c.c $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ +ap_md5c.o: ap_md5c.c $(INCDIR)/httpd.h $(INCDIR)/ap_types.h \ + $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(OSDIR)/os-inline.c \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/ap_md5.h \ - $(INCDIR)/ap.h -ap_sha1.o: ap_sha1.c $(INCDIR)/ap_config.h $(INCDIR)/ap_sha1.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(OSDIR)/os-inline.c -ap_signal.o: ap_signal.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ - $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h -ap_slack.o: ap_slack.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ - $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_log.h -ap_snprintf.o: ap_snprintf.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/alloc.h \ + $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/ap_md5.h +ap_sha1.o: ap_sha1.c $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h + $(INCDIR)/ap_sha1.h $(INCDIR)/ap.h +ap_signal.o: ap_signal.c $(INCDIR)/httpd.h $(INCDIR)/ap_types.h \ + $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ + $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(OSDIR)/os-inline.c \ + $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/alloc.h \ + $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h +ap_slack.o: ap_slack.c $(INCDIR)/httpd.h $(INCDIR)/ap_types.h \ + $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ + $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(OSDIR)/os-inline.c \ + $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/alloc.h \ + $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_log.h +ap_snprintf.o: ap_snprintf.c $(INCDIR)/httpd.h $(INCDIR)/ap_types.h \ + $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ + $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(OSDIR)/os-inline.c \ + $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/alloc.h \ + $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h diff -Naur apache_1.3.12/src/ap/ap_base64.c-orig apache_1.3.12/src/ap/ap_base64.c --- apache_1.3.12/src/ap/ap_base64.c-orig Fri Sep 10 10:32:05 1999 +++ apache_1.3.12/src/ap/ap_base64.c Wed Feb 9 17:34:31 2000 @@ -121,7 +121,7 @@ bufin = (const unsigned char *) bufcoded; while (pr2six[*(bufin++)] <= 63); - nprbytes = (bufin - (const unsigned char *) bufcoded) - 1; + nprbytes = (int) ((bufin - (const unsigned char *) bufcoded) - 1); nbytesdecoded = ((nprbytes + 3) / 4) * 3; return nbytesdecoded + 1; @@ -156,7 +156,7 @@ bufin = (const unsigned char *) bufcoded; while (pr2six[*(bufin++)] <= 63); - nprbytes = (bufin - (const unsigned char *) bufcoded) - 1; + nprbytes = (int) ((bufin - (const unsigned char *) bufcoded) - 1); nbytesdecoded = ((nprbytes + 3) / 4) * 3; bufout = (unsigned char *) bufplain; @@ -268,5 +268,5 @@ } *p++ = '\0'; - return p - encoded; + return (int) (p - encoded); } diff -Naur apache_1.3.12/src/ap/ap_checkpass.c-orig apache_1.3.12/src/ap/ap_checkpass.c --- apache_1.3.12/src/ap/ap_checkpass.c-orig Thu Oct 21 13:44:07 1999 +++ apache_1.3.12/src/ap/ap_checkpass.c Wed Feb 9 17:34:31 2000 @@ -59,10 +59,9 @@ */ #include -#include "ap_config.h" +#include "httpd.h" #include "ap_md5.h" #include "ap_sha1.h" -#include "ap.h" #if HAVE_CRYPT_H #include #endif @@ -91,7 +90,7 @@ */ else if (strncmp(hash, AP_SHA1PW_ID, AP_SHA1PW_IDLEN) == 0) { - ap_sha1_base64(passwd, strlen(passwd), sample); + ap_sha1_base64(passwd, ap_strlen(passwd), sample); } else { /* diff -Naur apache_1.3.12/src/ap/ap_md5c.c-orig apache_1.3.12/src/ap/ap_md5c.c --- apache_1.3.12/src/ap/ap_md5c.c-orig Fri Jan 7 08:04:11 2000 +++ apache_1.3.12/src/ap/ap_md5c.c Wed Feb 9 17:34:31 2000 @@ -101,12 +101,8 @@ #include -#include "ap_config.h" +#include "httpd.h" #include "ap_md5.h" -#include "ap.h" -#ifdef CHARSET_EBCDIC -#include "ebcdic.h" -#endif /*CHARSET_EBCDIC*/ #if HAVE_CRYPT_H #include #endif @@ -416,7 +412,7 @@ * the FreeBSD 3.0 /usr/src/lib/libcrypt/crypt.c file, which is * licenced as stated at the top of this file. */ -API_EXPORT(void) ap_to64(char *s, unsigned long v, int n) +API_EXPORT(void) ap_to64(char *s, ap_uint32 v, int n) { static unsigned char itoa64[] = /* 0 ... 63 => ASCII - 64 */ "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; @@ -445,7 +441,7 @@ int pl; unsigned int pwlen; AP_MD5_CTX ctx, ctx1; - unsigned long l; + ap_uint32 l; /* * Refine the salt first. It's possible we were given an already-hashed @@ -471,7 +467,7 @@ /* * Get the length of the true salt */ - sl = ep - sp; + sl = (int) (ep - sp); /* * 'Time to make the doughnuts..' @@ -478,7 +474,7 @@ */ ap_MD5Init(&ctx); - pwlen = strlen((char *)pw); + pwlen = ap_strlen((char *)pw); /* * The password first, since that is what is most unknown */ @@ -492,7 +488,7 @@ /* * Then the raw salt */ - ap_MD5Update(&ctx, sp, sl); + ap_MD5Update(&ctx, (const unsigned char *) sp, sl); /* * Then just as many characters of the MD5(pw, salt, pw) @@ -519,7 +515,7 @@ ap_MD5Update(&ctx, final, 1); } else { - ap_MD5Update(&ctx, pw, 1); + ap_MD5Update(&ctx, (const unsigned char *) pw, 1); } } @@ -548,7 +544,7 @@ ap_MD5Update(&ctx1, final, 16); } if (i % 3) { - ap_MD5Update(&ctx1, sp, sl); + ap_MD5Update(&ctx1, (const unsigned char *) sp, sl); } if (i % 7) { diff -Naur apache_1.3.12/src/ap/ap_sha1.c-orig apache_1.3.12/src/ap/ap_sha1.c --- apache_1.3.12/src/ap/ap_sha1.c-orig Fri Jan 7 08:04:11 2000 +++ apache_1.3.12/src/ap/ap_sha1.c Wed Feb 9 17:34:31 2000 @@ -84,6 +84,7 @@ #include +#include "ap_types.h" #include "ap_config.h" #include "ap_sha1.h" #include "ap.h" @@ -104,10 +105,10 @@ #define f4(x,y,z) (x ^ y ^ z) /* SHA constants */ -#define CONST1 0x5a827999L -#define CONST2 0x6ed9eba1L -#define CONST3 0x8f1bbcdcL -#define CONST4 0xca62c1d6L +#define CONST1 ((ap_uint32) 0x5a827999) +#define CONST2 ((ap_uint32) 0x6ed9eba1) +#define CONST3 ((ap_uint32) 0x8f1bbcdc) +#define CONST4 ((ap_uint32) 0xca62c1d6) /* 32-bit rotate */ @@ -183,15 +184,15 @@ } union endianTest { - long Long; - char Char[sizeof(long)]; + ap_uint32 etword; + char etbytes[sizeof(ap_uint32)]; }; static char isLittleEndian(void) { static union endianTest u; - u.Long = 1; - return (u.Char[0] == 1); + u.etword = 1; + return (u.etbytes[0] == 1); } /* change endianness of data */ @@ -223,13 +224,13 @@ API_EXPORT(void) ap_SHA1Init(AP_SHA1_CTX *sha_info) { - sha_info->digest[0] = 0x67452301L; - sha_info->digest[1] = 0xefcdab89L; - sha_info->digest[2] = 0x98badcfeL; - sha_info->digest[3] = 0x10325476L; - sha_info->digest[4] = 0xc3d2e1f0L; - sha_info->count_lo = 0L; - sha_info->count_hi = 0L; + sha_info->digest[0] = (AP_LONG) 0x67452301; + sha_info->digest[1] = (AP_LONG) 0xefcdab89; + sha_info->digest[2] = (AP_LONG) 0x98badcfe; + sha_info->digest[3] = (AP_LONG) 0x10325476; + sha_info->digest[4] = (AP_LONG) 0xc3d2e1f0; + sha_info->count_lo = (AP_LONG) 0; + sha_info->count_hi = (AP_LONG) 0; sha_info->local = 0; } diff -Naur apache_1.3.12/src/ap/ap_slack.c-orig apache_1.3.12/src/ap/ap_slack.c --- apache_1.3.12/src/ap/ap_slack.c-orig Fri Jan 1 11:04:36 1999 +++ apache_1.3.12/src/ap/ap_slack.c Wed Feb 9 17:34:31 2000 @@ -67,6 +67,9 @@ #include "http_log.h" #ifndef NO_SLACK +#ifndef HIGH_SLACK_LINE +/*ARGSUSED1*/ +#endif int ap_slack(int fd, int line) { #if !defined(F_DUPFD) diff -Naur apache_1.3.12/src/ap/ap_snprintf.c-orig apache_1.3.12/src/ap/ap_snprintf.c --- apache_1.3.12/src/ap/ap_snprintf.c-orig Sun Nov 28 07:47:02 1999 +++ apache_1.3.12/src/ap/ap_snprintf.c Wed Feb 9 17:34:31 2000 @@ -398,7 +398,7 @@ } while (magnitude); - *len = buf_end - p; + *len = (int) (buf_end - p); return (p); } @@ -454,7 +454,7 @@ } while (magnitude); - *len = buf_end - p; + *len = (int) (buf_end - p); return (p); } @@ -467,15 +467,15 @@ bool_int is_negative; int sub_len; - p = conv_10((addr & 0x000000FF) , TRUE, &is_negative, p, &sub_len); + p = conv_10((wide_int) ((addr & 0x000000FF) ), TRUE, &is_negative, p, &sub_len); *--p = '.'; - p = conv_10((addr & 0x0000FF00) >> 8, TRUE, &is_negative, p, &sub_len); + p = conv_10((wide_int) ((addr & 0x0000FF00) >> 8), TRUE, &is_negative, p, &sub_len); *--p = '.'; - p = conv_10((addr & 0x00FF0000) >> 16, TRUE, &is_negative, p, &sub_len); + p = conv_10((wide_int) ((addr & 0x00FF0000) >> 16), TRUE, &is_negative, p, &sub_len); *--p = '.'; - p = conv_10((addr & 0xFF000000) >> 24, TRUE, &is_negative, p, &sub_len); + p = conv_10((wide_int) ((addr & 0xFF000000) >> 24), TRUE, &is_negative, p, &sub_len); - *len = buf_end - p; + *len = (int) (buf_end - p); return (p); } @@ -491,7 +491,7 @@ *--p = ':'; p = conv_in_addr(&si->sin_addr, p, &sub_len); - *len = buf_end - p; + *len = (int) (buf_end - p); return (p); } @@ -521,7 +521,7 @@ * Check for Infinity and NaN */ if (ap_isalpha(*p)) { - *len = strlen(strcpy(buf, p)); + *len = ap_strlen(strcpy(buf, p)); *is_negative = FALSE; return (buf); } @@ -583,7 +583,7 @@ } } - *len = s - buf; + *len = (int) (s - buf); return (buf); } @@ -616,7 +616,7 @@ } while (num); - *len = buf_end - p; + *len = (int) (buf_end - p); return (p); } @@ -638,7 +638,7 @@ } while (num); - *len = buf_end - p; + *len = (int) (buf_end - p); return (p); } @@ -646,6 +646,7 @@ /* * Do format conversion placing the output in buffer */ +/*PRINTFLIKE3*/ API_EXPORT(int) ap_vformatter(int (*flush_func)(ap_vformatter_buff *), ap_vformatter_buff *vbuff, const char *fmt, va_list ap) { @@ -908,7 +909,7 @@ case 's': s = va_arg(ap, char *); if (s != NULL) { - s_len = strlen(s); + s_len = ap_strlen(s); if (adjust_precision && precision < s_len) s_len = precision; } @@ -957,7 +958,7 @@ else if (print_blank) prefix_char = ' '; - s_len = strlen(s); + s_len = ap_strlen(s); if (alternate_form && (q = strchr(s, '.')) == NULL) { s[s_len++] = '.'; @@ -1008,6 +1009,10 @@ * don't handle "%p". */ case 'p': +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +/* disable warnings about constant controlling expressions */ +#pragma set woff 1209 +#endif #ifdef AP_VOID_P_IS_QUAD if (sizeof(void *) <= sizeof(u_widest_int)) { ui_quad = (u_widest_int) va_arg(ap, void *); @@ -1021,6 +1026,9 @@ &num_buf[NUM_BUF_SIZE], &s_len); } #endif +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma reset woff 1209 +#endif else { s = "%p"; s_len = 2; @@ -1139,6 +1147,7 @@ } +/*ARGSUSED0*/ static int snprintf_flush(ap_vformatter_buff *vbuff) { /* if the buffer fills we have to abort immediately, there is no way @@ -1148,6 +1157,7 @@ } +/*PRINTFLIKE3*/ API_EXPORT(int) ap_snprintf(char *buf, size_t len, const char *format,...) { int cc; @@ -1164,10 +1174,11 @@ cc = ap_vformatter(snprintf_flush, &vbuff, format, ap); va_end(ap); *vbuff.curpos = '\0'; - return (cc == -1) ? len : cc; + return (cc == -1) ? (int) len : cc; } +/*PRINTFLIKE3*/ API_EXPORT(int) ap_vsnprintf(char *buf, size_t len, const char *format, va_list ap) { @@ -1182,5 +1193,5 @@ vbuff.endpos = buf + len - 1; cc = ap_vformatter(snprintf_flush, &vbuff, format, ap); *vbuff.curpos = '\0'; - return (cc == -1) ? len : cc; + return (cc == -1) ? (int) len : cc; } diff -Naur apache_1.3.12/src/buildmark.c-orig apache_1.3.12/src/buildmark.c --- apache_1.3.12/src/buildmark.c-orig Fri Jan 1 11:04:35 1999 +++ apache_1.3.12/src/buildmark.c Wed Feb 9 17:34:31 2000 @@ -64,7 +64,7 @@ static const char server_built[] = "unknown"; #endif -API_EXPORT(const char *) ap_get_server_built() +API_EXPORT(const char *) ap_get_server_built(void) { return server_built; } diff -Naur apache_1.3.12/src/include/alloc.h-orig apache_1.3.12/src/include/alloc.h --- apache_1.3.12/src/include/alloc.h-orig Thu Jul 29 10:53:54 1999 +++ apache_1.3.12/src/include/alloc.h Wed Feb 9 17:34:31 2000 @@ -155,14 +155,16 @@ /* routines to allocate memory from an pool... */ -API_EXPORT(void *) ap_palloc(struct pool *, int nbytes); -API_EXPORT(void *) ap_pcalloc(struct pool *, int nbytes); +API_EXPORT(void *) ap_palloc(struct pool *, size_t nbytes); +API_EXPORT(void *) ap_pcalloc(struct pool *, size_t nbytes); API_EXPORT(char *) ap_pstrdup(struct pool *, const char *s); /* make a nul terminated copy of the n characters starting with s */ -API_EXPORT(char *) ap_pstrndup(struct pool *, const char *s, int n); +API_EXPORT(char *) ap_pstrndup(struct pool *, const char *s, size_t n); API_EXPORT_NONSTD(char *) ap_pstrcat(struct pool *,...); /* all '...' must be char* */ +/*PRINTFLIKE2*/ API_EXPORT_NONSTD(char *) ap_psprintf(struct pool *, const char *fmt, ...) __attribute__((format(printf,2,3))); +/*PRINTFLIKE2*/ API_EXPORT(char *) ap_pvsprintf(struct pool *, const char *fmt, va_list); /* array and alist management... keeping lists of things. @@ -326,7 +328,7 @@ API_EXPORT(FILE *) ap_pfopen(struct pool *, const char *name, const char *fmode); API_EXPORT(FILE *) ap_pfdopen(struct pool *, int fd, const char *fmode); -API_EXPORT(int) ap_popenf(struct pool *, const char *name, int flg, int mode); +API_EXPORT(int) ap_popenf(struct pool *, const char *name, int flg, mode_t mode); API_EXPORT(void) ap_note_cleanups_for_file(pool *, FILE *); API_EXPORT(void) ap_note_cleanups_for_fd(pool *, int); @@ -395,8 +397,8 @@ /* Finally, some accounting */ -API_EXPORT(long) ap_bytes_in_pool(pool *p); -API_EXPORT(long) ap_bytes_in_free_blocks(void); +API_EXPORT(ap_int32) ap_bytes_in_pool(pool *p); +API_EXPORT(ap_int32) ap_bytes_in_free_blocks(void); #ifdef __cplusplus } diff -Naur apache_1.3.12/src/include/ap.h-orig apache_1.3.12/src/include/ap.h --- apache_1.3.12/src/include/ap.h-orig Mon Dec 6 14:16:58 1999 +++ apache_1.3.12/src/include/ap.h Wed Feb 9 17:34:31 2000 @@ -137,6 +137,7 @@ char *endpos; } ap_vformatter_buff; +/*PRINTFLIKE3*/ API_EXPORT(int) ap_vformatter(int (*flush_func)(ap_vformatter_buff *), ap_vformatter_buff *, const char *fmt, va_list ap); @@ -155,8 +156,10 @@ * to distinguish between an output which was truncated, and an output which * exactly filled the buffer. */ +/*PRINTFLIKE3*/ API_EXPORT(int) ap_snprintf(char *buf, size_t len, const char *format,...) __attribute__((format(printf,3,4))); +/*PRINTFLIKE3*/ API_EXPORT(int) ap_vsnprintf(char *buf, size_t len, const char *format, va_list ap); /* Simple BASE64 encode/decode functions. diff -Naur apache_1.3.12/src/include/ap_config.h-orig apache_1.3.12/src/include/ap_config.h --- apache_1.3.12/src/include/ap_config.h-orig Wed Feb 23 04:44:56 2000 +++ apache_1.3.12/src/include/ap_config.h Wed Mar 1 17:04:23 2000 @@ -97,8 +97,11 @@ * on, but it doesn't implement half of the things that __GNUC__ * means. In particular it's missing inline and the __attribute__ * stuff. So we hack around it. PR#1613. -djg + * + * Irix MIPSpro compilers support __inline__ but the ucode compilers don't. */ -#if !defined(__GNUC__) || __GNUC__ < 2 || \ +#if (!defined(IRIX) || _MIPS_SIM == _ABIO32) &&\ + !defined(__GNUC__) || __GNUC__ < 2 || \ (__GNUC__ == 2 && __GNUC_MINOR__ < 7) ||\ defined(NEXT) #define ap_inline @@ -191,18 +194,24 @@ * there's some weird conflict with non-BSD signals */ #define NO_KILLPG #undef NO_SETSID -#if !defined(USE_FLOCK_SERIALIZED_ACCEPT) && \ - !defined(USE_USLOCK_SERIALIZED_ACCEPT) && \ - !defined(USE_SYSVSEM_SERIALIZED_ACCEPT) +#undef USE_FCNTL_SERIALIZED_ACCEPT +#undef USE_FLOCK_SERIALIZED_ACCEPT +#undef USE_USLOCK_SERIALIZED_ACCEPT +#undef USE_SYSVSEM_SERIALIZED_ACCEPT +#if IRIX >= 65 +#define NO_SERIALIZED_ACCEPT +#else #define USE_FCNTL_SERIALIZED_ACCEPT #endif +#define SINGLE_LISTEN_UNSERIALIZED_ACCEPT #define HAVE_SHMGET 1 -#define USE_SHMGET_SCOREBOARD +#define USE_MMAP_SCOREBOARD #define HAVE_MMAP 1 #define USE_MMAP_FILES #define NO_LONG_DOUBLE #define NO_LINGCLOSE #define HAVE_SYSLOG 1 +#define CACHE_ALIGNMENT 128 /* best value for most SGI servers */ #elif defined(HIUX) #undef HAVE_GMTOFF @@ -995,6 +1004,10 @@ #include #endif /* HAVE_SYS_PARAM_H */ +#if defined(FAST_TIME) && defined(NO_OTHER_CHILD) +# error "FAST_TIME requires other-child support" +#endif + /* stuff marked API_EXPORT is part of the API, and intended for use * by modules */ @@ -1152,7 +1165,7 @@ int setrlimit(int, struct rlimit *); #endif #endif -#ifdef USE_MMAP_SCOREBOARD +#ifdef HAVE_MMAP #if !defined(OS2) && !defined(WIN32) /* This file is not needed for OS/2 */ #include @@ -1162,6 +1175,12 @@ #define MAP_ANON MAP_ANONYMOUS #endif +#ifdef HAVE_SHMGET +#include +#include +#include +#endif + #if defined(USE_MMAP_FILES) && (defined(NO_MMAP) || !defined(HAVE_MMAP)) #undef USE_MMAP_FILES #endif @@ -1191,7 +1210,7 @@ #endif #ifndef INADDR_NONE -#define INADDR_NONE ((unsigned long) -1) +#define INADDR_NONE ((ap_uint32) -1) #endif /* @@ -1265,7 +1284,7 @@ #endif #ifndef ap_inet_addr -#define ap_inet_addr inet_addr +#define ap_inet_addr(str) ((ap_uint32) inet_addr(str)) #endif #ifdef NO_OTHER_CHILD @@ -1347,6 +1366,30 @@ #define WCOREDUMP __WCOREDUMP #endif +/* + * Maximum number of bytes to write from an mmap'ed region per write(). + * See ap_send_mmap() and qsc_process_request(). + */ +#ifndef MMAP_SEGMENT_SIZE +#define MMAP_SEGMENT_SIZE 32768 +#endif + +/* + * Aligning the address and length of certain key data structures and + * buffers to exactly match cache lines can dramatically increase + * performance. In the absence of an architecture-specific + * CACHE_ALIGNMENT definition from above, assume this arbitrary default. + * Set to 0 to disable alignment. When adding your own specific version + * above, use the larger of your processor's primary and secondary cache + * line sizes. + */ +#ifndef CACHE_ALIGNMENT +#define CACHE_ALIGNMENT 32 /* in bytes */ +#endif +#if CACHE_ALIGNMENT & (CACHE_ALIGNMENT - 1) +#error "CACHE_ALIGNMENT must be a power of two" +#endif + #ifdef SUNOS_LIB_PROTOTYPES /* Prototypes needed to get a clean compile with gcc -Wall. * Believe it or not, these do have to be declared, at least on SunOS, @@ -1403,7 +1446,7 @@ void syslog(int, char *,...); char *mktemp(char *); -long vfprintf(FILE *, const char *, va_list); +int vfprintf(FILE *, const char *, va_list); #endif /* SUNOS_LIB_PROTOTYPES */ diff -Naur apache_1.3.12/src/include/ap_md5.h-orig apache_1.3.12/src/include/ap_md5.h --- apache_1.3.12/src/include/ap_md5.h-orig Sun Sep 19 14:24:01 1999 +++ apache_1.3.12/src/include/ap_md5.h Wed Feb 9 17:34:31 2000 @@ -121,7 +121,7 @@ API_EXPORT(void) ap_MD5Encode(const unsigned char *password, const unsigned char *salt, char *result, size_t nbytes); -API_EXPORT(void) ap_to64(char *s, unsigned long v, int n); +API_EXPORT(void) ap_to64(char *s, ap_uint32 v, int n); #ifdef __cplusplus } diff -Naur apache_1.3.12/src/include/ap_mmn.h-orig apache_1.3.12/src/include/ap_mmn.h --- apache_1.3.12/src/include/ap_mmn.h-orig Sat Feb 19 17:14:46 2000 +++ apache_1.3.12/src/include/ap_mmn.h Wed Mar 1 17:04:23 2000 @@ -229,7 +229,7 @@ * 19990320.7 - add ap_strcasestr() */ -#define MODULE_MAGIC_COOKIE 0x41503133UL /* "AP13" */ +#define MODULE_MAGIC_COOKIE ((ap_uint32) 0x41503133) /* "AP13" */ #ifndef MODULE_MAGIC_NUMBER_MAJOR #define MODULE_MAGIC_NUMBER_MAJOR 19990320 diff -Naur apache_1.3.12/src/include/ap_sha1.h-orig apache_1.3.12/src/include/ap_sha1.h --- apache_1.3.12/src/include/ap_sha1.h-orig Sat Aug 14 01:35:47 1999 +++ apache_1.3.12/src/include/ap_sha1.h Wed Feb 9 17:34:31 2000 @@ -76,7 +76,7 @@ #define AP_SHA1PW_ID "{SHA}" #define AP_SHA1PW_IDLEN 5 -typedef unsigned long AP_LONG; /* a 32-bit quantity */ +typedef ap_uint32 AP_LONG; /* a 32-bit quantity */ typedef struct { AP_LONG digest[5]; /* message digest */ diff -Naur apache_1.3.12/src/include/ap_types.h-orig apache_1.3.12/src/include/ap_types.h --- apache_1.3.12/src/include/ap_types.h-orig +++ apache_1.3.12/src/include/ap_types.h Thu Apr 29 16:47:57 1999 @@ -0,0 +1,29 @@ +#ifndef APACHE_TYPES_H +#define APACHE_TYPES_H + +/* + * Define standard-sized types. + * ap_int32 signed 32-bit integer + * ap_uint32 unsigned 32-bit integer + * ap_ptr unsigned pointer-sized integer + * ap_atomic unsigned atomically-updatable integer (>= ap_ptr) + */ + +#ifdef IRIX +/* + * Irix uses an ILP32 model in 32-bit mode (ints, longs, and pointers + * are all 32 bits) and an LP64 model in 64-bit mode (ints are 32 bits, + * longs and pointers are 64 bits) so the following are always correct. + */ +typedef int ap_int32; +typedef unsigned int ap_uint32; +typedef unsigned long ap_ptr; +typedef unsigned long ap_atomic; +#else +typedef long ap_int32; +typedef unsigned long ap_uint32; +typedef unsigned long ap_ptr; +typedef unsigned long ap_atomic; +#endif + +#endif diff -Naur apache_1.3.12/src/include/buff.h-orig apache_1.3.12/src/include/buff.h --- apache_1.3.12/src/include/buff.h-orig Fri Jan 1 11:04:39 1999 +++ apache_1.3.12/src/include/buff.h Wed Feb 9 17:34:31 2000 @@ -58,6 +58,16 @@ #ifndef APACHE_BUFF_H #define APACHE_BUFF_H +#include +#ifdef NO_WRITEV +struct iovec { + void *iov_base; + size_t iov_len; +}; +#else +#include +#endif + #ifdef __cplusplus extern "C" { #endif @@ -110,7 +120,7 @@ int bufsiz; void (*error) (BUFF *fb, int op, void *data); void *error_data; - long int bytes_sent; /* number of bytes actually written */ + ap_int32 bytes_sent; /* number of bytes actually written */ ap_pool *pool; @@ -165,11 +175,14 @@ API_EXPORT(int) ap_blookc(char *buff, BUFF *fb); API_EXPORT(int) ap_bskiplf(BUFF *fb); API_EXPORT(int) ap_bwrite(BUFF *fb, const void *buf, int nbyte); +API_EXPORT(int) ap_bwritev(BUFF *fb, struct iovec *, int); API_EXPORT(int) ap_bflush(BUFF *fb); API_EXPORT(int) ap_bputs(const char *x, BUFF *fb); API_EXPORT(int) ap_bvputs(BUFF *fb,...); +/*PRINTFLIKE2*/ API_EXPORT_NONSTD(int) ap_bprintf(BUFF *fb, const char *fmt,...) __attribute__((format(printf,2,3))); +/*PRINTFLIKE2*/ API_EXPORT(int) ap_vbprintf(BUFF *fb, const char *fmt, va_list vlist); /* Internal routines */ diff -Naur apache_1.3.12/src/include/http_conf_globals.h-orig apache_1.3.12/src/include/http_conf_globals.h --- apache_1.3.12/src/include/http_conf_globals.h-orig Thu Oct 21 13:44:16 1999 +++ apache_1.3.12/src/include/http_conf_globals.h Wed Feb 9 17:34:31 2000 @@ -91,6 +91,13 @@ extern int ap_listenbacklog; extern int ap_dump_settings; extern API_VAR_EXPORT int ap_extended_status; +#ifdef USE_QSC +extern int ap_qsc_enabled; +#endif + +#ifdef SINGLE_LISTEN_UNSERIALIZED_ACCEPT +extern int ap_single_listen; +#endif extern char *ap_pid_fname; extern char *ap_scoreboard_fname; diff -Naur apache_1.3.12/src/include/http_config.h-orig apache_1.3.12/src/include/http_config.h --- apache_1.3.12/src/include/http_config.h-orig Thu May 6 17:16:10 1999 +++ apache_1.3.12/src/include/http_config.h Wed Feb 9 17:34:31 2000 @@ -204,7 +204,7 @@ struct module_struct *next; - unsigned long magic; /* Magic Cookie to identify a module structure; + ap_uint32 magic; /* Magic Cookie to identify a module structure; * It's mainly important for the DSO facility * (see also mod_so). */ diff -Naur apache_1.3.12/src/include/http_core.h-orig apache_1.3.12/src/include/http_core.h --- apache_1.3.12/src/include/http_core.h-orig Wed Feb 2 12:43:42 2000 +++ apache_1.3.12/src/include/http_core.h Wed Mar 1 17:04:24 2000 @@ -131,7 +131,7 @@ API_EXPORT(char *) ap_construct_url(pool *p, const char *uri, request_rec *r); API_EXPORT(const char *) ap_get_server_name(request_rec *r); API_EXPORT(unsigned) ap_get_server_port(const request_rec *r); -API_EXPORT(unsigned long) ap_get_limit_req_body(const request_rec *r); +API_EXPORT(ap_uint32) ap_get_limit_req_body(const request_rec *r); API_EXPORT(void) ap_custom_response(request_rec *r, int status, char *string); API_EXPORT(int) ap_exists_config_define(char *name); @@ -262,7 +262,7 @@ #ifdef RLIMIT_NPROC struct rlimit *limit_nproc; #endif - unsigned long limit_req_body; /* limit on bytes in request msg body */ + ap_uint32 limit_req_body; /* limit on bytes in request msg body */ /* logging options */ enum { srv_sig_unset, srv_sig_off, srv_sig_on, diff -Naur apache_1.3.12/src/include/http_log.h-orig apache_1.3.12/src/include/http_log.h --- apache_1.3.12/src/include/http_log.h-orig Tue Aug 31 21:29:02 1999 +++ apache_1.3.12/src/include/http_log.h Wed Feb 9 17:34:31 2000 @@ -114,9 +114,11 @@ * attack and other messy behavior. Instead, use a simple format string * like "%s", followed by the string containing the untrusted data. */ +/*PRINTFLIKE5*/ API_EXPORT(void) ap_log_error(const char *file, int line, int level, const server_rec *s, const char *fmt, ...) __attribute__((format(printf,5,6))); +/*PRINTFLIKE5*/ API_EXPORT(void) ap_log_rerror(const char *file, int line, int level, const request_rec *s, const char *fmt, ...) __attribute__((format(printf,5,6))); @@ -129,6 +131,7 @@ API_EXPORT(void) ap_log_error_old(const char *err, server_rec *s); API_EXPORT(void) ap_log_unixerr(const char *routine, const char *file, const char *msg, server_rec *s); +/*PRINTFLIKE2*/ API_EXPORT(void) ap_log_printf(const server_rec *s, const char *fmt, ...) __attribute__((format(printf,2,3))); API_EXPORT(void) ap_log_reason(const char *reason, const char *fname, diff -Naur apache_1.3.12/src/include/http_main.h-orig apache_1.3.12/src/include/http_main.h --- apache_1.3.12/src/include/http_main.h-orig Fri Jan 1 11:04:40 1999 +++ apache_1.3.12/src/include/http_main.h Wed Feb 9 17:34:31 2000 @@ -127,6 +127,13 @@ unsigned int ap_set_callback_and_alarm(void (*fn) (int), int x); API_EXPORT(int) ap_check_alarm(void); +#ifdef HAVE_MMAP +API_EXPORT(caddr_t) ap_map_anonymous(pool *p, caddr_t addr, size_t size); +#endif +#ifdef HAVE_SHMGET +API_EXPORT(caddr_t) ap_share_anonymous(pool *p, caddr_t addr, size_t size); +#endif + #ifndef NO_OTHER_CHILD /* * register an other_child -- a child which the main loop keeps track of diff -Naur apache_1.3.12/src/include/http_protocol.h-orig apache_1.3.12/src/include/http_protocol.h --- apache_1.3.12/src/include/http_protocol.h-orig Fri Nov 5 07:41:01 1999 +++ apache_1.3.12/src/include/http_protocol.h Wed Feb 9 17:34:31 2000 @@ -82,10 +82,12 @@ * ap_send_http_header(). */ API_EXPORT(void) ap_basic_http_header(request_rec *r); +API_EXPORT(void) ap_tee_basic_http_header(request_rec *r, char *, size_t *); /* Send the Status-Line and header fields for HTTP response */ API_EXPORT(void) ap_send_http_header(request_rec *l); +API_EXPORT(void) ap_tee_http_header(request_rec *l, char *, size_t *); /* Send the response to special method requests */ @@ -112,7 +114,7 @@ * permit_cache argument is set to one). */ -API_EXPORT(int) ap_set_content_length(request_rec *r, long length); +API_EXPORT(int) ap_set_content_length(request_rec *r, ap_int32 length); API_EXPORT(int) ap_set_keepalive(request_rec *r); API_EXPORT(time_t) ap_rationalize_mtime(request_rec *r, time_t mtime); API_EXPORT(char *) ap_make_etag(request_rec *r, int force_weak); @@ -131,15 +133,20 @@ * (Ditto the send_header stuff). */ -API_EXPORT(long) ap_send_fd(FILE *f, request_rec *r); -API_EXPORT(long) ap_send_fd_length(FILE *f, request_rec *r, long length); +API_EXPORT(ap_int32) ap_send_fd(FILE *f, request_rec *r); +API_EXPORT(ap_int32) ap_send_fd_length(FILE *f, request_rec *r, ap_int32 length); +#ifdef USE_DIRECT_IO +API_EXPORT(ap_int32) ap_send_fd_direct(FILE *f, request_rec *r, const struct dioattr *da); +#endif -API_EXPORT(long) ap_send_fb(BUFF *f, request_rec *r); -API_EXPORT(long) ap_send_fb_length(BUFF *f, request_rec *r, long length); +API_EXPORT(ap_int32) ap_send_fb(BUFF *f, request_rec *r); +API_EXPORT(ap_int32) ap_send_fb_length(BUFF *f, request_rec *r, ap_int32 length); API_EXPORT(size_t) ap_send_mmap(void *mm, request_rec *r, size_t offset, size_t length); +API_EXPORT(size_t) ap_send_iovec(request_rec *, struct iovec *, int); + /* Hmmm... could macrofy these for now, and maybe forever, though the * definitions of the macros would get a whole lot hairier. */ @@ -148,7 +155,9 @@ API_EXPORT(int) ap_rputs(const char *str, request_rec *r); API_EXPORT(int) ap_rwrite(const void *buf, int nbyte, request_rec *r); API_EXPORT_NONSTD(int) ap_rvputs(request_rec *r,...); +/*PRINTFLIKE2*/ API_EXPORT(int) ap_vrprintf(request_rec *r, const char *fmt, va_list vlist); +/*PRINTFLIKE2*/ API_EXPORT_NONSTD(int) ap_rprintf(request_rec *r, const char *fmt,...) __attribute__((format(printf,2,3))); API_EXPORT(int) ap_rflush(request_rec *r); @@ -164,13 +173,13 @@ API_EXPORT(int) ap_setup_client_block(request_rec *r, int read_policy); API_EXPORT(int) ap_should_client_block(request_rec *r); -API_EXPORT(long) ap_get_client_block(request_rec *r, char *buffer, int bufsiz); +API_EXPORT(ap_int32) ap_get_client_block(request_rec *r, char *buffer, int bufsiz); API_EXPORT(int) ap_discard_request_body(request_rec *r); /* Sending a byterange */ API_EXPORT(int) ap_set_byterange(request_rec *r); -API_EXPORT(int) ap_each_byterange(request_rec *r, long *offset, long *length); +API_EXPORT(int) ap_each_byterange(request_rec *r, ap_int32 *offset, ap_int32 *length); /* Support for the Basic authentication protocol. Note that there's * nothing that prevents these from being in mod_auth.c, except that other diff -Naur apache_1.3.12/src/include/httpd.h-orig apache_1.3.12/src/include/httpd.h --- apache_1.3.12/src/include/httpd.h-orig Wed Feb 23 15:01:33 2000 +++ apache_1.3.12/src/include/httpd.h Wed Mar 1 17:04:24 2000 @@ -66,8 +66,21 @@ * httpd.h: header for simple (ha! not anymore) http daemon */ +/* + * Mike Abbott - mja@sgi.com + * Accelerating Apache Project - http://oss.sgi.com/projects/apache/ + */ +#ifdef SPEED_DAEMON /* that's me, a real speed demon */ +# define USE_QSC /* enable the Quick Shortcut Cache */ +# define FAST_TIME /* eliminate redundant calls to time() */ +# define BUFFERED_LOGS /* buffer log messages */ +# define NO_GRACEFUL /* eliminate per-request signal manipulation */ +# define USE_QUICK_LOG /* fast path through logging code */ +#endif + /* Headers in which EVERYONE has an interest... */ +#include "ap_types.h" #include "ap_config.h" #include "alloc.h" #include "buff.h" @@ -692,6 +705,7 @@ */ char *the_request; /* First line of request, so we can log it */ + int the_request_len; /* strlen(the_request) */ int assbackwards; /* HTTP/0.9, "simple" request */ enum proxyreqtype proxyreq;/* A proxy request (calculated during * post_read_request or translate_name) */ @@ -735,7 +749,7 @@ int allowed; /* Allowed methods - for 405, OPTIONS, etc */ int sent_bodyct; /* byte count in stream is for body */ - long bytes_sent; /* body byte count, for easy access */ + ap_int32 bytes_sent; /* body byte count, for easy access */ time_t mtime; /* Time the resource was last modified */ /* HTTP/1.1 connection-level features */ @@ -744,10 +758,10 @@ int byterange; /* number of byte ranges */ char *boundary; /* multipart/byteranges boundary */ const char *range; /* The Range: header */ - long clength; /* The "real" content length */ + ap_int32 clength; /* The "real" content length */ - long remaining; /* bytes left to read */ - long read_length; /* bytes that have been read */ + ap_int32 remaining; /* bytes left to read */ + ap_int32 read_length; /* bytes that have been read */ int read_body; /* how the request body should be read */ int read_chunked; /* reading chunked transfer-coding */ unsigned expecting_100; /* is client waiting for a 100 response? */ @@ -819,6 +833,10 @@ * record to improve 64bit alignment the next time we need to break * binary compatibility for some other reason. */ + + char *rqbuf; /* quickly_read_request_line()'s buffer */ + char *rqhdr; /* quickly_get_mime_headers()'s headers */ + int rqhdr_len; /* strlen(rqhdr) */ }; @@ -841,7 +859,8 @@ struct sockaddr_in local_addr; /* local address */ struct sockaddr_in remote_addr; /* remote address */ - char *remote_ip; /* Client's IP address */ + char remote_ip[16]; /* Client's IP address */ + int remote_ip_len; /* strlen(remote_ip) */ char *remote_host; /* Client's DNS name, if known. * NULL if DNS hasn't been checked, * "" if it has and no address was found. @@ -863,7 +882,8 @@ signed int double_reverse:2;/* have we done double-reverse DNS? * -1 yes/failure, 0 not yet, 1 yes/success */ int keepalives; /* How many times have we used it? */ - char *local_ip; /* server IP address */ + char local_ip[16]; /* server IP address */ + int local_ip_len; /* strlen(local_ip) */ char *local_host; /* used for ap_get_server_name when * UseCanonicalName is set to DNS * (ignores setting of HostnameLookups) */ @@ -874,7 +894,7 @@ /* The address 255.255.255.255, when used as a virtualhost address, * will become the "default" server when the ip doesn't match other vhosts. */ -#define DEFAULT_VHOST_ADDR 0xfffffffful +#define DEFAULT_VHOST_ADDR ((ap_uint32) 0xffffffff) typedef struct server_addr_rec server_addr_rec; struct server_addr_rec { @@ -947,6 +967,10 @@ struct sockaddr_in local_addr; /* local IP address and port */ int fd; int used; /* Only used during restart */ + int unique; /* is local_addr unique (not wild)? */ +#ifdef SINGLE_LISTEN_UNSERIALIZED_ACCEPT + int cpu; /* if ap_single_listen, cpu to bind to */ +#endif /* more stuff here, like which protocol is bound to the port */ }; @@ -959,10 +983,12 @@ extern API_VAR_EXPORT const char ap_month_snames[12][4]; extern API_VAR_EXPORT const char ap_day_snames[7][4]; +API_EXPORT(time_t) ap_time(void); API_EXPORT(struct tm *) ap_get_gmtoff(int *tz); API_EXPORT(char *) ap_get_time(void); API_EXPORT(char *) ap_field_noparam(pool *p, const char *intype); API_EXPORT(char *) ap_ht_time(pool *p, time_t t, const char *fmt, int gmt); +API_EXPORT(int) ap_gm_timestr_822_buf(char *buf, size_t size, time_t t); API_EXPORT(char *) ap_gm_timestr_822(pool *p, time_t t); /* String handling. The *_nc variants allow you to use non-const char **s as @@ -1033,6 +1059,9 @@ API_EXPORT(char *) ap_escape_quotes (pool *p, const char *instring); +API_EXPORT(char *) ap_inet_ntoa(struct in_addr, char * /* 16 bytes */, int *); +API_EXPORT(int) ap_oversized_file(off_t); + /* Common structure for reading of config files / passwd files etc. */ typedef struct { int (*getch) (void *param); /* a getc()-like function */ @@ -1098,7 +1127,7 @@ #endif /* _OSD_POSIX */ char *ap_get_local_host(pool *); -unsigned long ap_get_virthost_addr(char *hostname, unsigned short *port); +ap_uint32 ap_get_virthost_addr(char *hostname, unsigned short *port); extern API_VAR_EXPORT time_t ap_restart_time; @@ -1178,6 +1207,22 @@ #undef strtoul #endif #define strtoul strtoul_is_not_a_portable_function_use_strtol_instead + +#ifdef USE_QSC +/* QSC - Quick Shortcut Cache */ +extern void qsc_init(pool *); +extern int qsc_process_request(request_rec *); +extern void qsc_insert_request(request_rec *, const char *, size_t, void *, + size_t, const char *, const char *); +extern void qsc_status(request_rec *, const char *); +#endif + +/* + * 64-bit porting aides. On 64-bit Irix, strlen() returns size_t which + * is 64 bits, generating many warnings when assigned to 32-bit objects. + */ +#define ap_strlen(str) ((int) strlen(str)) +#define ap_atol(str) ((ap_int32) atol(str)) #ifdef __cplusplus } diff -Naur apache_1.3.12/src/include/scoreboard.h-orig apache_1.3.12/src/include/scoreboard.h --- apache_1.3.12/src/include/scoreboard.h-orig Wed Jan 12 07:54:56 2000 +++ apache_1.3.12/src/include/scoreboard.h Wed Feb 9 17:34:31 2000 @@ -160,11 +160,24 @@ char request[64]; /* We just want an idea... */ server_rec *vhostrec; /* What virtual host is being accessed? */ /* SEE ABOVE FOR SAFE USAGE! */ +#ifdef SINGLE_LISTEN_UNSERIALIZED_ACCEPT + int cpu; /* cpu to which it is bound */ + struct sockaddr_in single_addr; /* if ap_single_listen, listen addr */ +#endif +#ifdef USE_QSC + ap_atomic qsc_nucreq; /* uncachable requests */ + ap_atomic qsc_nucres; /* uncachable responses */ + ap_atomic qsc_nhits; /* successful qsc lookups */ + ap_atomic qsc_nmisses; /* unsuccessful qsc lookups */ +#endif } short_score; typedef struct { ap_generation_t running_generation; /* the generation of children which * should still be serving requests. */ +#ifdef FAST_TIME + time_t time; /* time of day from time() */ +#endif } global_score; /* stuff which the parent generally writes and the children rarely read */ diff -Naur apache_1.3.12/src/lib/expat-lite/xmldef.h-orig apache_1.3.12/src/lib/expat-lite/xmldef.h --- apache_1.3.12/src/lib/expat-lite/xmldef.h-orig Wed Jun 9 03:45:03 1999 +++ apache_1.3.12/src/lib/expat-lite/xmldef.h Wed Feb 9 17:34:31 2000 @@ -64,6 +64,7 @@ #ifdef APACHE +#include "ap_types.h" #include "ap_config.h" #define XML_BYTE_ORDER AP_BYTE_ORDER diff -Naur apache_1.3.12/src/lib/expat-lite/xmlparse.c-orig apache_1.3.12/src/lib/expat-lite/xmlparse.c --- apache_1.3.12/src/lib/expat-lite/xmlparse.c-orig Fri Jan 14 01:03:49 2000 +++ apache_1.3.12/src/lib/expat-lite/xmlparse.c Wed Feb 9 17:34:31 2000 @@ -31,6 +31,11 @@ #include "xmldef.h" #include "xmlparse.h" +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +/* disable warnings about unused formal parameters */ +#pragma set woff 1174 +#endif + #ifdef XML_UNICODE #define XML_ENCODE_MAX XML_UTF16_ENCODE_MAX #define XmlConvert XmlUtf16Convert @@ -37,7 +42,7 @@ #define XmlGetInternalEncoding XmlGetUtf16InternalEncoding #define XmlGetInternalEncodingNS XmlGetUtf16InternalEncodingNS #define XmlEncode XmlUtf16Encode -#define MUST_CONVERT(enc, s) (!(enc)->isUtf16 || (((unsigned long)s) & 1)) +#define MUST_CONVERT(enc, s) (!(enc)->isUtf16 || (((ap_uint32)s) & 1)) typedef unsigned short ICHAR; #else #define XML_ENCODE_MAX XML_UTF8_ENCODE_MAX @@ -273,7 +278,7 @@ char *m_bufferEnd; /* allocated end of buffer */ const char *m_bufferLim; - long m_parseEndByteIndex; + ap_int32 m_parseEndByteIndex; const char *m_parseEndPtr; XML_Char *m_dataBuf; XML_Char *m_dataBufEnd; @@ -786,7 +791,7 @@ return 0; } XmlUpdatePosition(encoding, positionPtr, end, &position); - nLeftOver = s + len - end; + nLeftOver = (int) (s + len - end); if (nLeftOver) { if (buffer == 0 || nLeftOver > bufferLim - buffer) { /* FIXME avoid integer overflow */ @@ -833,7 +838,7 @@ { if (len > bufferLim - bufferEnd) { /* FIXME avoid integer overflow */ - int neededSize = len + (bufferEnd - bufferPtr); + int neededSize = len + (int) (bufferEnd - bufferPtr); if (neededSize <= bufferLim - buffer) { memmove(buffer, bufferPtr, bufferEnd - bufferPtr); bufferEnd = buffer + (bufferEnd - bufferPtr); @@ -841,7 +846,7 @@ } else { char *newBuf; - int bufferSize = bufferLim - bufferPtr; + int bufferSize = (int) (bufferLim - bufferPtr); if (bufferSize == 0) bufferSize = INIT_BUFFER_SIZE; do { @@ -869,10 +874,10 @@ return errorCode; } -long XML_GetCurrentByteIndex(XML_Parser parser) +ap_int32 XML_GetCurrentByteIndex(XML_Parser parser) { if (eventPtr) - return parseEndByteIndex - (parseEndPtr - eventPtr); + return (ap_int32) (parseEndByteIndex - (parseEndPtr - eventPtr)); return -1; } @@ -879,7 +884,7 @@ int XML_GetCurrentByteCount(XML_Parser parser) { if (eventEndPtr && eventPtr) - return eventEndPtr - eventPtr; + return (int) (eventEndPtr - eventPtr); return 0; } @@ -1223,7 +1228,7 @@ /* Need to guarantee that: tag->buf + ROUND_UP(tag->rawNameLength, sizeof(XML_Char)) <= tag->bufEnd - sizeof(XML_Char) */ if (tag->rawNameLength + (int)(sizeof(XML_Char) - 1) + (int)sizeof(XML_Char) > tag->bufEnd - tag->buf) { - int bufSize = tag->rawNameLength * 4; + size_t bufSize = tag->rawNameLength * 4; bufSize = ROUND_UP(bufSize, sizeof(XML_Char)); tag->buf = realloc(tag->buf, bufSize); if (!tag->buf) @@ -1240,7 +1245,7 @@ for (;;) { const char *rawNameEnd = tag->rawName + tag->rawNameLength; const char *fromPtr = tag->rawName; - int bufSize; + size_t bufSize; if (nextPtr) toPtr = (XML_Char *)(tag->buf + ROUND_UP(tag->rawNameLength, sizeof(XML_Char))); else @@ -1421,12 +1426,12 @@ if (MUST_CONVERT(enc, s)) { ICHAR *dataPtr = (ICHAR *)dataBuf; XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)dataBufEnd); - characterDataHandler(handlerArg, dataBuf, dataPtr - (ICHAR *)dataBuf); + characterDataHandler(handlerArg, dataBuf, (int) (dataPtr - (ICHAR *)dataBuf)); } else characterDataHandler(handlerArg, (XML_Char *)s, - (XML_Char *)end - (XML_Char *)s); + (int) ((XML_Char *)end - (XML_Char *)s)); } else if (defaultHandler) reportDefault(parser, enc, s, end); @@ -1446,7 +1451,7 @@ ICHAR *dataPtr = (ICHAR *)dataBuf; XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd); *eventEndPP = s; - characterDataHandler(handlerArg, dataBuf, dataPtr - (ICHAR *)dataBuf); + characterDataHandler(handlerArg, dataBuf, (int) (dataPtr - (ICHAR *)dataBuf)); if (s == next) break; *eventPP = s; @@ -1455,7 +1460,7 @@ else characterDataHandler(handlerArg, (XML_Char *)s, - (XML_Char *)next - (XML_Char *)s); + (int) ((XML_Char *)next - (XML_Char *)s)); } else if (defaultHandler) reportDefault(parser, enc, s, next); @@ -1795,7 +1800,7 @@ ICHAR *dataPtr = (ICHAR *)dataBuf; XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd); *eventEndPP = next; - characterDataHandler(handlerArg, dataBuf, dataPtr - (ICHAR *)dataBuf); + characterDataHandler(handlerArg, dataBuf, (int) (dataPtr - (ICHAR *)dataBuf)); if (s == next) break; *eventPP = s; @@ -1804,7 +1809,7 @@ else characterDataHandler(handlerArg, (XML_Char *)s, - (XML_Char *)next - (XML_Char *)s); + (int) ((XML_Char *)next - (XML_Char *)s)); } else if (defaultHandler) reportDefault(parser, enc, s, next); @@ -2411,7 +2416,6 @@ if (!poolAppend(pool, enc, ptr, next)) return XML_ERROR_NO_MEMORY; break; - break; case XML_TOK_TRAILING_CR: next = ptr + enc->minBytesPerChar; /* fall through */ @@ -2503,7 +2507,7 @@ case XML_TOK_NONE: if (declEntity) { declEntity->textPtr = pool->start; - declEntity->textLen = pool->ptr - pool->start; + declEntity->textLen = (int) (pool->ptr - pool->start); poolFinish(pool); } else @@ -2647,12 +2651,12 @@ ICHAR *dataPtr = (ICHAR *)dataBuf; XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)dataBufEnd); *eventEndPP = s; - defaultHandler(handlerArg, dataBuf, dataPtr - (ICHAR *)dataBuf); + defaultHandler(handlerArg, dataBuf, (int) (dataPtr - (ICHAR *)dataBuf)); *eventPP = s; } while (s != end); } else - defaultHandler(handlerArg, (XML_Char *)s, (XML_Char *)end - (XML_Char *)s); + defaultHandler(handlerArg, (XML_Char *)s, (int) ((XML_Char *)end - (XML_Char *)s)); } @@ -3225,7 +3229,7 @@ } } if (pool->blocks && pool->start == pool->blocks->s) { - int blockSize = (pool->end - pool->start)*2; + int blockSize = (int) (pool->end - pool->start)*2; pool->blocks = realloc(pool->blocks, offsetof(BLOCK, s) + blockSize * sizeof(XML_Char)); if (!pool->blocks) return 0; @@ -3236,7 +3240,7 @@ } else { BLOCK *tem; - int blockSize = pool->end - pool->start; + int blockSize = (int) (pool->end - pool->start); if (blockSize < INIT_BLOCK_SIZE) blockSize = INIT_BLOCK_SIZE; else diff -Naur apache_1.3.12/src/lib/expat-lite/xmlparse.h-orig apache_1.3.12/src/lib/expat-lite/xmlparse.h --- apache_1.3.12/src/lib/expat-lite/xmlparse.h-orig Mon May 31 03:56:25 1999 +++ apache_1.3.12/src/lib/expat-lite/xmlparse.h Wed Feb 9 17:34:31 2000 @@ -456,7 +456,7 @@ int XMLPARSEAPI XML_GetCurrentLineNumber(XML_Parser parser); int XMLPARSEAPI XML_GetCurrentColumnNumber(XML_Parser parser); -long XMLPARSEAPI XML_GetCurrentByteIndex(XML_Parser parser); +ap_int32 XMLPARSEAPI XML_GetCurrentByteIndex(XML_Parser parser); /* Return the number of bytes in the current event. Returns 0 if the event is in an internal entity. */ diff -Naur apache_1.3.12/src/lib/expat-lite/xmlrole.c-orig apache_1.3.12/src/lib/expat-lite/xmlrole.c --- apache_1.3.12/src/lib/expat-lite/xmlrole.c-orig Mon May 31 03:56:25 1999 +++ apache_1.3.12/src/lib/expat-lite/xmlrole.c Wed Feb 9 17:34:31 2000 @@ -31,6 +31,11 @@ #include "xmldef.h" #include "xmlrole.h" +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +/* disable warnings about unused formal parameters */ +#pragma set woff 1174 +#endif + /* Doesn't check: that ,| are not mixed in a model group diff -Naur apache_1.3.12/src/lib/expat-lite/xmltok.c-orig apache_1.3.12/src/lib/expat-lite/xmltok.c --- apache_1.3.12/src/lib/expat-lite/xmltok.c-orig Wed Jun 9 03:50:07 1999 +++ apache_1.3.12/src/lib/expat-lite/xmltok.c Wed Feb 9 17:34:31 2000 @@ -32,6 +32,11 @@ #include "xmltok.h" #include "nametab.h" +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +/* disable warnings about unused formal parameters */ +#pragma set woff 1174 +#endif + #define VTABLE1 \ { PREFIX(prologTok), PREFIX(contentTok), PREFIX(cdataSectionTok) }, \ { PREFIX(attributeValueTok), PREFIX(entityValueTok) }, \ @@ -314,7 +319,7 @@ break; case BT_LEAD4: { - unsigned long n; + ap_uint32 n; if (to + 1 == toLim) break; n = ((from[0] & 0x7) << 18) | ((from[1] & 0x3f) << 12) | ((from[2] & 0x3f) << 6) | (from[3] & 0x3f); diff -Naur apache_1.3.12/src/lib/expat-lite/xmltok.h-orig apache_1.3.12/src/lib/expat-lite/xmltok.h --- apache_1.3.12/src/lib/expat-lite/xmltok.h-orig Thu Jun 3 03:35:27 1999 +++ apache_1.3.12/src/lib/expat-lite/xmltok.h Wed Feb 9 17:34:31 2000 @@ -124,8 +124,8 @@ typedef struct position { /* first line and first column are 0 not 1 */ - unsigned long lineNumber; - unsigned long columnNumber; + ap_uint32 lineNumber; + ap_uint32 columnNumber; } POSITION; typedef struct { diff -Naur apache_1.3.12/src/lib/expat-lite/xmltok_impl.c-orig apache_1.3.12/src/lib/expat-lite/xmltok_impl.c --- apache_1.3.12/src/lib/expat-lite/xmltok_impl.c-orig Wed Jun 9 03:50:08 1999 +++ apache_1.3.12/src/lib/expat-lite/xmltok_impl.c Wed Feb 9 17:34:31 2000 @@ -28,6 +28,13 @@ your version of this file under either the MPL or the GPL. */ +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +/* disable warnings about unused formal parameters */ +#pragma set woff 1174 +/* disable warnings about constant controlling expressions */ +#pragma set woff 1209 +#endif + #ifndef IS_INVALID_CHAR #define IS_INVALID_CHAR(enc, ptr, n) (0) #endif @@ -1682,7 +1689,7 @@ ptr += MINBPC(enc); break; default: - return ptr - start; + return (int) (ptr - start); } } } @@ -1718,7 +1725,7 @@ LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) #undef LEAD_CASE case BT_LF: - pos->columnNumber = (unsigned)-1; + pos->columnNumber = (ap_uint32)-1; pos->lineNumber++; ptr += MINBPC(enc); break; @@ -1727,7 +1734,7 @@ ptr += MINBPC(enc); if (ptr != end && BYTE_TYPE(enc, ptr) == BT_LF) ptr += MINBPC(enc); - pos->columnNumber = (unsigned)-1; + pos->columnNumber = (ap_uint32)-1; break; default: ptr += MINBPC(enc); diff -Naur apache_1.3.12/src/main/Makefile.tmpl-orig apache_1.3.12/src/main/Makefile.tmpl --- apache_1.3.12/src/main/Makefile.tmpl-orig Tue Jan 12 07:47:00 1999 +++ apache_1.3.12/src/main/Makefile.tmpl Wed Feb 9 17:34:31 2000 @@ -11,7 +11,7 @@ http_config.o http_core.o http_log.o \ http_main.o http_protocol.o http_request.o http_vhost.o \ util.o util_date.o util_script.o util_uri.o util_md5.o \ - rfc1413.o + rfc1413.o qsc.o .c.o: $(CC) -c $(INCLUDES) $(CFLAGS) $< @@ -58,31 +58,35 @@ $(OBJS): Makefile # DO NOT REMOVE -alloc.o: alloc.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ - $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ +alloc.o: alloc.c $(INCDIR)/httpd.h $(INCDIR)/ap_types.h \ + $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ + $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(OSDIR)/os-inline.c \ $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/alloc.h \ $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ $(INCDIR)/multithread.h $(INCDIR)/http_log.h -buff.o: buff.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ - $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ +buff.o: buff.c $(INCDIR)/httpd.h $(INCDIR)/ap_types.h \ + $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ + $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(OSDIR)/os-inline.c \ $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/alloc.h \ $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ $(INCDIR)/http_main.h $(INCDIR)/http_log.h gen_test_char.o: gen_test_char.c $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(INCDIR)/ap_ctype.h \ - $(INCDIR)/hsregex.h $(INCDIR)/alloc.h $(INCDIR)/buff.h \ - $(INCDIR)/ap.h $(INCDIR)/util_uri.h + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ + $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(OSDIR)/os-inline.c \ + $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/alloc.h \ + $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h gen_uri_delims.o: gen_uri_delims.c -http_config.o: http_config.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ - $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ +http_config.o: http_config.c $(INCDIR)/httpd.h $(INCDIR)/ap_types.h \ + $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ + $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(OSDIR)/os-inline.c \ $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/alloc.h \ $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ $(INCDIR)/http_config.h $(INCDIR)/http_core.h $(INCDIR)/http_log.h \ $(INCDIR)/http_request.h $(INCDIR)/http_conf_globals.h \ $(INCDIR)/http_vhost.h $(INCDIR)/explain.h -http_core.o: http_core.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ - $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ +http_core.o: http_core.c $(INCDIR)/httpd.h $(INCDIR)/ap_types.h \ + $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ + $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(OSDIR)/os-inline.c \ $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/alloc.h \ $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ $(INCDIR)/http_config.h $(INCDIR)/http_core.h \ @@ -91,14 +95,16 @@ $(INCDIR)/http_main.h $(INCDIR)/http_log.h $(INCDIR)/rfc1413.h \ $(INCDIR)/util_md5.h $(INCDIR)/ap_md5.h $(INCDIR)/scoreboard.h \ $(INCDIR)/fnmatch.h -http_log.o: http_log.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ - $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ +http_log.o: http_log.c $(INCDIR)/httpd.h $(INCDIR)/ap_types.h \ + $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ + $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(OSDIR)/os-inline.c \ $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/alloc.h \ $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ - $(INCDIR)/http_config.h $(INCDIR)/http_core.h $(INCDIR)/http_log.h \ - $(INCDIR)/http_main.h -http_main.o: http_main.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ - $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ + $(INCDIR)/http_conf_globals.h $(INCDIR)/http_config.h \ + $(INCDIR)/http_core.h $(INCDIR)/http_log.h $(INCDIR)/http_main.h +http_main.o: http_main.c $(INCDIR)/httpd.h $(INCDIR)/ap_types.h \ + $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ + $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(OSDIR)/os-inline.c \ $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/alloc.h \ $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ $(INCDIR)/http_main.h $(INCDIR)/http_log.h $(INCDIR)/http_config.h \ @@ -105,52 +111,68 @@ $(INCDIR)/http_protocol.h $(INCDIR)/http_request.h \ $(INCDIR)/http_conf_globals.h $(INCDIR)/http_core.h \ $(INCDIR)/http_vhost.h $(INCDIR)/util_script.h \ - $(INCDIR)/scoreboard.h $(INCDIR)/multithread.h $(INCDIR)/explain.h + $(INCDIR)/scoreboard.h $(INCDIR)/multithread.h $(INCDIR)/explain.h \ + ../lib/expat-lite/xmlparse.h http_protocol.o: http_protocol.c $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(INCDIR)/ap_ctype.h \ - $(INCDIR)/hsregex.h $(INCDIR)/alloc.h $(INCDIR)/buff.h \ - $(INCDIR)/ap.h $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_core.h $(INCDIR)/http_protocol.h \ - $(INCDIR)/http_main.h $(INCDIR)/http_request.h \ - $(INCDIR)/http_vhost.h $(INCDIR)/http_log.h $(INCDIR)/util_date.h \ + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ + $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(OSDIR)/os-inline.c \ + $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/alloc.h \ + $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_core.h \ + $(INCDIR)/http_protocol.h $(INCDIR)/http_main.h \ + $(INCDIR)/http_request.h $(INCDIR)/http_vhost.h \ + $(INCDIR)/http_log.h $(INCDIR)/util_date.h \ $(INCDIR)/http_conf_globals.h http_request.o: http_request.c $(INCDIR)/httpd.h \ + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ + $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(OSDIR)/os-inline.c \ + $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/alloc.h \ + $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_request.h \ + $(INCDIR)/http_core.h $(INCDIR)/http_protocol.h \ + $(INCDIR)/http_conf_globals.h $(INCDIR)/http_log.h \ + $(INCDIR)/http_main.h $(INCDIR)/scoreboard.h $(INCDIR)/fnmatch.h +http_vhost.o: http_vhost.c $(INCDIR)/httpd.h $(INCDIR)/ap_types.h \ $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(INCDIR)/ap_ctype.h \ - $(INCDIR)/hsregex.h $(INCDIR)/alloc.h $(INCDIR)/buff.h \ - $(INCDIR)/ap.h $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_request.h $(INCDIR)/http_core.h \ - $(INCDIR)/http_protocol.h $(INCDIR)/http_conf_globals.h \ - $(INCDIR)/http_log.h $(INCDIR)/http_main.h $(INCDIR)/scoreboard.h \ - $(INCDIR)/fnmatch.h -http_vhost.o: http_vhost.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ - $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ + $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(OSDIR)/os-inline.c \ $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/alloc.h \ $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ $(INCDIR)/http_config.h $(INCDIR)/http_conf_globals.h \ $(INCDIR)/http_log.h $(INCDIR)/http_vhost.h \ $(INCDIR)/http_protocol.h -rfc1413.o: rfc1413.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ - $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ +qsc.o: qsc.c $(INCDIR)/httpd.h $(INCDIR)/ap_types.h \ + $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ + $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(OSDIR)/os-inline.c \ + $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/alloc.h \ + $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_log.h $(INCDIR)/http_config.h \ + $(INCDIR)/http_conf_globals.h $(INCDIR)/http_protocol.h \ + $(INCDIR)/http_main.h $(INCDIR)/scoreboard.h +rfc1413.o: rfc1413.c $(INCDIR)/httpd.h $(INCDIR)/ap_types.h \ + $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ + $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(OSDIR)/os-inline.c \ $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/alloc.h \ $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ $(INCDIR)/http_log.h $(INCDIR)/rfc1413.h $(INCDIR)/http_main.h -util.o: util.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ - $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ +util.o: util.c $(INCDIR)/httpd.h $(INCDIR)/ap_types.h \ + $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ + $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(OSDIR)/os-inline.c \ $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/alloc.h \ $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ - $(INCDIR)/http_conf_globals.h $(INCDIR)/http_log.h test_char.h + $(INCDIR)/http_conf_globals.h $(INCDIR)/http_log.h test_char.h \ + $(INCDIR)/scoreboard.h util_date.o: util_date.c $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(INCDIR)/ap_ctype.h \ - $(INCDIR)/hsregex.h $(INCDIR)/util_date.h -util_md5.o: util_md5.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ - $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ + $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(OSDIR)/os-inline.c \ + $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/util_date.h +util_md5.o: util_md5.c $(INCDIR)/httpd.h $(INCDIR)/ap_types.h \ + $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ + $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(OSDIR)/os-inline.c \ $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/alloc.h \ $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ $(INCDIR)/util_md5.h $(INCDIR)/ap_md5.h -util_script.o: util_script.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ - $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ +util_script.o: util_script.c $(INCDIR)/httpd.h $(INCDIR)/ap_types.h \ + $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ + $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(OSDIR)/os-inline.c \ $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/alloc.h \ $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ $(INCDIR)/http_config.h $(INCDIR)/http_conf_globals.h \ @@ -158,8 +180,9 @@ $(INCDIR)/http_protocol.h $(INCDIR)/http_core.h \ $(INCDIR)/http_request.h $(INCDIR)/util_script.h \ $(INCDIR)/util_date.h -util_uri.o: util_uri.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ - $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ +util_uri.o: util_uri.c $(INCDIR)/httpd.h $(INCDIR)/ap_types.h \ + $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ + $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(OSDIR)/os-inline.c \ $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/alloc.h \ $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ $(INCDIR)/http_log.h $(INCDIR)/http_conf_globals.h uri_delims.h diff -Naur apache_1.3.12/src/main/alloc.c-orig apache_1.3.12/src/main/alloc.c --- apache_1.3.12/src/main/alloc.c-orig Thu Oct 21 13:44:28 1999 +++ apache_1.3.12/src/main/alloc.c Wed Feb 9 17:34:31 2000 @@ -173,13 +173,15 @@ }; static union block_hdr *block_freelist = NULL; +#ifdef MULTITHREAD static mutex *alloc_mutex = NULL; static mutex *spawn_mutex = NULL; +#endif #ifdef POOL_DEBUG static char *known_stack_point; static int stack_direction; static union block_hdr *global_block_list; -#define FREE_POOL ((struct pool *)(-1)) +#define FREE_POOL ((struct pool *) (ap_ptr) -1) #endif #ifdef ALLOC_STATS static unsigned long long num_free_blocks_calls; @@ -215,7 +217,7 @@ /* Get a completely new block from the system pool. Note that we rely on malloc() to provide aligned memory. */ -static union block_hdr *malloc_block(int size) +static union block_hdr *malloc_block(size_t size) { union block_hdr *blok; @@ -349,7 +351,7 @@ * if necessary. Must be called with alarms blocked. */ -static union block_hdr *new_block(int min_size) +static union block_hdr *new_block(size_t min_size) { union block_hdr **lastptr = &block_freelist; union block_hdr *blok = block_freelist; @@ -382,9 +384,9 @@ /* Accounting */ -static long bytes_in_block_list(union block_hdr *blok) +static ap_int32 bytes_in_block_list(union block_hdr *blok) { - long size = 0; + ap_int32 size = 0; while (blok) { size += blok->h.endp - (char *) (blok + 1); @@ -509,8 +511,10 @@ known_stack_point = &s; stack_var_init(&s); #endif +#ifdef MULTITHREAD alloc_mutex = ap_create_mutex(NULL); spawn_mutex = ap_create_mutex(NULL); +#endif permanent_pool = ap_make_sub_pool(NULL); #ifdef ALLOC_STATS atexit(dump_stats); @@ -575,11 +579,11 @@ ap_unblock_alarms(); } -API_EXPORT(long) ap_bytes_in_pool(pool *p) +API_EXPORT(ap_int32) ap_bytes_in_pool(pool *p) { return bytes_in_block_list(p->first); } -API_EXPORT(long) ap_bytes_in_free_blocks(void) +API_EXPORT(ap_int32) ap_bytes_in_free_blocks(void) { return bytes_in_block_list(block_freelist); } @@ -596,9 +600,9 @@ /* is ptr in the range [lo,hi) */ #define is_ptr_in_range(ptr, lo, hi) \ - (((unsigned long)(ptr) - (unsigned long)(lo)) \ + (((ap_ptr)(ptr) - (ap_ptr)(lo)) \ < \ - (unsigned long)(hi) - (unsigned long)(lo)) + (ap_ptr)(hi) - (ap_ptr)(lo)) /* Find the pool that ts belongs to, return NULL if it doesn't * belong to any pool. @@ -700,10 +704,10 @@ */ -API_EXPORT(void *) ap_palloc(struct pool *a, int reqsize) +API_EXPORT(void *) ap_palloc(struct pool *a, size_t reqsize) { #ifdef ALLOC_USE_MALLOC - int size = reqsize + CLICK_SZ; + size_t size = reqsize + CLICK_SZ; void *ptr; ap_block_alarms(); @@ -722,8 +726,8 @@ /* Round up requested size to an even number of alignment units (core clicks) */ - int nclicks = 1 + ((reqsize - 1) / CLICK_SZ); - int size = nclicks * CLICK_SZ; + size_t nclicks = 1 + ((reqsize - 1) / CLICK_SZ); + size_t size = nclicks * CLICK_SZ; /* First, see if we have space in the block most recently * allocated to this pool @@ -733,8 +737,12 @@ char *first_avail = blok->h.first_avail; char *new_first_avail; - if (reqsize <= 0) + if (reqsize <= 0) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif return NULL; + } new_first_avail = first_avail + size; @@ -769,7 +777,7 @@ #endif } -API_EXPORT(void *) ap_pcalloc(struct pool *a, int size) +API_EXPORT(void *) ap_pcalloc(struct pool *a, size_t size) { void *res = ap_palloc(a, size); memset(res, '\0', size); @@ -789,7 +797,7 @@ return res; } -API_EXPORT(char *) ap_pstrndup(struct pool *a, const char *s, int n) +API_EXPORT(char *) ap_pstrndup(struct pool *a, const char *s, size_t n) { char *res; @@ -882,12 +890,12 @@ #else union block_hdr *blok; union block_hdr *nblok; - size_t cur_len; + int cur_len; char *strp; blok = ps->blok; strp = ps->vbuff.curpos; - cur_len = strp - blok->h.first_avail; + cur_len = (int) (strp - blok->h.first_avail); /* must try another blok */ (void) ap_acquire_mutex(alloc_mutex); @@ -916,6 +924,7 @@ #endif } +/*PRINTFLIKE2*/ API_EXPORT(char *) ap_pvsprintf(pool *p, const char *fmt, va_list ap) { #ifdef ALLOC_USE_MALLOC @@ -947,7 +956,7 @@ #else struct psprintf_data ps; char *strp; - int size; + size_t size; ap_block_alarms(); ps.blok = p->last; @@ -979,6 +988,7 @@ #endif } +/*PRINTFLIKE2*/ API_EXPORT_NONSTD(char *) ap_psprintf(pool *p, const char *fmt, ...) { va_list ap; @@ -1021,6 +1031,9 @@ API_EXPORT(void *) ap_push_array(array_header *arr) { if (arr->nelts == arr->nalloc) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif int new_size = (arr->nalloc <= 0) ? 1 : arr->nalloc * 2; char *new_data; @@ -1140,7 +1153,7 @@ for (i = 0, strpp = (char **) arr->elts; ; ++strpp) { if (strpp && *strpp != NULL) { - len = strlen(*strpp); + len = ap_strlen(*strpp); memcpy(cp, *strpp, len); cp += len; } @@ -1610,15 +1623,15 @@ else { char *strp; char *value; - size_t len; + int len; /* Have to merge some headers. Let's re-use the order field, * since it's handy... we'll store the length of val there. */ - left->order = strlen(left->val); + left->order = ap_strlen(left->val); len = left->order; do { - right->order = strlen(right->val); + right->order = ap_strlen(right->val); len += 2 + right->order; ++right; } while (right < last @@ -1743,6 +1756,7 @@ #endif /* ndef WIN32 */ } +/*ARGSUSED0*/ API_EXPORT_NONSTD(void) ap_null_cleanup(void *data) { /* do nothing cleanup routine */ @@ -1756,20 +1770,20 @@ static void fd_cleanup(void *fdv) { - close((int) (long) fdv); + close((int) (ap_ptr) fdv); } API_EXPORT(void) ap_note_cleanups_for_fd(pool *p, int fd) { - ap_register_cleanup(p, (void *) (long) fd, fd_cleanup, fd_cleanup); + ap_register_cleanup(p, (void *) (ap_ptr) fd, fd_cleanup, fd_cleanup); } API_EXPORT(void) ap_kill_cleanups_for_fd(pool *p, int fd) { - ap_kill_cleanup(p, (void *) (long) fd, fd_cleanup); + ap_kill_cleanup(p, (void *) (ap_ptr) fd, fd_cleanup); } -API_EXPORT(int) ap_popenf(pool *a, const char *name, int flg, int mode) +API_EXPORT(int) ap_popenf(pool *a, const char *name, int flg, mode_t mode) { int fd; int save_errno; @@ -1794,7 +1808,7 @@ ap_block_alarms(); res = close(fd); save_errno = errno; - ap_kill_cleanup(a, (void *) (long) fd, fd_cleanup); + ap_kill_cleanup(a, (void *) (ap_ptr) fd, fd_cleanup); ap_unblock_alarms(); errno = save_errno; return res; @@ -1955,17 +1969,17 @@ static void socket_cleanup(void *fdv) { - closesocket((int) (long) fdv); + closesocket((int) (ap_ptr) fdv); } API_EXPORT(void) ap_note_cleanups_for_socket(pool *p, int fd) { - ap_register_cleanup(p, (void *) (long) fd, socket_cleanup, socket_cleanup); + ap_register_cleanup(p, (void *) (ap_ptr) fd, socket_cleanup, socket_cleanup); } API_EXPORT(void) ap_kill_cleanups_for_socket(pool *p, int sock) { - ap_kill_cleanup(p, (void *) (long) sock, socket_cleanup); + ap_kill_cleanup(p, (void *) (ap_ptr) sock, socket_cleanup); } API_EXPORT(int) ap_psocket(pool *p, int domain, int type, int protocol) @@ -1996,7 +2010,7 @@ errno = WSAGetLastError(); #endif /* WIN32 */ save_errno = errno; - ap_kill_cleanup(a, (void *) (long) sock, socket_cleanup); + ap_kill_cleanup(a, (void *) (ap_ptr) sock, socket_cleanup); ap_unblock_alarms(); errno = save_errno; return res; diff -Naur apache_1.3.12/src/main/buff.c-orig apache_1.3.12/src/main/buff.c --- apache_1.3.12/src/main/buff.c-orig Tue Jan 11 07:51:32 2000 +++ apache_1.3.12/src/main/buff.c Wed Feb 9 17:34:31 2000 @@ -63,10 +63,6 @@ #include #include #include -#ifndef NO_WRITEV -#include -#include -#endif #ifdef HAVE_BSTRING_H #include /* for IRIX, FD_SET calls bzero() */ @@ -257,7 +253,21 @@ } else #endif - rv = read(fb->fd_in, buf, nbyte); + rv = (int) read(fb->fd_in, buf, nbyte); + +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +/* + * Try to prefetch the first cache line of the read data ASAP so it's + * ready in the primary cache when the (ultimate) caller touches it. + * The cache line is prefetched for writing because the read data is + * often modified, and in this multi-process server there is going to be + * little to no penalty for owning the cache line exclusively + * unnecessarily (unlike on a highly-contended cache line in a + * multi-threaded server). + */ +# pragma prefetch_manual = 1 +# pragma prefetch_ref = ((char *) buf)[0], kind = wr +#endif return rv; } @@ -329,7 +339,7 @@ rv = send(fb->fd, buf, nbyte, 0); else #endif - rv = write(fb->fd, buf, nbyte); + rv = (int) write(fb->fd, buf, nbyte); #endif return rv; @@ -404,7 +414,7 @@ fb->outcnt = 0; fb->outchunk = -1; fb->error = NULL; - fb->bytes_sent = 0L; + fb->bytes_sent = 0; fb->fd = -1; fb->fd_in = -1; @@ -446,7 +456,7 @@ API_EXPORT(int) ap_bsetopt(BUFF *fb, int optname, const void *optval) { if (optname == BO_BYTECT) { - fb->bytes_sent = *(const long int *) optval - (long int) fb->outcnt;; + fb->bytes_sent = *(const ap_int32 *) optval - (ap_int32) fb->outcnt; return 0; } else { @@ -458,10 +468,10 @@ API_EXPORT(int) ap_bgetopt(BUFF *fb, int optname, void *optval) { if (optname == BO_BYTECT) { - long int bs = fb->bytes_sent + fb->outcnt; - if (bs < 0L) - bs = 0L; - *(long int *) optval = bs; + ap_int32 bs = fb->bytes_sent + fb->outcnt; + if (bs < (ap_int32) 0) + bs = 0; + *(ap_int32 *) optval = bs; return 0; } else { @@ -1059,43 +1069,93 @@ */ static int writev_it_all(BUFF *fb, struct iovec *vec, int nvec) { - int i, rv; + return (ap_bwritev(fb, vec, nvec) >= 0) ? 0 : -1; +} +#endif - /* while it's nice an easy to build the vector and crud, it's painful - * to deal with a partial writev() - */ - i = 0; - while (i < nvec) { - do - rv = writev(fb->fd, &vec[i], nvec - i); - while (rv == -1 && (errno == EINTR || errno == EAGAIN) - && !(fb->flags & B_EOUT)); - if (rv == -1) { - if (errno != EINTR && errno != EAGAIN) { +/* + * Write data using writev() if available, write() otherwise. + * Returns number of bytes written or -1 on error. + * Note that it may modify iov; + */ +API_EXPORT(int) +ap_bwritev(BUFF *fb, struct iovec *iov, int iovcnt) +{ + int rval; + + if ((fb->flags & (B_EOUT | B_WRERR | B_WR)) == B_WR) { +#ifndef NO_WRITEV + int i, len; + + rval = 0; + + len = 0; + for (i = 0; i < iovcnt; i++) + len += iov[i].iov_len; + + while (len > 0) { + int w; + + w = (iovcnt > 1) ? (int) writev(fb->fd, iov, iovcnt) : + (int) write(fb->fd, iov->iov_base, iov->iov_len); + if (w >= 0) { + rval += w; + fb->bytes_sent += w; + + len -= w; + if (len == 0) + break; /* shortcut the common case */ + + while (w > iov[0].iov_len) { + w -= iov[0].iov_len; + iov++; + iovcnt--; + } + iov[0].iov_base = (char *) iov[0].iov_base + w; + iov[0].iov_len -= w; + } else if (errno != EINTR && errno != EAGAIN) { doerror(fb, B_WR); + rval = -1; + break; } - return -1; - } - fb->bytes_sent += rv; - /* recalculate vec to deal with partial writes */ - while (rv > 0) { - if (rv < vec[i].iov_len) { - vec[i].iov_base = (char *) vec[i].iov_base + rv; - vec[i].iov_len -= rv; - rv = 0; + + if (fb->flags & B_EOUT) { /* set asynchronously */ + rval = -1; + break; } - else { - rv -= vec[i].iov_len; - ++i; + } +#else + int i; + + rval = 0; + for (i = 0; i < iovcnt; i++) { + while (iov[i].iov_len > 0) { + int w; + + w = write(fb->fd, iov[i].iov_base, iov[i].iov_len); + if (w >= 0) { + rval += w; + fb->bytes_sent += w; + iov[i].iov_base = (char *) iov[i].iov_base + w; + iov[i].iov_len -= w; + } else if (errno != EINTR && errno != EAGAIN) { + doerror(fb, B_WR); + rval = -1; + break; + } + + if (fb->flags & B_EOUT) { /* set asynchronously */ + rval = -1; + break; + } } } - if (fb->flags & B_EOUT) - return -1; - } - /* if we got here, we wrote it all */ - return 0; -} #endif + } else + rval = -1; + + return rval; +} /* A wrapper for buff_write which deals with error conditions and * bytes_sent. Also handles non-blocking writes. @@ -1513,7 +1573,7 @@ */ API_EXPORT(int) ap_bputs(const char *x, BUFF *fb) { - int i, j = strlen(x); + int i, j = ap_strlen(x); i = ap_bwrite(fb, x, j); if (i != j) return -1; @@ -1535,7 +1595,7 @@ x = va_arg(v, const char *); if (x == NULL) break; - j = strlen(x); + j = ap_strlen(x); i = ap_bwrite(fb, x, j); if (i != j) { va_end(v); @@ -1584,6 +1644,7 @@ return 0; } +/*PRINTFLIKE2*/ API_EXPORT_NONSTD(int) ap_bprintf(BUFF *fb, const char *fmt, ...) { va_list ap; @@ -1612,6 +1673,7 @@ return res; } +/*PRINTFLIKE2*/ API_EXPORT(int) ap_vbprintf(BUFF *fb, const char *fmt, va_list ap) { struct bprintf_data b; diff -Naur apache_1.3.12/src/main/http_config.c-orig apache_1.3.12/src/main/http_config.c --- apache_1.3.12/src/main/http_config.c-orig Sat Jan 15 08:40:42 2000 +++ apache_1.3.12/src/main/http_config.c Wed Feb 9 17:34:31 2000 @@ -679,7 +679,7 @@ *m = NULL; } -void ap_setup_prelinked_modules() +void ap_setup_prelinked_modules(void) { module **m; module **m2; @@ -747,7 +747,7 @@ } /* Clear the internal list of modules, in preparation for starting over. */ -API_EXPORT(void) ap_clear_module_list() +API_EXPORT(void) ap_clear_module_list(void) { module **m = &top_module; module **next_m; @@ -1037,7 +1037,7 @@ { /* This one's pretty generic... */ - int offset = (int) (long) cmd->info; + int offset = (int) (ap_ptr) cmd->info; *(char **) (struct_ptr + offset) = arg; return NULL; } @@ -1047,7 +1047,7 @@ { /* This one's pretty generic... */ - int offset = (int) (long) cmd->info; + int offset = (int) (ap_ptr) cmd->info; ap_str_tolower(arg); *(char **) (struct_ptr + offset) = arg; return NULL; @@ -1058,7 +1058,7 @@ { /* This one's pretty generic too... */ - int offset = (int) (long) cmd->info; + int offset = (int) (ap_ptr) cmd->info; *(int *) (struct_ptr + offset) = arg ? 1 : 0; return NULL; } @@ -1069,7 +1069,7 @@ This allows .htaccess to be independent of server_root, so the server can be moved or mirrored with less pain. */ char *p; - int offset = (int) (long) cmd->info; + int offset = (int) (ap_ptr) cmd->info; if (ap_os_is_path_absolute(arg)) p = arg; else @@ -1408,6 +1408,12 @@ ap_listeners = NULL; ap_listenbacklog = DEFAULT_LISTENBACKLOG; ap_extended_status = 0; +#ifdef USE_QSC + ap_qsc_enabled = 0; +#endif +#ifdef SINGLE_LISTEN_UNSERIALIZED_ACCEPT + ap_single_listen = 0; +#endif /* Global virtual host hash bucket pointers. Init to null. */ ap_init_vhost_config(p); @@ -1463,6 +1469,10 @@ new->local_addr.sin_port = htons(s->port ? s->port : DEFAULT_HTTP_PORT); new->fd = -1; new->used = 0; + new->unique = new->local_addr.sin_addr.s_addr != htonl(INADDR_ANY); +#ifdef SINGLE_LISTEN_UNSERIALIZED_ACCEPT + new->cpu = -1; +#endif new->next = NULL; ap_listeners = new; } @@ -1616,7 +1626,7 @@ * the directive arguments, in what module they are handled, and in * what parts of the configuration they are allowed. Used for httpd -h. */ -void ap_show_directives() +void ap_show_directives(void) { const command_rec *pc; int n; @@ -1631,7 +1641,7 @@ } /* Show the preloaded module names. Used for httpd -l. */ -void ap_show_modules() +void ap_show_modules(void) { int n; diff -Naur apache_1.3.12/src/main/http_core.c-orig apache_1.3.12/src/main/http_core.c --- apache_1.3.12/src/main/http_core.c-orig Fri Feb 18 12:41:47 2000 +++ apache_1.3.12/src/main/http_core.c Thu Mar 2 10:04:08 2000 @@ -94,6 +94,13 @@ #define MMAP_LIMIT (4*1024*1024) #endif +#ifdef USE_DIRECT_IO +/* Files must be at least this big to have direct I/O used on them. */ +#ifndef DIRECT_THRESHOLD +#define DIRECT_THRESHOLD ((size_t) 64 * 1024 * 1024) /* arbitrary default */ +#endif +#endif + /* Server core module... This module provides support for really basic * server operations, including options and commands which control the * operation of other modules. Consider this the bureaucracy module. @@ -758,7 +765,7 @@ return ap_psprintf(p, "%s://%s:%u%s", ap_http_method(r), host, port, uri); } -API_EXPORT(unsigned long) ap_get_limit_req_body(const request_rec *r) +API_EXPORT(ap_uint32) ap_get_limit_req_body(const request_rec *r) { core_dir_config *d = (core_dir_config *)ap_get_module_config(r->per_dir_config, &core_module); @@ -1014,6 +1021,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *set_access_name(cmd_parms *cmd, void *dummy, char *arg) { void *sconf = cmd->server->module_config; @@ -1067,6 +1075,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *set_document_root(cmd_parms *cmd, void *dummy, char *arg) { void *sconf = cmd->server->module_config; @@ -1285,6 +1294,7 @@ return NULL; } +/*ARGSUSED0*/ static const char *satisfy(cmd_parms *cmd, core_dir_config *c, char *arg) { if (!strcasecmp(arg, "all")) { @@ -1312,6 +1322,7 @@ return NULL; } +/*ARGSUSED1*/ CORE_EXPORT_NONSTD(const char *) ap_limit_section(cmd_parms *cmd, void *dummy, const char *arg) { @@ -1352,6 +1363,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *endlimit_section(cmd_parms *cmd, void *dummy, void *dummy2) { void *tog = cmd->cmd->cmd_data; @@ -1388,6 +1400,7 @@ #define USE_ICASE 0 #endif +/*ARGSUSED1*/ static const char *end_nested_section(cmd_parms *cmd, void *dummy) { if (cmd->end_token == NULL) { @@ -1416,6 +1429,7 @@ "> directive missing closing '>'", NULL); } +/*ARGSUSED1*/ static const char *dirsection(cmd_parms *cmd, void *dummy, const char *arg) { const char *errmsg; @@ -1484,6 +1498,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *urlsection(cmd_parms *cmd, void *dummy, const char *arg) { const char *errmsg; @@ -1632,11 +1647,13 @@ * Extra (redundant, unpaired) directives are * simply silently ignored. */ +/*ARGSUSED0*/ static const char *end_ifmod(cmd_parms *cmd, void *dummy) { return NULL; } +/*ARGSUSED1*/ static const char *start_ifmod(cmd_parms *cmd, void *dummy, char *arg) { char *endp = strrchr(arg, '>'); @@ -1691,11 +1708,13 @@ return 0; } +/*ARGSUSED0*/ static const char *end_ifdefine(cmd_parms *cmd, void *dummy) { return NULL; } +/*ARGSUSED1*/ static const char *start_ifdefine(cmd_parms *cmd, void *dummy, char *arg) { char *endp; @@ -1739,6 +1758,7 @@ /* httpd.conf commands... beginning with the business */ +/*ARGSUSED1*/ static const char *virtualhost_section(cmd_parms *cmd, void *dummy, char *arg) { server_rec *main_server = cmd->server, *s; @@ -1802,6 +1822,7 @@ return errmsg; } +/*ARGSUSED1*/ static const char *set_server_alias(cmd_parms *cmd, void *dummy, const char *arg) { @@ -1821,6 +1842,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *add_module_command(cmd_parms *cmd, void *dummy, char *arg) { const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); @@ -1835,6 +1857,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *clear_module_list_command(cmd_parms *cmd, void *dummy) { const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); @@ -1846,12 +1869,13 @@ return NULL; } +/*ARGSUSED1*/ static const char *set_server_string_slot(cmd_parms *cmd, void *dummy, char *arg) { /* This one's pretty generic... */ - int offset = (int)(long)cmd->info; + int offset = (int) (ap_ptr) cmd->info; char *struct_ptr = (char *)cmd->server; const char *err = ap_check_cmd_context(cmd, @@ -1864,6 +1888,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *server_type(cmd_parms *cmd, void *dummy, char *arg) { const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); @@ -1884,6 +1909,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *server_port(cmd_parms *cmd, void *dummy, char *arg) { const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT); @@ -1925,6 +1951,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *set_send_buffer_size(cmd_parms *cmd, void *dummy, char *arg) { int s = atoi(arg); @@ -1940,6 +1967,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *set_user(cmd_parms *cmd, void *dummy, char *arg) { #ifdef WIN32 @@ -1987,6 +2015,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *set_group(cmd_parms *cmd, void *dummy, char *arg) { const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT); @@ -2012,6 +2041,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *set_server_root(cmd_parms *cmd, void *dummy, char *arg) { const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); @@ -2030,6 +2060,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *set_timeout(cmd_parms *cmd, void *dummy, char *arg) { const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT); @@ -2041,6 +2072,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *set_keep_alive_timeout(cmd_parms *cmd, void *dummy, char *arg) { @@ -2053,6 +2085,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *set_keep_alive(cmd_parms *cmd, void *dummy, char *arg) { const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT); @@ -2072,6 +2105,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *set_keep_alive_max(cmd_parms *cmd, void *dummy, char *arg) { const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT); @@ -2083,6 +2117,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *set_pidfile(cmd_parms *cmd, void *dummy, char *arg) { const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); @@ -2097,6 +2132,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *set_scoreboard(cmd_parms *cmd, void *dummy, char *arg) { const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); @@ -2108,6 +2144,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *set_lockfile(cmd_parms *cmd, void *dummy, char *arg) { const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); @@ -2153,6 +2190,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *set_serverpath(cmd_parms *cmd, void *dummy, char *arg) { const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT); @@ -2161,7 +2199,7 @@ } cmd->server->path = arg; - cmd->server->pathlen = strlen(arg); + cmd->server->pathlen = ap_strlen(arg); return NULL; } @@ -2199,6 +2237,7 @@ return NULL; } +/*ARGSUSED*/ static const char *set_daemons_to_start(cmd_parms *cmd, void *dummy, char *arg) { #ifdef WIN32 @@ -2216,6 +2255,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *set_min_free_servers(cmd_parms *cmd, void *dummy, char *arg) { const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); @@ -2234,6 +2274,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *set_max_free_servers(cmd_parms *cmd, void *dummy, char *arg) { const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); @@ -2245,6 +2286,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *set_server_limit (cmd_parms *cmd, void *dummy, char *arg) { const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); @@ -2268,6 +2310,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *set_max_requests(cmd_parms *cmd, void *dummy, char *arg) { const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); @@ -2279,6 +2322,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *set_threads(cmd_parms *cmd, void *dummy, char *arg) { const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); if (err != NULL) { @@ -2302,6 +2346,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *set_excess_requests(cmd_parms *cmd, void *dummy, char *arg) { const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); @@ -2371,6 +2416,7 @@ #endif #if !defined (RLIMIT_CPU) || !(defined (RLIMIT_DATA) || defined (RLIMIT_VMEM) || defined(RLIMIT_AS)) || !defined (RLIMIT_NPROC) +/*ARGSUSED1*/ static const char *no_set_limit(cmd_parms *cmd, core_dir_config *conf, char *arg, char *arg2) { @@ -2413,6 +2459,7 @@ } #endif +/*ARGSUSED1*/ static const char *set_bind_address(cmd_parms *cmd, void *dummy, char *arg) { const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); @@ -2437,11 +2484,14 @@ } #endif -static const char *set_listener(cmd_parms *cmd, void *dummy, char *ips) +/*ARGSUSED1*/ +static const char *set_listener(cmd_parms *cmd, void *dummy, char *ips, + char *cpustr) { listen_rec *new; char *ports; unsigned short port; + int cpu; const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); if (err != NULL) { @@ -2462,6 +2512,14 @@ ports = ips; } + cpu = -1; + if (cpustr) { + if (ap_isdigit(*cpustr)) + cpu = atoi(cpustr); + if (cpu < 0) + return "Optional CPU id must be positive number"; + } + new=ap_pcalloc(cmd->pool, sizeof(listen_rec)); new->local_addr.sin_family = AF_INET; if (ports == ips) { /* no address */ @@ -2477,11 +2535,16 @@ new->local_addr.sin_port = htons(port); new->fd = -1; new->used = 0; + new->unique = new->local_addr.sin_addr.s_addr != htonl(INADDR_ANY); +#ifdef SINGLE_LISTEN_UNSERIALIZED_ACCEPT + new->cpu = cpu; +#endif new->next = ap_listeners; ap_listeners = new; return NULL; } +/*ARGSUSED1*/ static const char *set_listenbacklog(cmd_parms *cmd, void *dummy, char *arg) { int b; @@ -2499,6 +2562,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *set_coredumpdir (cmd_parms *cmd, void *dummy, char *arg) { struct stat finfo; @@ -2516,6 +2580,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *include_config (cmd_parms *cmd, void *dummy, char *name) { name = ap_server_root_relative(cmd->pool, name); @@ -2525,6 +2590,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *set_loglevel(cmd_parms *cmd, void *dummy, const char *arg) { char *str; @@ -2630,6 +2696,7 @@ * string. */ +/*ARGSUSED1*/ static const char *set_serv_tokens(cmd_parms *cmd, void *dummy, char *arg) { const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); @@ -2649,6 +2716,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *set_limit_req_line(cmd_parms *cmd, void *dummy, char *arg) { const char *err = ap_check_cmd_context(cmd, @@ -2672,6 +2740,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *set_limit_req_fieldsize(cmd_parms *cmd, void *dummy, char *arg) { @@ -2697,6 +2766,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *set_limit_req_fields(cmd_parms *cmd, void *dummy, char *arg) { const char *err = ap_check_cmd_context(cmd, @@ -2728,10 +2798,38 @@ * Instead we have an idiotic define in httpd.h that prevents * it from being used even when it is available. Sheesh. */ - conf->limit_req_body = (unsigned long)strtol(arg, (char **)NULL, 10); + conf->limit_req_body = (ap_uint32)strtol(arg, (char **)NULL, 10); return NULL; } +/*ARGSUSED1*/ +static const char *set_qsc_enabled(cmd_parms *cmd, void *dummy, int arg) +{ + const char *err; + + err = ap_check_cmd_context(cmd, GLOBAL_ONLY); +#ifdef USE_QSC + if (err == NULL) + ap_qsc_enabled = arg != 0; +#endif + + return err; +} + +/*ARGSUSED1*/ +static const char *set_single_listen(cmd_parms *cmd, void *dummy, int arg) +{ + const char *err; + + err = ap_check_cmd_context(cmd, GLOBAL_ONLY); +#ifdef SINGLE_LISTEN_UNSERIALIZED_ACCEPT + if (err == NULL) + ap_single_listen = arg != 0; +#endif + + return err; +} + #ifdef WIN32 static const char *set_interpreter_source(cmd_parms *cmd, core_dir_config *d, char *arg) @@ -2778,10 +2876,10 @@ "authentication directives when accessed using specified HTTP methods" }, { "", endlimit_section, NULL, OR_ALL, NO_ARGS, "Marks end of " }, -{ "", endlimit_section, (void*)1, OR_ALL, NO_ARGS, +{ "", endlimit_section, (void*) (ap_ptr) 1, OR_ALL, NO_ARGS, "Marks end of " }, { "" }, -{ "" }, -{ "" }, -{ "" }, @@ -2934,8 +3032,8 @@ { "ThreadStackSize", set_threadstacksize, NULL, RSRC_CONF, TAKE1, "Stack size each created thread will use."}, #endif -{ "Listen", set_listener, NULL, RSRC_CONF, TAKE1, - "A port number or a numeric IP address and a port number"}, +{ "Listen", set_listener, NULL, RSRC_CONF, TAKE12, + "A port number or a numeric IP address and a port number, and an optional CPU id"}, { "SendBufferSize", set_send_buffer_size, NULL, RSRC_CONF, TAKE1, "Send buffer size in bytes"}, { "AddModule", add_module_command, NULL, RSRC_CONF, ITERATE, @@ -2977,6 +3075,20 @@ (void*)XtOffsetOf(core_dir_config, limit_req_body), OR_ALL, TAKE1, "Limit (in bytes) on maximum size of request message body" }, +{ "QSC", set_qsc_enabled, NULL, RSRC_CONF, FLAG, +#ifdef USE_QSC + "Enable/disable Quick Shortcut Cache" +#else + "Ignored because !USE_QSC" +#endif +}, +{ "SingleListen", set_single_listen, NULL, RSRC_CONF, FLAG, +#ifdef SINGLE_LISTEN_UNSERIALIZED_ACCEPT + "Force each child to serve a single Listen address" +#else + "Ignored because !SINGLE_LISTEN_UNSERIALIZED_ACCEPT" +#endif +}, { NULL } }; @@ -3027,6 +3139,7 @@ return OK; } +/*ARGSUSED0*/ static int do_nothing(request_rec *r) { return OK; } #ifdef USE_MMAP_FILES @@ -3061,8 +3174,11 @@ (core_dir_config *)ap_get_module_config(r->per_dir_config, &core_module); int rangestatus, errstatus; FILE *f; +#ifdef USE_DIRECT_IO + struct dioattr da; +#endif #ifdef USE_MMAP_FILES - caddr_t mm; + caddr_t mm = (caddr_t) (ap_ptr) -1; #endif #ifdef CHARSET_EBCDIC int convert_flag; @@ -3100,6 +3216,12 @@ return METHOD_NOT_ALLOWED; } + if (ap_oversized_file(r->finfo.st_size)) { + ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, r, + "%s: File too large", r->filename); + return HTTP_NOT_IMPLEMENTED; + } + #if defined(OS2) || defined(WIN32) || defined(NETWARE) /* Need binary mode for OS/2 */ f = ap_pfopen(r->pool, r->filename, "rb"); @@ -3118,7 +3240,7 @@ ap_set_etag(r); ap_table_setn(r->headers_out, "Accept-Ranges", "bytes"); if (((errstatus = ap_meets_conditions(r)) != OK) - || (errstatus = ap_set_content_length(r, r->finfo.st_size))) { + || (errstatus = ap_set_content_length(r, (ap_int32) r->finfo.st_size))) { return errstatus; } @@ -3135,6 +3257,30 @@ */ convert_flag = ap_checkconv(r); #endif + +#ifdef USE_DIRECT_IO + /* + * Use direct I/O (system DMAs data directly from disk into properly + * aligned user buffer, bypassing the system's buffer cache) for + * large files to avoid voiding valid buffer cache entries for small + * files. Use direct I/O only when actually sending the body + * (!r->header_only), when no content MD5 digest is requested, and + * when no data ranges are requested. Could handle content digest + * and ranges too but that would further complicate this routine. + */ + da.d_mem = 0; + if (r->finfo.st_size >= DIRECT_THRESHOLD && !r->header_only && + (d->content_md5 & 1) == 0) { + if (fcntl(fileno(f), F_DIOINFO, &da) == 0) { + if (da.d_mem) + goto direct; + } else + ap_log_rerror(APLOG_MARK, APLOG_ERR, r, + "default_handler: fcntl(F_DIOINFO) failed on %s", + r->filename); + } +#endif + #ifdef USE_MMAP_FILES ap_block_alarms(); if ((r->finfo.st_size >= MMAP_THRESHOLD) @@ -3144,16 +3290,13 @@ * file mmapped */ mm = mmap(NULL, r->finfo.st_size, PROT_READ, MAP_PRIVATE, fileno(f), 0); - if (mm == (caddr_t)-1) { + if (mm == (caddr_t) (ap_ptr) -1) { ap_log_rerror(APLOG_MARK, APLOG_CRIT, r, "default_handler: mmap failed: %s", r->filename); } } - else { - mm = (caddr_t)-1; - } - if (mm == (caddr_t)-1) { + if (mm == (caddr_t) (ap_ptr) -1) { ap_unblock_alarms(); #endif @@ -3169,6 +3312,9 @@ } #endif /* CHARSET_EBCDIC */ +#ifdef USE_DIRECT_IO +direct: +#endif rangestatus = ap_set_byterange(r); ap_send_http_header(r); @@ -3175,10 +3321,15 @@ if (!r->header_only) { if (!rangestatus) { +#ifdef USE_DIRECT_IO + if (da.d_mem) + ap_send_fd_direct(f, r, &da); + else +#endif ap_send_fd(f, r); } else { - long offset, length; + ap_int32 offset, length; while (ap_each_byterange(r, &offset, &length)) { /* * Non zero returns are more portable than checking @@ -3187,7 +3338,7 @@ if (fseek(f, offset, SEEK_SET)) { ap_log_error(APLOG_MARK, APLOG_ERR, r->server, "Failed to fseek for byterange (%ld, %ld)", - offset, length); + (long) offset, (long) length); } else { ap_send_fd_length(f, r, length); @@ -3224,7 +3375,7 @@ ap_send_mmap(mm, r, 0, r->finfo.st_size); } else { - long offset, length; + ap_int32 offset, length; while (ap_each_byterange(r, &offset, &length)) { ap_send_mmap(mm, r, offset, length); } diff -Naur apache_1.3.12/src/main/http_log.c-orig apache_1.3.12/src/main/http_log.c --- apache_1.3.12/src/main/http_log.c-orig Wed Feb 2 12:43:49 2000 +++ apache_1.3.12/src/main/http_log.c Wed Mar 1 17:04:27 2000 @@ -155,6 +155,7 @@ {NULL, -1}, }; +/*ARGSUSED1*/ static int error_log_child(void *cmd, child_info *pinfo) { /* Child process code for 'ErrorLog "|..."'; @@ -294,6 +295,7 @@ dup2(fileno(s->error_log), STDERR_FILENO); } +/*PRINTFLIKE6*/ static void log_error_core(const char *file, int line, int level, const server_rec *s, const request_rec *r, const char *fmt, va_list args) @@ -457,6 +459,7 @@ #endif } +/*PRINTFLIKE5*/ API_EXPORT(void) ap_log_error(const char *file, int line, int level, const server_rec *s, const char *fmt, ...) { @@ -467,6 +470,7 @@ va_end(args); } +/*PRINTFLIKE5*/ API_EXPORT(void) ap_log_rerror(const char *file, int line, int level, const request_rec *r, const char *fmt, ...) { @@ -546,6 +550,7 @@ ap_log_error(APLOG_MARK, APLOG_ERR, s, "%s", err); } +/*ARGSUSED0*/ API_EXPORT(void) ap_log_unixerr(const char *routine, const char *file, const char *msg, server_rec *s) { @@ -552,6 +557,7 @@ ap_log_error(file, 0, APLOG_ERR, s, "%s", msg); } +/*PRINTFLIKE2*/ API_EXPORT(void) ap_log_printf(const server_rec *s, const char *fmt, ...) { va_list args; @@ -627,6 +633,7 @@ } +/*ARGSUSED2*/ static void piped_log_maintenance(int reason, void *data, ap_wait_t status) { piped_log *pl = data; diff -Naur apache_1.3.12/src/main/http_main.c-orig apache_1.3.12/src/main/http_main.c --- apache_1.3.12/src/main/http_main.c-orig Sat Feb 5 04:01:52 2000 +++ apache_1.3.12/src/main/http_main.c Fri Mar 3 11:07:58 2000 @@ -104,11 +104,6 @@ #include "scoreboard.h" #include "multithread.h" #include -#ifdef USE_SHMGET_SCOREBOARD -#include -#include -#include -#endif #ifdef SecureWare #include #include @@ -259,6 +254,12 @@ int ap_listenbacklog; int ap_dump_settings = 0; API_VAR_EXPORT int ap_extended_status = 0; +#ifdef USE_QSC +int ap_qsc_enabled; +#endif +#ifdef SINGLE_LISTEN_UNSERIALIZED_ACCEPT +int ap_single_listen; +#endif /* * The max child slot ever assigned, preserved across restarts. Necessary @@ -301,7 +302,7 @@ #ifndef NETWARE static JMP_BUF APACHE_TLS jmpbuffer; #endif -static int sd; +static listen_rec *listener; static fd_set listenfds; static int listenmaxfd; #ifndef NETWARE @@ -381,6 +382,7 @@ * server version string to a known value and [re]enables modifications * (which are disabled by configuration completion). */ +/*ARGSUSED0*/ static void reset_version(void *dummy) { version_locked = 0; @@ -571,7 +573,7 @@ #include -static pthread_mutex_t *accept_mutex = (void *)(caddr_t) -1; +static pthread_mutex_t *accept_mutex = (void *) (ap_ptr) -1; static int have_accept_mutex; static sigset_t accept_block_mask; static sigset_t accept_previous_mask; @@ -578,7 +580,7 @@ static void accept_mutex_child_cleanup(void *foo) { - if (accept_mutex != (void *)(caddr_t)-1 + if (accept_mutex != (void *) (ap_ptr) -1 && have_accept_mutex) { pthread_mutex_unlock(accept_mutex); } @@ -591,11 +593,11 @@ static void accept_mutex_cleanup(void *foo) { - if (accept_mutex != (void *)(caddr_t)-1 + if (accept_mutex != (void *) (ap_ptr) -1 && munmap((caddr_t) accept_mutex, sizeof(*accept_mutex))) { perror("munmap"); } - accept_mutex = (void *)(caddr_t)-1; + accept_mutex = (void *) (ap_ptr) -1; } static void accept_mutex_init(pool *p) @@ -1024,14 +1026,15 @@ #endif /* On some architectures it's safe to do unserialized accept()s in the single - * Listen case. But it's never safe to do it in the case where there's + * Listen case. But it's never(*) safe to do it in the case where there's * multiple Listen statements. Define SINGLE_LISTEN_UNSERIALIZED_ACCEPT * when it's safe in the single Listen case. + * (*) multiple Listen unserialized accepts are safe on Irix 6.5 */ #ifdef SINGLE_LISTEN_UNSERIALIZED_ACCEPT -#define SAFE_ACCEPT(stmt) do {if(ap_listeners->next != ap_listeners) {stmt;}} while(0) +#define SAFE_ACCEPT(stmt) {if(!ap_single_listen && ap_listeners->next != ap_listeners) {stmt;}} #else -#define SAFE_ACCEPT(stmt) do {stmt;} while(0) +#define SAFE_ACCEPT(stmt) {stmt;} #endif static void usage(char *bin) @@ -1048,9 +1051,11 @@ fprintf(stderr, "Usage: %s [-D name] [-d directory] [-f file]\n", bin); #endif fprintf(stderr, " %s [-C \"directive\"] [-c \"directive\"]\n", pad); - fprintf(stderr, " %s [-v] [-V] [-h] [-l] [-L] [-S] [-t] [-T]\n", pad); #ifdef WIN32 + fprintf(stderr, " %s [-v] [-V] [-h] [-l] [-L] [-S] [-t] [-T]\n", pad); fprintf(stderr, " %s [-n service] [-k signal] [-i] [-u]\n", pad); +#else + fprintf(stderr, " %s [-v] [-V] [-h] [-l] [-L] [-S] [-t] [-T] [-i]\n", pad); #endif fprintf(stderr, "Options:\n"); #ifdef SHARED_CORE @@ -1076,6 +1081,8 @@ fprintf(stderr, " -k start : tell Apache to start\n"); fprintf(stderr, " -i : install an Apache service\n"); fprintf(stderr, " -u : uninstall an Apache service\n"); +#else + fprintf(stderr, " -i : do not daemonize\n"); #endif #ifdef NETWARE @@ -1128,9 +1135,13 @@ #endif +/*ARGSUSED*/ static void timeout(int sig) { +#if 0 void *dirconf; +#endif + #ifdef NETWARE get_tsd #endif @@ -1146,10 +1157,12 @@ ap_longjmp(jmpbuffer, 1); } +#if 0 if (timeout_req != NULL) dirconf = timeout_req->per_dir_config; else dirconf = current_conn->server->lookup_defaults; +#endif if (!current_conn->keptalive) { ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, current_conn->server, "[client %s] %s timed out", @@ -1283,6 +1296,9 @@ } #else if (alarm_fn && x && fn != alarm_fn) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, NULL, "ap_set_callback_and_alarm: possible nested timer!"); } @@ -1291,6 +1307,9 @@ old = alarm(x); #else if (child_timeouts) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif old = alarm(x); } else { @@ -1388,6 +1407,7 @@ ap_set_callback_and_alarm(timeout, r->server->timeout); } +/*ARGSUSED0*/ API_EXPORT(void) ap_kill_timeout(request_rec *dummy) { #ifdef NETWARE @@ -1662,6 +1682,232 @@ } #endif +#ifdef FAST_TIME +/* + * A separate process -- the timekeeper -- is created to update a shared + * time-of-day variable in the scoreboard. The timekeeper is managed + * via the other-child registry. This changes the number of calls to + * the time() syscall from two-per-request to one-a-second which + * improves performance when handling many requests per second. + */ + +static pid_t timekeeper_pid = -1; + +/* + * Timekeeper process main loop. + */ +static void +keep_time(void) +{ + signal(SIGHUP, SIG_IGN); /* restarts are explicit via SIGTERM */ + signal(SIGTERM, SIG_DFL); + signal(SIGUSR1, SIG_IGN); + + for (;;) { + struct timeval tv; + + /* update the shared time of day */ + ap_scoreboard_image->global.time = time(NULL); + + /* wait one second for the time to change */ + tv.tv_sec = 1; + tv.tv_usec = 0; + select(0, NULL, NULL, NULL, &tv); + } +} + +/* + * Other-child maintenance callback. + */ +/*ARGSUSED1*/ +static void +timekeeper_maintenance(int reason, void *data, ap_wait_t status) +{ + switch (reason) { + case OC_REASON_DEATH: + case OC_REASON_LOST: + case OC_REASON_RESTART: + /* kill extant timekeeper and allow a new one to take over */ + kill(timekeeper_pid, SIGKILL); + timekeeper_pid = -1; + + /* unregister it */ + ap_unregister_other_child(&ap_scoreboard_image->global.time); + + /* alert everybody that they must now use time() directly */ + ap_scoreboard_image->global.time = 0; + break; + } +} + +/* + * Start a timekeeper thread if one is not already running. The + * scoreboard must already be initialized. + */ +static void +start_timekeeper(void) +{ + ap_assert(ap_scoreboard_image); + + if (!one_process && timekeeper_pid == -1) { + pid_t pid = fork(); + switch (pid) { + case -1: + ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, "fork: Cannot start timekeeper"); + break; + case 0: + keep_time(); + exit(0); + break; + default: + timekeeper_pid = pid; + ap_register_other_child(pid, timekeeper_maintenance, + &ap_scoreboard_image->global.time, -1); + } + } +} +#endif + +#ifdef HAVE_MMAP +/*ARGSUSED*/ +caddr_t +ap_map_anonymous(pool *p, caddr_t addr, size_t size) +{ + caddr_t m = (caddr_t) (ap_ptr) -1; + +#ifdef MAP_ANON +/* BSD style */ +#ifdef CONVEXOS11 + { + unsigned int len = size; + + m = mmap(addr, &len, PROT_READ | PROT_WRITE, MAP_ANON | MAP_SHARED, + NOFD, 0); + if (m == (caddr_t) (ap_ptr) -1) { + perror("mmap"); + fprintf(stderr, "%s: Could not mmap memory\n", ap_server_argv0); + } + } +#elif defined(MAP_TMPFILE) + { + char *mfile = ap_pstrdup(p, "/tmp/apache_shmem_XXXX"); + int fd = mkstemp(mfile); + if (fd >= 0) { + m = mmap(addr, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); + if (m == (caddr_t) (ap_ptr) -1) { + perror(mfile); + fprintf(stderr, "%s: Could not mmap %s\n", ap_server_argv0, mfile); + } + close(fd); + } else { + perror(mfile); + fprintf(stderr, "%s: Could not open %s\n", ap_server_argv0, mfile); + } + unlink(mfile); + } +#else + m = mmap(addr, size, PROT_READ | PROT_WRITE, MAP_ANON | MAP_SHARED, -1, 0); + if (m == (caddr_t) (ap_ptr) -1) { + perror("mmap"); + fprintf(stderr, "%s: Could not mmap memory\n", ap_server_argv0); + } +#endif +#else +/* Sun style */ + int fd = open("/dev/zero", O_RDWR); + if (fd >= 0) { + m = mmap(addr, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); + if (m == (caddr_t) (ap_ptr) -1) { + perror("/dev/zero"); + fprintf(stderr, "%s: Could not mmap memory\n", ap_server_argv0); + } + close(fd); + } else { + perror("/dev/zero"); + fprintf(stderr, "%s: Could not open /dev/zero\n", ap_server_argv0); + } +#endif + + return m; +} +#endif + +#ifdef HAVE_SHMGET +/*ARGSUSED*/ +caddr_t +ap_share_anonymous(pool *p, caddr_t addr, size_t size) +{ + caddr_t m = (caddr_t) (ap_ptr) -1; + int shmid; + + shmid = shmget(IPC_PRIVATE, size, IPC_CREAT | SHM_R | SHM_W); + if (shmid >= 0) { +#ifdef MOVEBREAK + void *obrk; +#endif + + ap_log_error(APLOG_MARK, APLOG_INFO | APLOG_NOERRNO, server_conf, + "created shared memory segment #%d", shmid); + +#ifdef MOVEBREAK + /* + * Some SysV systems place the shared segment WAY too close + * to the dynamic memory break point (sbrk(0)). This severely + * limits the use of malloc/sbrk in the program since sbrk will + * refuse to move past that point. + * + * To get around this, we move the break point "way up there", + * attach the segment and then move break back down. Ugly + */ + if ((obrk = sbrk(MOVEBREAK)) == (void *) (ap_ptr) -1) { + ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, + "sbrk() could not move break"); + } +#endif + + m = shmat(shmid, addr, 0); + if (m != (caddr_t) (ap_ptr) -1) { + struct shmid_ds shmbuf; + + if (shmctl(shmid, IPC_STAT, &shmbuf) == 0) { + shmbuf.shm_perm.uid = ap_user_id; + shmbuf.shm_perm.gid = ap_group_id; + if (shmctl(shmid, IPC_SET, &shmbuf) < 0) + ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, + "shmctl(%d, IPC_SET, uid %d gid %d)", shmid, + ap_user_id, ap_group_id); + } else + ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, + "shmctl(%d, IPC_STAT)", shmid); + } else + ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, "shmat(%d, %p)", + shmid, addr); + + if (shmctl(shmid, IPC_RMID, NULL) < 0) + ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, + "shmctl(%d, IPC_RMID)", shmid); + +#ifdef MOVEBREAK + if (obrk != (void *) (ap_ptr) -1 && sbrk(-(MOVEBREAK)) == (void *) (ap_ptr) -1) + ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, + "sbrk() could not restore break"); +#endif + } else { + ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, + "shmget(IPC_PRIVATE, %ld)", (long) size); +#ifdef LINUX + if (errno == ENOSYS) + ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, server_conf, + "Your kernel was built without CONFIG_SYSVIPC\n" + "%s: Please consult the Apache FAQ for details", + ap_server_argv0); +#endif + } + + return m; +} +#endif + /***************************************************************** * * Dealing with the scoreboard... a lot of these variables are global @@ -1857,6 +2103,7 @@ ap_scoreboard_image->global.running_generation = 0; } +/*ARGSUSED*/ static void reopen_scoreboard(pool *p) { } @@ -1863,12 +2110,11 @@ #elif defined(USE_MMAP_SCOREBOARD) +/*ARGSUSED0*/ static void setup_shared_mem(pool *p) { caddr_t m; -#if defined(MAP_ANON) -/* BSD style */ #ifdef CONVEXOS11 /* * 9-Aug-97 - Jeff Venters (venters@convex.hp.com) @@ -1880,155 +2126,37 @@ * Also, the length requires a pointer as the actual length is * returned (rounded up to a page boundary). */ - { - unsigned len = SCOREBOARD_SIZE; - - m = mmap((caddr_t) 0xC0000000, &len, - PROT_READ | PROT_WRITE, MAP_ANON | MAP_SHARED, NOFD, 0); - } -#elif defined(MAP_TMPFILE) - { - char mfile[] = "/tmp/apache_shmem_XXXX"; - int fd = mkstemp(mfile); - if (fd == -1) { - perror("open"); - fprintf(stderr, "%s: Could not open %s\n", ap_server_argv0, mfile); - exit(APEXIT_INIT); - } - m = mmap((caddr_t) 0, SCOREBOARD_SIZE, - PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); - if (m == (caddr_t) - 1) { - perror("mmap"); - fprintf(stderr, "%s: Could not mmap %s\n", ap_server_argv0, mfile); - exit(APEXIT_INIT); - } - close(fd); - unlink(mfile); - } + m = ap_map_anonymous(p, 0xC0000000, SCOREBOARD_SIZE); #else - m = mmap((caddr_t) 0, SCOREBOARD_SIZE, - PROT_READ | PROT_WRITE, MAP_ANON | MAP_SHARED, -1, 0); + m = ap_map_anonymous(p, 0, SCOREBOARD_SIZE); #endif - if (m == (caddr_t) - 1) { - perror("mmap"); - fprintf(stderr, "%s: Could not mmap memory\n", ap_server_argv0); - exit(APEXIT_INIT); - } -#else -/* Sun style */ - int fd; - fd = open("/dev/zero", O_RDWR); - if (fd == -1) { - perror("open"); - fprintf(stderr, "%s: Could not open /dev/zero\n", ap_server_argv0); + if (m == (caddr_t) (ap_ptr) -1) exit(APEXIT_INIT); - } - m = mmap((caddr_t) 0, SCOREBOARD_SIZE, - PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); - if (m == (caddr_t) - 1) { - perror("mmap"); - fprintf(stderr, "%s: Could not mmap /dev/zero\n", ap_server_argv0); - exit(APEXIT_INIT); - } - close(fd); -#endif + ap_scoreboard_image = (scoreboard *) m; ap_scoreboard_image->global.running_generation = 0; } +/*ARGSUSED0*/ static void reopen_scoreboard(pool *p) { } #elif defined(USE_SHMGET_SCOREBOARD) -static key_t shmkey = IPC_PRIVATE; -static int shmid = -1; - static void setup_shared_mem(pool *p) { - struct shmid_ds shmbuf; -#ifdef MOVEBREAK - char *obrk; -#endif - - if ((shmid = shmget(shmkey, SCOREBOARD_SIZE, IPC_CREAT | SHM_R | SHM_W)) == -1) { -#ifdef LINUX - if (errno == ENOSYS) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, server_conf, - "Your kernel was built without CONFIG_SYSVIPC\n" - "%s: Please consult the Apache FAQ for details", - ap_server_argv0); - } -#endif - ap_log_error(APLOG_MARK, APLOG_EMERG, server_conf, - "could not call shmget"); - exit(APEXIT_INIT); - } - - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, server_conf, - "created shared memory segment #%d", shmid); - -#ifdef MOVEBREAK - /* - * Some SysV systems place the shared segment WAY too close - * to the dynamic memory break point (sbrk(0)). This severely - * limits the use of malloc/sbrk in the program since sbrk will - * refuse to move past that point. - * - * To get around this, we move the break point "way up there", - * attach the segment and then move break back down. Ugly - */ - if ((obrk = sbrk(MOVEBREAK)) == (char *) -1) { - ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, - "sbrk() could not move break"); - } -#endif + caddr_t m; -#define BADSHMAT ((scoreboard *)(-1)) - if ((ap_scoreboard_image = (scoreboard *) shmat(shmid, 0, 0)) == BADSHMAT) { - ap_log_error(APLOG_MARK, APLOG_EMERG, server_conf, "shmat error"); - /* - * We exit below, after we try to remove the segment - */ - } - else { /* only worry about permissions if we attached the segment */ - if (shmctl(shmid, IPC_STAT, &shmbuf) != 0) { - ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, - "shmctl() could not stat segment #%d", shmid); - } - else { - shmbuf.shm_perm.uid = ap_user_id; - shmbuf.shm_perm.gid = ap_group_id; - if (shmctl(shmid, IPC_SET, &shmbuf) != 0) { - ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, - "shmctl() could not set segment #%d", shmid); - } - } - } - /* - * We must avoid leaving segments in the kernel's - * (small) tables. - */ - if (shmctl(shmid, IPC_RMID, NULL) != 0) { - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, - "shmctl: IPC_RMID: could not remove shared memory segment #%d", - shmid); - } - if (ap_scoreboard_image == BADSHMAT) /* now bailout */ + m = ap_share_anonymous(p, 0, SCOREBOARD_SIZE); + if (m == (caddr_t) (ap_ptr) -1) exit(APEXIT_INIT); -#ifdef MOVEBREAK - if (obrk == (char *) -1) - return; /* nothing else to do */ - if (sbrk(-(MOVEBREAK)) == (char *) -1) { - ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, - "sbrk() could not move break back"); - } -#endif + ap_scoreboard_image = (scoreboard *) m; ap_scoreboard_image->global.running_generation = 0; } +/*ARGSUSED*/ static void reopen_scoreboard(pool *p) { } @@ -2137,6 +2265,9 @@ } memset(ap_scoreboard_image, 0, SCOREBOARD_SIZE); ap_scoreboard_image->global.running_generation = running_gen; +#ifdef FAST_TIME + start_timekeeper(); +#endif #else ap_scoreboard_image = &_scoreboard_image; ap_scoreboard_fname = ap_server_root_relative(p, ap_scoreboard_fname); @@ -2169,7 +2300,7 @@ ap_inline void ap_sync_scoreboard_image(void) { #ifdef SCOREBOARD_FILE - lseek(scoreboard_fd, 0L, 0); + lseek(scoreboard_fd, 0, 0); force_read(scoreboard_fd, ap_scoreboard_image, sizeof(*ap_scoreboard_image)); #endif } @@ -2181,11 +2312,12 @@ return (ap_scoreboard_image ? 1 : 0); } +/*ARGSUSED*/ static ap_inline void put_scoreboard_info(int child_num, short_score *new_score_rec) { #ifdef SCOREBOARD_FILE - lseek(scoreboard_fd, (long) child_num * sizeof(short_score), 0); + lseek(scoreboard_fd, (off_t) child_num * sizeof(short_score), 0); force_write(scoreboard_fd, new_score_rec, sizeof(short_score)); #endif } @@ -2208,8 +2340,12 @@ int old_status; short_score *ss; - if (child_num < 0) + if (child_num < 0) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif return -1; + } ap_check_signals(); @@ -2226,6 +2362,9 @@ #endif if (ap_extended_status) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif #ifndef OPTIMIZE_TIMEOUTS ss->last_used = time(NULL); #endif @@ -2234,8 +2373,8 @@ * Reset individual counters */ if (status == SERVER_DEAD) { - ss->my_access_count = 0L; - ss->my_bytes_served = 0L; + ss->my_access_count = 0; + ss->my_bytes_served = 0; } ss->conn_count = (unsigned short) 0; ss->conn_bytes = (unsigned long) 0; @@ -2259,6 +2398,9 @@ } } if (status == SERVER_STARTING && r == NULL) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif /* clean up the slot's vhostrec pointer (maybe re-used) * and mark the slot as belonging to a new generation. */ @@ -2305,9 +2447,10 @@ #endif /* NO_TIMES */ ss->start_time = (clock_t) 0; #else - if (gettimeofday(&ss->start_time, (struct timezone *) 0) < 0) - ss->start_time.tv_sec = - ss->start_time.tv_usec = 0L; + if (gettimeofday(&ss->start_time, (struct timezone *) 0) < 0) { + ss->start_time.tv_sec = 0; + ss->start_time.tv_usec = 0; + } #endif } else if (status == STOP_PREQUEST) { @@ -2317,11 +2460,12 @@ #endif ss->stop_time = ss->start_time = (clock_t) 0; #else - if (gettimeofday(&ss->stop_time, (struct timezone *) 0) < 0) - ss->stop_time.tv_sec = - ss->stop_time.tv_usec = - ss->start_time.tv_sec = - ss->start_time.tv_usec = 0L; + if (gettimeofday(&ss->stop_time, (struct timezone *) 0) < 0) { + ss->stop_time.tv_sec = 0; + ss->stop_time.tv_usec = 0; + ss->start_time.tv_sec = 0; + ss->start_time.tv_usec = 0; + } #endif } @@ -2331,7 +2475,7 @@ static void increment_counts(int child_num, request_rec *r) { - long int bs = 0; + ap_int32 bs = 0; short_score *ss; ap_sync_scoreboard_image(); @@ -2368,7 +2512,7 @@ { #ifndef MULTITHREAD int i, status; - long int waittime = 1024 * 16; /* in usecs */ + ap_int32 waittime = 1024 * 16; /* in usecs */ struct timeval tv; int waitret, tries; int not_dead_yet; @@ -2756,6 +2900,7 @@ * Connection structures and accounting... */ +/*ARGSUSED0*/ static void just_die(int sig) { /* SIGHUP to child process??? */ /* if alarms are blocked we have to wait to die otherwise we might @@ -2771,6 +2916,7 @@ } } +#ifndef NO_GRACEFUL static int volatile usr1_just_die = 1; static int volatile deferred_die; @@ -2781,6 +2927,7 @@ } deferred_die = 1; } +#endif /* volatile just in case */ static int volatile shutdown_pending; @@ -2892,6 +3039,9 @@ } /* do a graceful restart if graceful == 1 */ +#ifdef NO_GRACEFUL +/*ARGSUSED*/ +#endif void ap_start_restart(int graceful) { #ifndef WIN32 @@ -2900,12 +3050,15 @@ return; } restart_pending = 1; +#ifndef NO_GRACEFUL is_graceful = graceful; +#endif #else signal_parent(1); /* get the parent process to wake up */ #endif /* WIN32 */ } +/*ARGSUSED0*/ static void sig_term(int sig) { ap_start_shutdown(); @@ -3029,6 +3182,8 @@ * Here follows a long bunch of generic server bookkeeping stuff... */ +int daemonize = 1; + static void detach(void) { #if !defined(WIN32) && !defined(NETWARE) @@ -3038,12 +3193,14 @@ #if !defined(MPE) && !defined(OS2) && !defined(TPF) /* Don't detach for MPE because child processes can't survive the death of the parent. */ - if ((x = fork()) > 0) - exit(0); - else if (x == -1) { - perror("fork"); - fprintf(stderr, "%s: unable to fork new process\n", ap_server_argv0); - exit(1); + if (daemonize) { + if ((x = fork()) > 0) + exit(0); + else if (x == -1) { + perror("fork"); + fprintf(stderr, "%s: unable to fork new process\n", ap_server_argv0); + exit(1); + } } RAISE_SIGSTOP(DETACH); #endif @@ -3073,24 +3230,26 @@ } #endif - /* close out the standard file descriptors */ - if (freopen("/dev/null", "r", stdin) == NULL) { - fprintf(stderr, "%s: unable to replace stdin with /dev/null: %s\n", - ap_server_argv0, strerror(errno)); - /* continue anyhow -- note we can't close out descriptor 0 because we - * have nothing to replace it with, and if we didn't have a descriptor - * 0 the next file would be created with that value ... leading to - * havoc. + if (daemonize) { + /* close out the standard file descriptors */ + if (freopen("/dev/null", "r", stdin) == NULL) { + fprintf(stderr, "%s: unable to replace stdin with /dev/null: %s\n", + ap_server_argv0, strerror(errno)); + /* continue anyhow -- note we can't close out descriptor 0 because we + * have nothing to replace it with, and if we didn't have a descriptor + * 0 the next file would be created with that value ... leading to + * havoc. + */ + } + if (freopen("/dev/null", "w", stdout) == NULL) { + fprintf(stderr, "%s: unable to replace stdout with /dev/null: %s\n", + ap_server_argv0, strerror(errno)); + } + /* stderr is a tricky one, we really want it to be the error_log, + * but we haven't opened that yet. So leave it alone for now and it'll + * be reopened moments later. */ } - if (freopen("/dev/null", "w", stdout) == NULL) { - fprintf(stderr, "%s: unable to replace stdout with /dev/null: %s\n", - ap_server_argv0, strerror(errno)); - } - /* stderr is a tricky one, we really want it to be the error_log, - * but we haven't opened that yet. So leave it alone for now and it'll - * be reopened moments later. - */ #endif /* ndef WIN32 */ } @@ -3198,8 +3357,8 @@ conn->pool = p; conn->local_addr = *saddr; - conn->local_ip = ap_pstrdup(conn->pool, - inet_ntoa(conn->local_addr.sin_addr)); + ap_inet_ntoa(conn->local_addr.sin_addr, conn->local_ip, + &conn->local_ip_len); conn->server = server; /* just a guess for now */ ap_update_vhost_given_ip(conn); conn->base_server = conn->server; @@ -3206,8 +3365,8 @@ conn->client = inout; conn->remote_addr = *remaddr; - conn->remote_ip = ap_pstrdup(conn->pool, - inet_ntoa(conn->remote_addr.sin_addr)); + ap_inet_ntoa(conn->remote_addr.sin_addr, conn->remote_ip, + &conn->remote_ip_len); return conn; } @@ -3246,10 +3405,12 @@ int one = 1; char addr[512]; - if (server->sin_addr.s_addr != htonl(INADDR_ANY)) + if (server->sin_addr.s_addr != htonl(INADDR_ANY)) { + char nbuf[16]; ap_snprintf(addr, sizeof(addr), "address %s port %d", - inet_ntoa(server->sin_addr), ntohs(server->sin_port)); - else + ap_inet_ntoa(server->sin_addr, nbuf, NULL), + ntohs(server->sin_port)); + } else ap_snprintf(addr, sizeof(addr), "port %d", ntohs(server->sin_port)); /* note that because we're about to slack we don't use psocket */ @@ -3525,11 +3686,15 @@ head_listener = ap_listeners; close_unused_listeners(); -#ifdef NO_SERIALIZED_ACCEPT +#if defined(NO_SERIALIZED_ACCEPT) && (!defined(IRIX) || IRIX < 65) /* warn them about the starvation problem if they're using multiple * sockets */ - if (ap_listeners->next != ap_listeners) { + if ( +#ifdef SINGLE_LISTEN_UNSERIALIZED_ACCEPT + !ap_single_listen && +#endif + ap_listeners->next != ap_listeners) { ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_CRIT, NULL, "You cannot use multiple Listens safely on your system, " "proceeding anyway. See src/PORTING, search for " @@ -3650,6 +3815,18 @@ printf(" -D MMAP_SEGMENT_SIZE=%ld\n",(long)MMAP_SEGMENT_SIZE); #endif #endif /*USE_MMAP_FILES*/ +#ifdef USE_DIRECT_IO + printf(" -D USE_DIRECT_IO\n"); +#ifdef DIRECT_THRESHOLD + printf(" -D DIRECT_THRESHOLD=%ld\n", (long) DIRECT_THRESHOLD); +#endif +#ifdef MAX_DIRECT_ALIGN + printf(" -D MAX_DIRECT_ALIGN=%ld\n", (long) MAX_DIRECT_ALIGN); +#endif +#ifdef MAX_DIRECT_BUFSIZE + printf(" -D MAX_DIRECT_BUFSIZE=%ld\n", (long) MAX_DIRECT_BUFSIZE); +#endif +#endif /* USE_DIRECT_IO */ #ifdef NO_WRITEV printf(" -D NO_WRITEV\n"); #endif @@ -3680,12 +3857,44 @@ #ifdef NO_RELIABLE_PIPED_LOGS printf(" -D NO_RELIABLE_PIPED_LOGS\n"); #endif +#ifdef USE_QSC + printf(" -D USE_QSC\n"); +# ifdef QSC_HASH_SIZE + printf(" -D QSC_HASH_SIZE=%d\n", QSC_HASH_SIZE); +# endif +# ifdef QSC_MAX_SIZE + printf(" -D QSC_MAX_SIZE=%lu\n", (unsigned long) QSC_MAX_SIZE); +# endif +# ifdef QSC_HEADER_GRAIN + printf(" -D QSC_HEADER_GRAIN=%d\n", QSC_HEADER_GRAIN); +# endif +# if !defined(QSC_HEADER_GRAIN) || QSC_HEADER_GRAIN > 0 +# ifdef QSC_MAX_ALLOC + printf(" -D QSC_MAX_ALLOC=%d\n", QSC_MAX_ALLOC); +# endif +# ifdef QSC_RED_ZONE + printf(" -D QSC_RED_ZONE=%d\n", QSC_RED_ZONE); +# endif +# endif +#endif +#ifdef FAST_TIME + printf(" -D FAST_TIME\n"); +#endif #ifdef BUFFERED_LOGS printf(" -D BUFFERED_LOGS\n"); +# ifdef LOG_BUFSIZE + printf(" -D LOG_BUFSIZE=%d\n", LOG_BUFSIZE); +# endif #ifdef PIPE_BUF printf(" -D PIPE_BUF=%ld\n",(long)PIPE_BUF); #endif #endif +#ifdef NO_GRACEFUL + printf(" -D NO_GRACEFUL\n"); +#endif +#ifdef USE_QUICK_LOG + printf(" -D USE_QUICK_LOG\n"); +#endif #ifdef MULTITHREAD printf(" -D MULTITHREAD\n"); #endif @@ -3848,6 +4057,19 @@ } #endif +#ifdef SINGLE_LISTEN_UNSERIALIZED_ACCEPT + ap_sync_scoreboard_image(); + ap_scoreboard_image->servers[my_child_num].cpu = -1; + if (ap_single_listen) { + if (head_listener->cpu >= 0 && ap_os_bind_cpu(head_listener->cpu)) + ap_scoreboard_image->servers[my_child_num].cpu = + head_listener->cpu; + ap_scoreboard_image->servers[my_child_num].single_addr = + head_listener->local_addr; + } + put_scoreboard_info(my_child_num, &ap_scoreboard_image->servers[my_child_num]); +#endif + ap_child_init_modules(pchild, server_conf); /* done with the initialization critical section */ @@ -3879,10 +4101,11 @@ } #endif - while (1) { + for (;;) { BUFF *conn_io; request_rec *r; +#ifndef NO_GRACEFUL /* Prepare to receive a SIGUSR1 due to graceful restart so that * we can exit cleanly. Since we're between connections right * now it's the right time to exit, but we might be blocked in a @@ -3889,6 +4112,7 @@ * system call when the graceful restart request is made. */ usr1_just_die = 1; signal(SIGUSR1, usr1_handler); +#endif /* * (Re)initialize this child to a pre-connection state. @@ -3923,7 +4147,14 @@ SAFE_ACCEPT(accept_mutex_on()); for (;;) { - if (ap_listeners->next != ap_listeners) { + if ( +#ifdef SINGLE_LISTEN_UNSERIALIZED_ACCEPT + !ap_single_listen && +#endif + ap_listeners->next != ap_listeners) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif /* more than one socket */ memcpy(&main_fds, &listenfds, sizeof(fd_set)); srv = ap_select(listenmaxfd + 1, &main_fds, NULL, NULL, NULL); @@ -3945,27 +4176,31 @@ lr = find_ready_listener(&main_fds); if (lr == NULL) continue; - sd = lr->fd; + listener = lr; } else { /* only one socket, just pretend we did the other stuff */ - sd = ap_listeners->fd; + listener = head_listener; } /* if we accept() something we don't want to die, so we have to * defer the exit */ +#ifndef NO_GRACEFUL deferred_die = 0; usr1_just_die = 0; +#endif for (;;) { clen = sizeof(sa_client); - csd = ap_accept(sd, &sa_client, &clen); + csd = ap_accept(listener->fd, &sa_client, &clen); if (csd >= 0 || errno != EINTR) break; +#ifndef NO_GRACEFUL if (deferred_die) { /* we didn't get a socket, and we were told to die */ clean_child_exit(0); } +#endif } if (csd >= 0) @@ -4063,6 +4298,7 @@ } } +#ifndef NO_GRACEFUL /* go around again, safe to die */ usr1_just_die = 1; if (deferred_die) { @@ -4069,6 +4305,7 @@ /* ok maybe not, see ya later */ clean_child_exit(0); } +#endif /* or maybe we missed a signal, you never know on systems * without reliable signals */ @@ -4085,10 +4322,12 @@ continue; #endif +#ifndef NO_GRACEFUL /* We've got a socket, let's at least process one request off the * socket before we accept a graceful restart request. */ signal(SIGUSR1, SIG_IGN); +#endif ap_note_cleanups_for_fd(ptrans, csd); @@ -4095,6 +4334,9 @@ /* protect various fd_sets */ #ifdef CHECK_FD_SETSIZE if (csd >= FD_SETSIZE) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, NULL, "[csd] filedescriptor (%u) larger than FD_SETSIZE (%u) " "found, you probably need to rebuild Apache with a " @@ -4108,13 +4350,33 @@ * socket options, file descriptors, and read/write buffers. */ - clen = sizeof(sa_server); - if (getsockname(csd, &sa_server, &clen) < 0) { - ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, "getsockname"); - continue; + if (listener->unique) { + /* + * The connection was accepted from a socket listening to + * just one address so we don't need to call getsockname(). + */ + sa_server = *((struct sockaddr *) &listener->local_addr); + } else { + /* + * The connection was accepted from a socket listening to + * multiple addresses so we need to find out which one + * provided. + */ + clen = sizeof(sa_server); + if (getsockname(csd, &sa_server, &clen) < 0) { + ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, "getsockname"); + continue; + } } +#if defined(IRIX) && IRIX >= 65 + /* + * TCP_NODELAY is inherited from the accepting socket in Irix + * 6.5 and beyond. + */ +#else sock_disable_nagle(csd); +#endif (void) ap_update_child_status(my_child_num, SERVER_BUSY_READ, (request_rec *) NULL); @@ -4176,8 +4438,12 @@ if (r->status == HTTP_OK) ap_process_request(r); - if(ap_extended_status) + if(ap_extended_status) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif increment_counts(my_child_num, r); + } if (!current_conn->keepalive || current_conn->aborted) break; @@ -4188,10 +4454,14 @@ ap_sync_scoreboard_image(); if (ap_scoreboard_image->global.running_generation != ap_my_generation) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif ap_bclose(conn_io); clean_child_exit(0); } +#ifndef NO_GRACEFUL /* In case we get a graceful restart while we're blocked * waiting for the request. * @@ -4207,6 +4477,7 @@ */ usr1_just_die = 1; signal(SIGUSR1, usr1_handler); +#endif } /* @@ -4278,6 +4549,9 @@ signal(SIGQUIT, SIG_DFL); #endif signal(SIGTERM, just_die); +#ifdef SINGLE_LISTEN_UNSERIALIZED_ACCEPT + ap_single_listen = 0; +#endif child_main(slot); } @@ -4386,7 +4660,7 @@ int to_kill; int idle_count; short_score *ss; - time_t now = time(0); + time_t now = ap_time(); int free_length; int free_slots[MAX_SPAWN_RATE]; int last_non_dead; @@ -4576,7 +4850,7 @@ #ifndef STANDALONE_MAIN #define STANDALONE_MAIN standalone_main -static void standalone_main(int argc, char **argv) +static void standalone_main(void) { int remaining_children_to_start; @@ -4819,7 +5093,7 @@ } /* standalone_main */ #else /* prototype */ -void STANDALONE_MAIN(int argc, char **argv); +void STANDALONE_MAIN(void); #endif /* STANDALONE_MAIN */ extern char *optarg; @@ -4869,7 +5143,7 @@ ap_setup_prelinked_modules(); while ((c = getopt(argc, argv, - "D:C:c:xXd:f:vVlLR:StTh" + "D:C:c:xXd:f:vVlLR:StThi" #ifdef DEBUG_SIGSTOP "Z:" #endif @@ -4898,6 +5172,7 @@ ap_set_version(); printf("Server version: %s\n", ap_get_server_version()); printf("Server built: %s\n", ap_get_server_built()); + printf("Performance Tuned by SGI \n"); exit(0); case 'V': ap_set_version(); @@ -4946,6 +5221,9 @@ break; case 'h': usage(argv[0]); + case 'i': + daemonize = 0; + break; case '?': usage(argv[0]); } @@ -4962,6 +5240,10 @@ exit(0); } +#ifdef USE_QSC + qsc_init(pconf); +#endif + child_timeouts = !ap_standalone || one_process; #ifdef BEOS @@ -4975,7 +5257,7 @@ ap_set_version(); ap_init_modules(pconf, server_conf); version_locked++; - STANDALONE_MAIN(argc, argv); + STANDALONE_MAIN(); } #else if (ap_standalone) { @@ -5002,7 +5284,7 @@ child_main(input_parms.child.slot); } else - STANDALONE_MAIN(argc, argv); + STANDALONE_MAIN(); } #endif else { @@ -5097,7 +5379,7 @@ ap_bclose(cio); } - exit(0); + return 0; } #else /* ndef MULTITHREAD */ @@ -5660,7 +5942,7 @@ pchild = ap_make_sub_pool(pconf); ap_standalone = 1; - sd = -1; + listener = NULL; nthreads = ap_threads_per_child; if (nthreads <= 0) @@ -5755,13 +6037,13 @@ lr = find_ready_listener(&main_fds); if (lr != NULL) { - sd = lr->fd; + listener = lr; } } do { clen = sizeof(sa_client); - csd = accept(sd, (struct sockaddr *) &sa_client, &clen); + csd = accept(listener->fd, (struct sockaddr *) &sa_client, &clen); if (csd == INVALID_SOCKET) { csd = -1; @@ -5832,7 +6114,7 @@ pchild = ap_make_sub_pool(pconf); ap_standalone = 1; - sd = -1; + listener = NULL; nthreads = ap_threads_per_child; max_jobs_after_exit_request = ap_excess_requests_per_child; max_jobs_per_exe = ap_max_requests_per_child; @@ -5974,12 +6256,12 @@ lr = find_ready_listener(&main_fds); if (lr != NULL) { - sd = lr->fd; + listener = lr; } } do { clen = sizeof(sa_client); - csd = accept(sd, (struct sockaddr *) &sa_client, &clen); + csd = accept(listener ? listener->fd : -1, (struct sockaddr *) &sa_client, &clen); if (csd == INVALID_SOCKET) { csd = -1; } @@ -6835,6 +7117,10 @@ if (!child && !ap_dump_settings) { ap_log_pid(pconf, ap_pid_fname); } +#endif + +#ifdef USE_QSC + qsc_init(pconf); #endif post_parse_init(); diff -Naur apache_1.3.12/src/main/http_protocol.c-orig apache_1.3.12/src/main/http_protocol.c --- apache_1.3.12/src/main/http_protocol.c-orig Sat Feb 19 17:14:47 2000 +++ apache_1.3.12/src/main/http_protocol.c Wed Mar 1 17:17:39 2000 @@ -77,9 +77,9 @@ #include "http_conf_globals.h" #define SET_BYTES_SENT(r) \ - do { if (r->sent_bodyct) \ + { if (r->sent_bodyct) \ ap_bgetopt (r->connection->client, BO_BYTECT, &r->bytes_sent); \ - } while (0) + } #ifdef CHARSET_EBCDIC /* Save & Restore the current conversion settings @@ -140,7 +140,7 @@ return type; } -static int parse_byterange(char *range, long clength, long *start, long *end) +static int parse_byterange(char *range, ap_int32 clength, ap_int32 *start, ap_int32 *end) { char *dash = strchr(range, '-'); @@ -149,15 +149,15 @@ if ((dash == range)) { /* In the form "-5" */ - *start = clength - atol(dash + 1); + *start = clength - ap_atol(dash + 1); *end = clength - 1; } else { *dash = '\0'; dash++; - *start = atol(range); + *start = ap_atol(range); if (*dash) - *end = atol(dash); + *end = ap_atol(dash); else /* "5-" */ *end = clength - 1; } @@ -174,13 +174,13 @@ return (*start > 0 || *end < clength - 1); } -static int internal_byterange(int, long *, request_rec *, const char **, long *, - long *); +static int internal_byterange(int, ap_int32 *, request_rec *, const char **, ap_int32 *, + ap_int32 *); API_EXPORT(int) ap_set_byterange(request_rec *r) { const char *range, *if_range, *match; - long range_start, range_end; + ap_int32 range_start, range_end; if (!r->clength || r->assbackwards) return 0; @@ -227,21 +227,21 @@ ap_table_setn(r->headers_out, "Content-Range", ap_psprintf(r->pool, "bytes %ld-%ld/%ld", - range_start, range_end, r->clength)); + (long) range_start, (long) range_end, (long) r->clength)); ap_table_setn(r->headers_out, "Content-Length", - ap_psprintf(r->pool, "%ld", range_end - range_start + 1)); + ap_psprintf(r->pool, "%ld", (long) (range_end - range_start + 1))); } else { /* a multiple range */ const char *r_range = ap_pstrdup(r->pool, range + 6); - long tlength = 0; + ap_int32 tlength = 0; r->byterange = 2; r->boundary = ap_psprintf(r->pool, "%lx%lx", - r->request_time, (long) getpid()); + (long) r->request_time, (long) getpid()); while (internal_byterange(0, &tlength, r, &r_range, NULL, NULL)); ap_table_setn(r->headers_out, "Content-Length", - ap_psprintf(r->pool, "%ld", tlength)); + ap_psprintf(r->pool, "%ld", (long) tlength)); } r->status = PARTIAL_CONTENT; @@ -250,7 +250,7 @@ return 1; } -API_EXPORT(int) ap_each_byterange(request_rec *r, long *offset, long *length) +API_EXPORT(int) ap_each_byterange(request_rec *r, ap_int32 *offset, ap_int32 *length) { return internal_byterange(1, NULL, r, &r->range, offset, length); } @@ -265,10 +265,10 @@ * Either case will return 1 if it should be called again, and 0 * when done. */ -static int internal_byterange(int realreq, long *tlength, request_rec *r, - const char **r_range, long *offset, long *length) +static int internal_byterange(int realreq, ap_int32 *tlength, request_rec *r, + const char **r_range, ap_int32 *offset, ap_int32 *length) { - long range_start, range_end; + ap_int32 range_start, range_end; char *range; #ifdef CHARSET_EBCDIC /* determine current setting of conversion flag, @@ -305,8 +305,8 @@ const char *ct = make_content_type(r, r->content_type); char ts[MAX_STRING_LEN]; - ap_snprintf(ts, sizeof(ts), "%ld-%ld/%ld", range_start, range_end, - r->clength); + ap_snprintf(ts, sizeof(ts), "%ld-%ld/%ld", (long) range_start, + (long) range_end, (long) r->clength); if (realreq) ap_rvputs(r, CRLF "--", r->boundary, CRLF "Content-type: ", ct, CRLF "Content-range: bytes ", ts, CRLF CRLF, @@ -329,10 +329,10 @@ return 1; } -API_EXPORT(int) ap_set_content_length(request_rec *r, long clength) +API_EXPORT(int) ap_set_content_length(request_rec *r, ap_int32 clength) { r->clength = clength; - ap_table_setn(r->headers_out, "Content-Length", ap_psprintf(r->pool, "%ld", clength)); + ap_table_setn(r->headers_out, "Content-Length", ap_psprintf(r->pool, "%ld", (long) clength)); return 0; } @@ -377,7 +377,14 @@ ap_table_get(r->headers_out, "Transfer-Encoding"), "chunked") || ((r->proto_num >= HTTP_VERSION(1,1)) && +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +/* disable warning about assignment (=) not comparison (==) */ +#pragma set woff 1184 +#endif (r->chunked = 1))) && /* THIS CODE IS CORRECT, see comment above. */ +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma reset woff 1184 +#endif r->server->keep_alive && (r->server->keep_alive_timeout > 0) && ((r->server->keep_alive_max == 0) || @@ -853,11 +860,142 @@ } } +#ifndef RQBUF_SIZE +#define RQBUF_SIZE 4096 /* should be >= buff.c's DEFAULT_BUFSIZE */ +#endif + +/* + * Read the request and, as quickly as possible with minimal copying, + * parse it or pass it on to the regular parsing function + * read_request_line(). Shares state with quickly_get_mime_headers(), + * which has a similar mission. + */ +static int +quickly_read_request_line(request_rec *r) +{ + BUFF *fb; + int n; + + /* + * If r->rqbuf already exists, there could be pointers into it from + * r->headers_in so instead of reusing it, just replace it. + */ +#if CACHE_ALIGNMENT > 0 + /* align r->rqbuf on a cache line boundary */ + r->rqbuf = ap_palloc(r->pool, RQBUF_SIZE + CACHE_ALIGNMENT - 1); + r->rqbuf = (char *) (((ap_ptr) r->rqbuf + CACHE_ALIGNMENT - 1) & ~(CACHE_ALIGNMENT - 1)); +#else + r->rqbuf = ap_palloc(r->pool, RQBUF_SIZE); +#endif + + /* + * would read directly into fb->inptr but r->the_request needs an + * intact copy, sigh + */ + fb = r->connection->client; + fb->flags |= B_SAFEREAD; + n = ap_bread(fb, r->rqbuf, RQBUF_SIZE); + fb->flags &= ~B_SAFEREAD; + + /* 16 == strlen("GET / HTTP/1.0\n\n"): minimal valid request */ + if (n >= 16 && +#ifdef IRIX + /* use big-endian multi-character constant for speed */ + *(unsigned int *) r->rqbuf == 'GET ' +#else + r->rqbuf[0] == 'G' && + r->rqbuf[1] == 'E' && + r->rqbuf[2] == 'T' && + r->rqbuf[3] == ' ' +#endif + ) { + char *cp, *ep; + +#if defined(IRIX) && _MIPS_SIM != _ABIO32 && \ + CACHE_ALIGNMENT > 0 && RQBUF_SIZE > CACHE_ALIGNMENT +/* + * The first cache line was prefetched in ap_read() and used above; now + * try to prefetch the second cache line so parsing can proceed without + * delay. The cache line is prefetched for writing because parsing + * involves modification. With CACHE_ALIGNMENT=128, most request lines + * are smaller than two cache lines. Unfortunately the compiler doesn't + * yet allow "prefetch_ref = r->rqbuf[CACHE_ALIGNMENT]" so hard-code + * 128. + */ +# pragma prefetch_manual = 1 +# pragma prefetch_ref = r->rqbuf[/*CACHE_ALIGNMENT*/ 128], kind = wr +#endif + + /* find the end of the uri */ + cp = &r->rqbuf[4]; /* 4 == strlen("GET ") */ + ep = &r->rqbuf[n - 11]; /* 11 == strlen(" HTTP/1.0\n\n") */ + while (cp <= ep && !ap_isspace(*cp)) + cp++; + + if (cp <= ep && + cp[0] == ' ' && + cp[1] == 'H' && + cp[2] == 'T' && + cp[3] == 'T' && + cp[4] == 'P' && + cp[5] == '/' && + cp[6] == '1' && + cp[7] == '.' && + (cp[8] == '0' || cp[8] == '1') && + ((cp[9] == '\r' && cp[10] == '\n') || cp[9] == '\n')) { +#if defined(SIGUSR1) && !defined(NO_GRACEFUL) + signal(SIGUSR1, SIG_IGN); +#endif + + r->rqhdr = cp + 10 + (cp[9] == '\r'); + r->rqhdr_len = (int) (&r->rqbuf[n] - r->rqhdr); + cp[9] = 0; /* null-terminate r->the_request */ + + r->request_time = ap_time(); + r->the_request = r->rqbuf; + r->the_request_len = (int) (cp + 9 - r->rqbuf); + r->method = "GET"; + r->method_number = M_GET; + ap_assert(!r->assbackwards); + + if (cp[8] == '0') { + r->protocol = "HTTP/1.0"; + r->proto_num = HTTP_VERSION(1,0); + } else { + r->protocol = "HTTP/1.1"; + r->proto_num = HTTP_VERSION(1,1); + } + + *cp = 0; /* avoid copying uri; briefly mangles r->the_request */ + ap_parse_uri(r, &r->rqbuf[4]); + *cp = ' '; + + return 1; + } + } + + /* + * Shortcut parsing failed. No harm done, just copy the + * already-read data into fb and fall back to regular processing. + * If copying bothers you, extend the buffering code to allow an + * alternate read-ahead buffer and then just manipulate pointers. + */ + ap_assert(r->rqhdr_len == 0); + if (n > 0) { + ap_assert(&fb->inptr[n] <= &fb->inbase[fb->bufsiz]); + memcpy(fb->inptr, r->rqbuf, n); + fb->incnt += n; + } + + return 0; +} + static int read_request_line(request_rec *r) { char l[DEFAULT_LIMIT_REQUEST_LINE + 2]; /* getline's two extra for \n\0 */ const char *ll = l; const char *uri; + const char *pro; conn_rec *conn = r->connection; int major = 1, minor = 0; /* Assume HTTP/1.0 if non-"HTTP" protocol */ int len; @@ -883,19 +1021,20 @@ /* this is a hack to make sure that request time is set, * it's not perfect, but it's better than nothing */ - r->request_time = time(0); + r->request_time = ap_time(); return 0; } } /* we've probably got something to do, ignore graceful restart requests */ -#ifdef SIGUSR1 +#if defined(SIGUSR1) && !defined(NO_GRACEFUL) signal(SIGUSR1, SIG_IGN); #endif ap_bsetflag(conn->client, B_SAFEREAD, 0); - r->request_time = time(NULL); - r->the_request = ap_pstrdup(r->pool, l); + r->request_time = ap_time(); + r->the_request = ap_pstrndup(r->pool, l, len); + r->the_request_len = len; r->method = ap_getword_white(r->pool, &ll); uri = ap_getword_white(r->pool, &ll); @@ -920,9 +1059,23 @@ } r->assbackwards = (ll[0] == '\0'); - r->protocol = ap_pstrdup(r->pool, ll[0] ? ll : "HTTP/0.9"); + + if (ll[0]) { + pro = ll; + len = ap_strlen(ll); + } else { + pro = "HTTP/0.9"; + len = 8; + } + r->protocol = ap_pstrndup(r->pool, pro, len); - if (2 == sscanf(r->protocol, "HTTP/%u.%u", &major, &minor) + /* avoid sscanf in the common case */ + if (len == 8 && + pro[0] == 'H' && pro[1] == 'T' && pro[2] == 'T' && pro[3] == 'P' && + pro[4] == '/' && ap_isdigit(pro[5]) && pro[6] == '.' && + ap_isdigit(pro[7])) { + r->proto_num = HTTP_VERSION(pro[5] - '0', pro[7] - '0'); + } else if (2 == sscanf(r->protocol, "HTTP/%u.%u", &major, &minor) && minor < HTTP_VERSION(1,0)) /* don't allow HTTP/0.1000 */ r->proto_num = HTTP_VERSION(major, minor); else @@ -931,6 +1084,171 @@ return 1; } +/* + * Parse the request options as quickly as possible. Requires state + * from quickly_read_request_line(). Handles only the fast cases, and + * detects and defers the slow ones to the regular parser + * get_mime_headers(). + */ +static int +quickly_get_mime_headers(request_rec *r) +{ + int ok, nh, mh; + table *headers; + char *hp, *ep; + int remain; +#define NQHEADERS 16 /* see big comment below */ + struct qheader { + const char *name; + const char *value; + } qheaders[NQHEADERS]; + struct qheader *nqp, *qp; + +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +/* + * Prefetch cache lines of the request headers so parsing can proceed + * without delay. The lines are prefetched for writing because parsing + * involves modification. Attempts to prefetch bogus addresses will + * simply have no effect and will raise no exceptions. + */ +# pragma prefetch_manual = 1 +# pragma prefetch_ref = r->rqhdr[0], kind = wr +#endif + + ok = 0; + + nh = ap_table_elts(r->headers_in)->nelts; + mh = r->server->limit_req_fields; + if (mh <= 0) + mh = 65536; /* essentially infinite */ + headers = NULL; + + hp = r->rqhdr; + ep = hp + r->rqhdr_len; + r->rqhdr_len = 0; /* never re-parse */ + + nqp = qheaders; + + while (hp < ep && nh < mh) { + char *name, *value; + +#if defined(IRIX) && _MIPS_SIM != _ABIO32 && CACHE_ALIGNMENT > 0 +/* + * Unfortunately the compiler doesn't yet allow "prefetch_ref = + * hp[CACHE_ALIGNMENT]" so hard-code 128. + */ +# pragma prefetch_ref = hp[/*CACHE_ALIGNMENT*/ 128], kind = wr +# pragma prefetch_ref = hp[/*CACHE_ALIGNMENT * 2*/ 256], kind = wr +#endif + + name = hp; + + /* find a : (end of name) */ + value = name; + while (value < ep && *value != ':' && !ap_isspace(*value)) + value++; + + /* complete name? */ + if (value > name && value < ep && *value == ':') { + *value = 0; /* null-terminate name */ + + /* skip white space */ + do + value++; + while (value < ep && (*value == ' ' || *value == '\t')); + + /* find end of value */ + hp = value; + while (hp < ep && *hp != '\n') + hp++; + + /* + * complete value? beware leading-space continuation lines, + * or the threat of one if we're right at the end of rqbuf. + * (there must be at least one more byte left and it must + * not be a leading space) + */ + if (hp + 1 < ep && hp[1] != ' ' && hp[1] != '\t') { + hp[-(hp[-1] == '\r')] = 0; /* null-terminate value */ + hp++; +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +# pragma prefetch_ref = hp[0], kind = wr +#endif + + if (nqp < &qheaders[NQHEADERS]) { + /* still room in quick header array */ + nqp->name = name; + nqp->value = value; + nqp++; + } else if (headers) { + /* insert into established table */ + ap_table_addn(headers, name, value); + } else { + /* + * More headers than fit in the quick header array. + * Make a table for them. + */ + headers = ap_make_table(r->pool, NQHEADERS * 2); + for (qp = qheaders; qp < nqp; qp++) + ap_table_addn(headers, qp->name, qp->value); + ap_table_addn(headers, name, value); + } + + nh++; + } else { + hp = name; + do + name++; + while (*name); + *name = ':'; /* restore : for copy below */ + break; + } + } else { + if (hp < ep && *hp == '\r') + hp++; + if (hp < ep && *hp == '\n') { + hp++; + ok = 1; /* end of header section */ + } + break; + } + } + + /* + * My experiments on a variety of systems show that when all the + * header names are unique (no duplicates), calling + * ap_table_mergen() to insert each header is faster than calling + * ap_overlap_tables() once, up to around 16 headers. When there + * are more than about 16 headers, ap_overlap_tables() is faster. + * When there are some duplicate headers, using ap_table_mergen() + * almost always is faster no matter how many headers are inserted. + * All the benchmarks and browsers I know issue unique request + * headers so I set NQHEADERS to 16 to optimize: When there are at + * most NQHEADERS headers this function calls ap_table_mergen() once + * for each header, and when there are more it calls + * ap_overlap_tables() once. (But why, you might ask, use + * ap_table_mergen() instead of ap_table_addn() if all the headers + * are unique? Because we don't know apriori that they are unique, + * just that they usually are.) + */ + if (headers) + ap_overlap_tables(r->headers_in, headers, AP_OVERLAP_TABLES_MERGE); + else + for (qp = qheaders; qp < nqp; qp++) + ap_table_mergen(r->headers_in, qp->name, qp->value); + + remain = (int) (ep - hp); + if (remain > 0) { + BUFF *fb = r->connection->client; + + ap_assert(&fb->inptr[remain] <= &fb->inbase[fb->bufsiz]); + memcpy(fb->inptr, hp, remain); + fb->incnt += remain; + } + + return ok; +} + static void get_mime_headers(request_rec *r) { char field[DEFAULT_LIMIT_REQUEST_FIELDSIZE + 2]; /* getline's two extra */ @@ -938,7 +1256,7 @@ char *value; char *copy; int len; - unsigned int fields_read = 0; + unsigned int fields_read = ap_table_elts(r->headers_in)->nelts; table *tmp_headers; /* We'll use ap_overlap_tables later to merge these into r->headers_in. */ @@ -1020,13 +1338,9 @@ r->request_config = ap_create_request_config(r->pool); r->per_dir_config = r->server->lookup_defaults; - r->sent_bodyct = 0; /* bytect isn't for body */ - - r->read_length = 0; r->read_body = REQUEST_NO_BODY; r->status = HTTP_REQUEST_TIME_OUT; /* Until we get a request */ - r->the_request = NULL; #ifdef CHARSET_EBCDIC ap_bsetflag(r->connection->client, B_ASCII2EBCDIC|B_EBCDIC2ASCII, 1); @@ -1035,7 +1349,10 @@ /* Get the request... */ ap_keepalive_timeout("read request line", r); - if (!read_request_line(r)) { + if (!quickly_read_request_line(r) && !read_request_line(r)) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif ap_kill_timeout(r); if (r->status == HTTP_REQUEST_URI_TOO_LARGE) { @@ -1049,9 +1366,17 @@ } if (!r->assbackwards) { ap_hard_timeout("read request headers", r); - get_mime_headers(r); + if (!quickly_get_mime_headers(r)) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif + get_mime_headers(r); + } ap_kill_timeout(r); if (r->status != HTTP_REQUEST_TIME_OUT) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, "request failed: error reading the headers"); ap_send_error_response(r, 0); @@ -1094,6 +1419,9 @@ if ((!r->hostname && (r->proto_num >= HTTP_VERSION(1,1))) || ((r->proto_num == HTTP_VERSION(1,1)) && !ap_table_get(r->headers_in, "Host"))) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif /* * Client sent us an HTTP/1.1 or later request without telling us the * hostname, either with a full URL or a Host: header. We therefore @@ -1107,6 +1435,9 @@ "(see RFC2068 section 9, and 14.23): %s", r->uri); } if (r->status != HTTP_OK) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif ap_send_error_response(r, 0); ap_log_transaction(r); return r; @@ -1113,6 +1444,9 @@ } if (((expect = ap_table_get(r->headers_in, "Expect")) != NULL) && (expect[0] != '\0')) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif /* * The Expect header field was added to HTTP/1.1 after RFC 2068 * as a means to signal when a 100 response is desired and, @@ -1135,6 +1469,9 @@ } if ((access_status = ap_run_post_read_request(r))) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif ap_die(access_status, r); ap_log_transaction(r); return NULL; @@ -1153,6 +1490,7 @@ void ap_set_sub_req_protocol(request_rec *rnew, const request_rec *r) { rnew->the_request = r->the_request; /* Keep original request-line */ + rnew->the_request_len = r->the_request_len; rnew->assbackwards = 1; /* Don't send headers from this. */ rnew->no_local_copy = 1; /* Don't try to send USE_LOCAL_COPY for a @@ -1211,7 +1549,7 @@ r->proxyreq == STD_PROXY ? "Proxy-Authenticate" : "WWW-Authenticate", ap_psprintf(r->pool, "Digest realm=\"%s\", nonce=\"%lu\"", - ap_auth_name(r), r->request_time)); + ap_auth_name(r), (unsigned long) r->request_time)); } API_EXPORT(int) ap_get_basic_auth_pw(request_rec *r, const char **pw) @@ -1381,7 +1719,15 @@ API_EXPORT(void) ap_basic_http_header(request_rec *r) { + ap_tee_basic_http_header(r, NULL, NULL); +} + +API_EXPORT(void) ap_tee_basic_http_header(request_rec *r, + char *basic_header_copy, size_t *basic_header_copy_remain) +{ char *protocol; + const char *cp; + int len; if (r->assbackwards) return; @@ -1408,10 +1754,44 @@ /* Output the HTTP/1.x Status-Line and the Date and Server fields */ + /* + * The whole basic_header_copy* thing is a hack to include the basic + * http headers in the QSC entry for mod_mmap_static. Everything + * else uses the headers_out table, but noooo, this function has to + * emit headers directly, and since they may be flushed at any point + * we must copy them aside for later insertion into the QSC. + */ ap_rvputs(r, protocol, " ", r->status_line, CRLF, NULL); - - ap_send_header_field(r, "Date", ap_gm_timestr_822(r->pool, r->request_time)); - ap_send_header_field(r, "Server", ap_get_server_version()); + if (basic_header_copy) { + len = ap_snprintf(basic_header_copy, *basic_header_copy_remain, + "%s %s" CRLF, protocol, r->status_line); + basic_header_copy += len; + *basic_header_copy_remain -= len; + } + + cp = ap_gm_timestr_822(r->pool, r->request_time); + ap_send_header_field(r, "Date", cp); + if (basic_header_copy) { + len = ap_snprintf(basic_header_copy, *basic_header_copy_remain, + "Date: %s" CRLF, cp); + basic_header_copy += len; + *basic_header_copy_remain -= len; + } + + cp = ap_get_server_version(); + ap_send_header_field(r, "Server", cp); + if (basic_header_copy) { + len = ap_snprintf(basic_header_copy, *basic_header_copy_remain, + "Server: %s" CRLF, cp); + basic_header_copy += len; + *basic_header_copy_remain -= len; + } + /* + * NOTE: if you change the basic header such that the Server + * response-header is not at the end or its value is other than + * ap_get_server_version(), update the most-likely-place probe in + * qsc_insert_request(). + */ ap_table_unset(r->headers_out, "Date"); /* Avoid bogosity */ ap_table_unset(r->headers_out, "Server"); @@ -1439,7 +1819,7 @@ */ static void terminate_header(BUFF *client) { - long int bs; + ap_int32 bs; ap_bgetopt(client, BO_BYTECT, &bs); if (bs >= 255 && bs <= 257) @@ -1502,7 +1882,7 @@ int ap_send_http_options(request_rec *r) { - const long int zero = 0L; + const ap_int32 zero = 0; if (r->assbackwards) return DECLINED; @@ -1547,6 +1927,7 @@ * and recombine multiple Vary fields, though it is generic to any field * consisting of comma/space-separated tokens. */ +/*ARGSUSED1*/ static int uniq_field_values(void *d, const char *key, const char *val) { array_header *values; @@ -1621,8 +2002,14 @@ API_EXPORT(void) ap_send_http_header(request_rec *r) { + ap_tee_http_header(r, NULL, NULL); +} + +API_EXPORT(void) ap_tee_http_header(request_rec *r, char *basic_header_copy, + size_t *basic_header_copy_remain) +{ int i; - const long int zero = 0L; + const ap_int32 zero = 0; if (r->assbackwards) { if (!r->main) @@ -1656,7 +2043,7 @@ ap_hard_timeout("send headers", r); - ap_basic_http_header(r); + ap_tee_basic_http_header(r, basic_header_copy, basic_header_copy_remain); #ifdef CHARSET_EBCDIC { PUSH_EBCDIC_OUTPUTCONVERSION_STATE(r->connection->client, 1); @@ -1788,7 +2175,7 @@ { const char *tenc = ap_table_get(r->headers_in, "Transfer-Encoding"); const char *lenp = ap_table_get(r->headers_in, "Content-Length"); - unsigned long max_body; + ap_uint32 max_body; r->read_body = read_policy; r->read_chunked = 0; @@ -1819,7 +2206,7 @@ return HTTP_BAD_REQUEST; } - r->remaining = atol(lenp); + r->remaining = ap_atol(lenp); } if ((r->read_body == REQUEST_NO_BODY) && @@ -1833,7 +2220,7 @@ if (max_body && (r->remaining > max_body)) { ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, "Request content-length of %s is larger than the configured " - "limit of %lu", lenp, max_body); + "limit of %lu", lenp, (unsigned long) max_body); return HTTP_REQUEST_ENTITY_TOO_LARGE; } @@ -1874,9 +2261,9 @@ return 1; } -static long get_chunk_size(char *b) +static ap_int32 get_chunk_size(char *b) { - long chunksize = 0; + ap_int32 chunksize = 0; while (ap_isxdigit(*b)) { int xvalue = 0; @@ -1908,12 +2295,12 @@ * hold a chunk-size line, including any extensions. For now, we'll leave * that to the caller, at least until we can come up with a better solution. */ -API_EXPORT(long) ap_get_client_block(request_rec *r, char *buffer, int bufsiz) +API_EXPORT(ap_int32) ap_get_client_block(request_rec *r, char *buffer, int bufsiz) { int c; - long len_read, len_to_read; - long chunk_start = 0; - unsigned long max_body; + ap_int32 len_read, len_to_read; + ap_int32 chunk_start = 0; + ap_uint32 max_body; if (!r->read_chunked) { /* Content-length read */ len_to_read = (r->remaining > bufsiz) ? bufsiz : r->remaining; @@ -1947,7 +2334,7 @@ if (max_body && (r->read_length > max_body)) { ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, "Chunked request body is larger than the configured limit of %lu", - max_body); + (unsigned long) max_body); r->connection->keepalive = -1; return -1; } @@ -1966,7 +2353,7 @@ if (len_to_read == 0) { /* Last chunk indicated, get footers */ if (r->read_body == REQUEST_CHUNKED_DECHUNK) { get_mime_headers(r); - ap_snprintf(buffer, bufsiz, "%ld", r->read_length); + ap_snprintf(buffer, bufsiz, "%ld", (long) r->read_length); ap_table_unset(r->headers_in, "Transfer-Encoding"); ap_table_setn(r->headers_in, "Content-Length", ap_pstrdup(r->pool, buffer)); @@ -2109,18 +2496,11 @@ return OK; } -/* - * Send the body of a response to the client. - */ -API_EXPORT(long) ap_send_fd(FILE *f, request_rec *r) -{ - return ap_send_fd_length(f, r, -1); -} - -API_EXPORT(long) ap_send_fd_length(FILE *f, request_rec *r, long length) +static ap_int32 +send_fd_length_internal(FILE *f, request_rec *r, ap_int32 length, + char *buf, ap_int32 bufsize) { - char buf[IOBUFSIZE]; - long total_bytes_sent = 0; + ap_int32 total_bytes_sent = 0; register int n, w, o, len; if (length == 0) @@ -2129,12 +2509,12 @@ ap_soft_timeout("send body", r); while (!r->connection->aborted) { - if ((length > 0) && (total_bytes_sent + IOBUFSIZE) > length) + if ((length > 0) && (total_bytes_sent + bufsize) > length) len = length - total_bytes_sent; else - len = IOBUFSIZE; + len = bufsize; - while ((n = fread(buf, sizeof(char), len, f)) < 1 + while ((n = (int) fread(buf, sizeof(char), len, f)) < 1 && ferror(f) && errno == EINTR && !r->connection->aborted) continue; @@ -2171,15 +2551,75 @@ /* * Send the body of a response to the client. */ -API_EXPORT(long) ap_send_fb(BUFF *fb, request_rec *r) +API_EXPORT(ap_int32) ap_send_fd(FILE *f, request_rec *r) +{ + char buf[IOBUFSIZE]; + return send_fd_length_internal(f, r, -1, buf, sizeof buf); +} + +API_EXPORT(ap_int32) ap_send_fd_length(FILE *f, request_rec *r, ap_int32 length) +{ + char buf[IOBUFSIZE]; + return send_fd_length_internal(f, r, length, buf, sizeof buf); +} + +#ifdef USE_DIRECT_IO + +/* + * Maximum alignment and buffer size are hard-coded to avoid dynamic + * memory allocation on each transmission. These must be powers of two + * greater than zero. + */ +#ifndef MAX_DIRECT_ALIGN +#define MAX_DIRECT_ALIGN (4 * 1024) +#endif + +#ifndef MAX_DIRECT_BUFSIZE +#define MAX_DIRECT_BUFSIZE IOBUFSIZE +#endif + +API_EXPORT(ap_int32) ap_send_fd_direct(FILE *f, request_rec *r, + const struct dioattr *da) +{ + char buf[MAX_DIRECT_BUFSIZE + MAX_DIRECT_ALIGN - 1]; + char *abuf = (char *) (((ap_ptr) buf + MAX_DIRECT_ALIGN - 1) & + ~(MAX_DIRECT_ALIGN - 1)); + + /* + * Check direct I/O restrictions. If they're within range, enable + * direct I/O for this file. + */ + if (da->d_mem <= MAX_DIRECT_ALIGN && + da->d_miniosz <= MAX_DIRECT_ALIGN && + da->d_miniosz <= MAX_DIRECT_BUFSIZE && + da->d_maxiosz >= MAX_DIRECT_BUFSIZE) { + if (fcntl(fileno(f), F_SETFL, FDIRECT) != 0) + ap_log_rerror(APLOG_MARK, APLOG_WARNING, r, + "fcntl(F_SETFL, FDIRECT) failed on %s; using non-direct I/O", + r->filename); + } else + ap_log_rerror(APLOG_MARK, APLOG_WARNING, r, + "%s exceeds direct I/O parameters; mem %ld miniosz %ld maxiosz %ld, MAX_DIRECT_ALIGN %ld MAX_DIRECT_BUFSIZE %ld", + r->filename, + (long) da->d_mem, (long) da->d_miniosz, (long) da->d_maxiosz, + (long) MAX_DIRECT_ALIGN, (long) MAX_DIRECT_BUFSIZE); + + return send_fd_length_internal(f, r, -1, abuf, MAX_DIRECT_BUFSIZE); +} +#endif + +/* + * Send the body of a response to the client. + */ +API_EXPORT(ap_int32) ap_send_fb(BUFF *fb, request_rec *r) { return ap_send_fb_length(fb, r, -1); } -API_EXPORT(long) ap_send_fb_length(BUFF *fb, request_rec *r, long length) +API_EXPORT(ap_int32) ap_send_fb_length(BUFF *fb, request_rec *r, ap_int32 length) { char buf[IOBUFSIZE]; - long total_bytes_sent = 0; + ap_int32 total_bytes_sent = 0; register int n, w, o, len, fd; fd_set fds; @@ -2294,9 +2734,6 @@ * To take advantage of zero-copy TCP under Solaris 2.6 this should be a * multiple of 16k. (And you need a SunATM2.0 network card.) */ -#ifndef MMAP_SEGMENT_SIZE -#define MMAP_SEGMENT_SIZE 32768 -#endif /* send data from an in-memory buffer */ API_EXPORT(size_t) ap_send_mmap(void *mm, request_rec *r, size_t offset, @@ -2316,7 +2753,7 @@ n = MMAP_SEGMENT_SIZE; } else { - n = length - offset; + n = (int) (length - offset); } while (n && !r->connection->aborted) { @@ -2344,6 +2781,36 @@ return total_bytes_sent; } +API_EXPORT(size_t) +ap_send_iovec(request_rec *r, struct iovec *iov, int iovcnt) +{ + size_t sent; + + sent = 0; + ap_soft_timeout("send iovec", r); + if (!r->connection->aborted) { + int w; + + /* + * No need to loop. ap_bwritev writes it all unless there was + * an error. + */ + w = ap_bwritev(r->connection->client, iov, iovcnt); + if (w > 0) + sent += w; + else { + ap_log_rerror(APLOG_MARK, APLOG_INFO, r, + "client stopped connection before send iovec completed"); + ap_bsetflag(r->connection->client, B_EOUT, 1); + r->connection->aborted = 1; + } + } + ap_kill_timeout(r); + SET_BYTES_SENT(r); + + return sent; +} + API_EXPORT(int) ap_rputc(int c, request_rec *r) { if (r->connection->aborted) @@ -2404,6 +2871,7 @@ return n; } +/*PRINTFLIKE2*/ API_EXPORT(int) ap_vrprintf(request_rec *r, const char *fmt, va_list ap) { int n; @@ -2426,6 +2894,7 @@ return n; } +/*PRINTFLIKE2*/ API_EXPORT(int) ap_rprintf(request_rec *r, const char *fmt,...) { va_list vlist; @@ -2466,7 +2935,7 @@ x = va_arg(args, const char *); if (x == NULL) break; - j = strlen(x); + j = ap_strlen(x); i = ap_bwrite(fb, x, j); if (i != j) { va_end(args); diff -Naur apache_1.3.12/src/main/http_request.c-orig apache_1.3.12/src/main/http_request.c --- apache_1.3.12/src/main/http_request.c-orig Tue Jan 11 06:13:41 2000 +++ apache_1.3.12/src/main/http_request.c Wed Feb 9 17:34:31 2000 @@ -415,7 +415,7 @@ return res; } - test_filename_len = strlen(test_filename); + test_filename_len = ap_strlen(test_filename); if (test_filename[test_filename_len - 1] == '/') --num_dirs; @@ -607,7 +607,7 @@ ap_get_module_config(entry_config, &core_module); entry_url = entry_core->d; - len = strlen(entry_url); + len = ap_strlen(entry_url); this_conf = NULL; @@ -1225,10 +1225,23 @@ { int old_stat; - if (ap_extended_status) + if (ap_extended_status) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif ap_time_process_request(r->connection->child_num, START_PREQUEST); + } - process_request_internal(r); +#ifdef USE_QSC + if (!qsc_process_request(r)) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif +#endif + process_request_internal(r); +#ifdef USE_QSC + } +#endif old_stat = ap_update_child_status(r->connection->child_num, SERVER_BUSY_LOG, r); @@ -1244,8 +1257,12 @@ ap_log_transaction(r); (void) ap_update_child_status(r->connection->child_num, old_stat, r); - if (ap_extended_status) + if (ap_extended_status) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif ap_time_process_request(r->connection->child_num, STOP_PREQUEST); + } } static table *rename_original_env(pool *p, table *t) @@ -1292,6 +1309,7 @@ /* Inherit the rest of the protocol info... */ new->the_request = r->the_request; + new->the_request_len = r->the_request_len; new->allowed = r->allowed; diff -Naur apache_1.3.12/src/main/http_vhost.c-orig apache_1.3.12/src/main/http_vhost.c --- apache_1.3.12/src/main/http_vhost.c-orig Sun Jan 16 12:59:59 2000 +++ apache_1.3.12/src/main/http_vhost.c Wed Mar 1 14:59:05 2000 @@ -148,6 +148,7 @@ /* called at the beginning of the config */ +/*ARGSUSED0*/ void ap_init_vhost_config(pool *p) { memset(iphash_table, 0, sizeof(iphash_table)); @@ -168,7 +169,7 @@ unsigned port) { struct hostent *hep; - unsigned long my_addr; + ap_uint32 my_addr; server_addr_rec *sar; char *t; int i, is_an_ip_addr; @@ -267,6 +268,7 @@ } +/*ARGSUSED1*/ const char *ap_set_name_virtual_host (cmd_parms *cmd, void *dummy, char *arg) { /* use whatever port the main server has at this point */ @@ -605,11 +607,12 @@ else { /* again, what can we do? They didn't specify a ServerName, and their DNS isn't working. -djg */ + char nbuf[16]; ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, main_s, "Failed to resolve server name " "for %s (check DNS) -- or specify an explicit " "ServerName", - inet_ntoa(s->addrs->host_addr)); + ap_inet_ntoa(s->addrs->host_addr, nbuf, NULL)); s->server_hostname = ap_pstrdup(p, "bogus_host_without_reverse_dns"); } @@ -657,41 +660,53 @@ * run-time vhost matching functions */ -/* Lowercase and remove any trailing dot and/or :port from the hostname, +/* Remove any trailing dot and/or :port from the hostname, * and check that it is sane. */ static void fix_hostname(request_rec *r) { - char *host = ap_palloc(r->pool, strlen(r->hostname) + 1); + /* + * Assume it is sane and pay the expense of rewriting it only if it + * isn't. + */ + const char *host = r->hostname; const char *src; - char *dst; - /* check and copy the host part */ - src = r->hostname; - dst = host; - while (*src) { + /* check the host part */ + for (src = host; *src; src++) { if (!ap_isalnum(*src) && *src != '.' && *src != '-') { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif if (*src == ':') break; else goto bad; - } else { - *dst++ = *src++; } } + + /* cut off trailing . if present */ + if (src > host && src[-1] == '.') { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif + host = ap_pstrndup(r->pool, host, src - host - 1); + } else if (*src == ':') + host = ap_pstrndup(r->pool, host, src - host); + /* check the port part */ - if (*src++ == ':') { - while (*src) { - if (!ap_isdigit(*src++)) { + if (*src == ':') { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif + while (*++src) { + if (!ap_isdigit(*src)) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif goto bad; } } - } - /* strip trailing gubbins */ - if (dst > host && dst[-1] == '.') { - dst[-1] = '\0'; - } else { - dst[0] = '\0'; } r->hostname = host; diff -Naur apache_1.3.12/src/main/qsc.c-orig apache_1.3.12/src/main/qsc.c --- apache_1.3.12/src/main/qsc.c-orig +++ apache_1.3.12/src/main/qsc.c Fri Mar 3 10:58:37 2000 @@ -0,0 +1,1372 @@ +/* + * Copyright (c) 1999-2000 Silicon Graphics, Inc. All rights reserved. + */ + +/* ==================================================================== + * Copyright (c) 1999-2000 The Apache Group. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the Apache Group + * for use in the Apache HTTP server project (http://www.apache.org/)." + * + * 4. The names "Apache Server" and "Apache Group" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * apache@apache.org. + * + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names without prior written + * permission of the Apache Group. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the Apache Group + * for use in the Apache HTTP server project (http://www.apache.org/)." + * + * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + * + * For more information on the Apache Group and the Apache HTTP server + * project, please see . + * + */ + +/* + * QSC - Quick Shortcut Cache (or Quick Static-content Cache). + * Tightly integrated with mod_mmap_static. + * Mike Abbott - mja@sgi.com + * Accelerating Apache Project - http://oss.sgi.com/projects/apache/ + * + * Cache the response to a request for a static page, so that subsequent + * requests for the same page will bypass all the computation that is + * identical every time that page is requested. Caches the HTTP headers + * and body together for quick response with a single writev(). Hashes + * URIs for fast lookup. See htdocs/manual/qsc.html. + */ + +#include "httpd.h" + +#ifdef USE_QSC + +#include "http_log.h" +#include "http_config.h" +#include "http_conf_globals.h" +#include "http_protocol.h" +#include "http_main.h" +#include "scoreboard.h" + +/* + * Number of hash buckets. Larger values shorten chain lengths and + * increase performance. Default value is arbitrary. + */ +#ifndef QSC_HASH_SIZE +#define QSC_HASH_SIZE 128 +#endif + +/* + * Number of qsc_status() hash chain length histogram buckets. Default + * value is arbitrary. + */ +#ifndef QSC_HIST_SIZE +#define QSC_HIST_SIZE 5 +#endif + +/* + * Total size of shared data, in bytes. The QSC will not use more than + * this much memory. Default value is arbitrary. + */ +#ifndef QSC_MAX_SIZE +#define QSC_MAX_SIZE (4 * 1024 * 1024) +#endif + +/* + * Granularity of memory allocation in bytes. Must be power of two at + * least as large as max(sizeof (long), sizeof (void *)). + */ +#ifndef QSC_GRAIN +union qsc_granule { + size_t s; + void *c; + ap_atomic a; +}; +#define QSC_GRAIN sizeof (union qsc_granule) +#endif + +/* + * Granularity of headers, for processor cache alignment, or 0 for none. + * The Server response header is padded with spaces to force alignment. + */ +#ifndef QSC_HEADER_GRAIN +#define QSC_HEADER_GRAIN CACHE_ALIGNMENT +#endif + +#if QSC_HEADER_GRAIN > 0 +/* + * Maximum single allocation by qsc_malloc() or qsc_hmalloc(), in bytes, + * to avoid overlap race. + */ +# ifndef QSC_MAX_ALLOC +# define QSC_MAX_ALLOC 512 +# endif + +/* + * Minimum separation of upward-growing nonaligned allocations and + * downward-growing aligned allocations, in bytes, to avoid overlap + * race. Should be a small multiple of QSC_MAX_ALLOC for safety. + */ +# ifndef QSC_RED_ZONE +# define QSC_RED_ZONE 4096 +# endif +#endif + +#ifdef QSC_DEBUG +#define QSC_ASSERT(x) ap_assert(x) +#else +#define QSC_ASSERT(x) /* nothing */ +#endif + +/* Round x up to the next a */ +#define QSC_ALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1)) + +/* + * Atomic compare-and-swap function. Returns nonzero on success. + */ +#ifdef IRIX +# if _MIPS_SIM == _ABIO32 +# if IRIX < 65 +/* + * SGI's ucode (o32 ABI) compilers lack an intrinsic so use _r4k_cas + * from libc. This won't work if you're using an R3000 or earlier, + * which lack load-linked/store-conditional instructions; you'll have to + * use uscas() after calling usinit(). + */ +extern int _r4k_cas(unsigned long *, unsigned long, unsigned long); +# define qsc_cas(p, oldval, newval) _r4k_cas(p, oldval, newval) +# else +/* + * Starting with Irix 6.5 _r4k_cas is hidden in libc so we can't use it. + * Either build -n32 or -64, use uscas() after calling usinit(), or + * don't use the QSC. + */ +# error "build -n32 or -64 on Irix 6.5 and above" +# endif +# else +/* + * Use SGI's MIPSpro (n32 and 64-bit ABIs) compiler intrinsic + * __compare_and_swap(). + */ +# define qsc_cas(p, oldval, newval) __compare_and_swap(p, oldval, newval) +# endif +#elif defined(__GNUC__) && __GNUC__ >= 2 && \ + (defined(__i486__) || defined(__i586__) || defined(__i686__) || \ + defined(__pentium__) || defined(__pentiumpro__)) +/* + * Use asm statement copied from Linux libpthread's __compare_and_swap(). + */ +static ap_inline int +qsc_cas(ap_atomic *p, ap_atomic oldval, ap_atomic newval) +{ + char ret; + ap_atomic readval; + + __asm__ __volatile__ ("lock; cmpxchgl %3, %1; sete %0" + : "=q" (ret), "=m" (*p), "=a" (readval) + : "r" (newval), "m" (*p), "a" (oldval)); + return ret; +} +#else +# error "need atomic compare-and-swap function" +#endif + +/* Hash table entry */ +struct qsc_entry { + struct qsc_entry *next; /* in hash bucket */ + char *uri; /* URI of cache entry */ + const server_rec *server; /* vhost serving entry */ + void *kaheaders; /* keep-alive HTTP response headers */ + size_t nkaheaderbytes; /* length of kaheaders */ + void *ccheaders; /* non-ka HTTP response headers */ + size_t nccheaderbytes; /* length of ccheaders */ + void *body; /* mmap_static response body */ + size_t nbodybytes; /* length of body */ + const char *nbodybytesstr; /* sprintf("%ld", (long) nbodybytes) */ +#ifdef QSC_DEBUG + const char *filename; /* name of mapped file */ +#endif +}; + +/* Counters */ +struct qsc_stats { + ap_atomic nfailures; /* number of failed insertions */ + ap_atomic nucreq; /* number of uncachable requests */ + ap_atomic nucres; /* number of uncachable responses */ + ap_atomic nhits; /* number of successful hash table lookups */ + ap_atomic nmisses; /* number of unsuccessful hash table lookups */ + ap_atomic nresets; /* number of resets */ +}; + +/* All QSC data */ +struct qsc { + struct qsc_stats stats; + struct qsc_entry *hash_table[QSC_HASH_SIZE]; + ap_atomic alloc_head; +#if QSC_HEADER_GRAIN > 0 + ap_atomic alloc_aligned; +#endif +}; + +static struct qsc *qsc; /* root of qsc data shared by all */ + +/* + * Add v to *p atomically and return the original value of *p. + */ +static ap_inline ap_atomic +qsc_atomic_add(ap_atomic *p, ap_atomic v) +{ + ap_atomic r; + + do + r = *p; + while (!qsc_cas(p, r, r + v)); + + return r; +} + +/* + * Atomically insert the new entry into the hash bucket at head and return + * the old value of *head. + */ +static ap_inline struct qsc_entry * +qsc_atomic_insert(struct qsc_entry **head, struct qsc_entry *new) +{ + do + new->next = *head; + while (!qsc_cas((ap_atomic *) head, (ap_atomic) new->next, + (ap_atomic) new)); + + return new->next; +} + +/* + * Initialize or reset the shared-memory allocator. + */ +static void +qsc_init_malloc(void) +{ + qsc->alloc_head = QSC_ALIGN((ap_atomic) (qsc + 1), QSC_GRAIN); +#if QSC_HEADER_GRAIN > 0 + qsc->alloc_aligned = ((ap_atomic) qsc + QSC_MAX_SIZE) & + ~(QSC_HEADER_GRAIN - 1); + if (qsc->alloc_aligned < qsc->alloc_head) + qsc->alloc_aligned = qsc->alloc_head; +#endif +} + +/* + * Allocate nbytes from shared memory. + */ +static void * +qsc_malloc(size_t nbytes) +{ + ap_atomic r, n; + + nbytes = QSC_ALIGN(nbytes, QSC_GRAIN); +#if QSC_HEADER_GRAIN > 0 + QSC_ASSERT(qsc->alloc_head <= qsc->alloc_aligned); + if (nbytes <= QSC_MAX_ALLOC) { +#endif + do { + r = qsc->alloc_head; + n = r + nbytes; + if (n > +#if QSC_HEADER_GRAIN > 0 + qsc->alloc_aligned - QSC_RED_ZONE +#else + (ap_atomic) qsc + QSC_MAX_SIZE +#endif + ) { + r = 0; + break; + } + } while (!qsc_cas(&qsc->alloc_head, r, n)); +#if QSC_HEADER_GRAIN > 0 + } else + r = 0; +#endif + + return (void *) r; +} + +#if QSC_HEADER_GRAIN > 0 +/* + * Allocate nbytes from shared memory, aligned to a QSC_HEADER_GRAIN + * virtual address. nbytes must be similarly aligned. + */ +static void * +qsc_hmalloc(size_t nbytes) +{ + ap_atomic n; + + QSC_ASSERT((qsc->alloc_aligned & (QSC_HEADER_GRAIN - 1)) == 0); + QSC_ASSERT((nbytes & (QSC_HEADER_GRAIN - 1)) == 0); + QSC_ASSERT(qsc->alloc_head <= qsc->alloc_aligned); + + if (nbytes <= QSC_MAX_ALLOC) { + ap_atomic r; + + do { + r = qsc->alloc_aligned; + n = r - nbytes; + if (n < qsc->alloc_head + QSC_RED_ZONE) { + n = 0; + break; + } + } while (!qsc_cas(&qsc->alloc_aligned, r, n)); + } else + n = 0; + + return (void *) n; +} +#endif + +/* + * Free vp to shared memory. + */ +/*ARGSUSED0*/ +static void +qsc_free(void *vp) +{ + /* no-op */ +} + +/* + * Return the number of bytes of shared memory in use. + */ +static ap_atomic +qsc_inuse(void) +{ + return qsc->alloc_head - (ap_atomic) qsc +#if QSC_HEADER_GRAIN > 0 + + ((ap_atomic) qsc + QSC_MAX_SIZE) - qsc->alloc_aligned + QSC_RED_ZONE +#endif + ; +} + +/* + * Hash the URI into an integer. + */ +static unsigned long +qsc_hash_uri(const char *uri) +{ + unsigned long hash = 0; + + while (*uri) + hash = (hash << 4) - hash + *uri++; /* hash = hash * 15 + *uri++ */ + + return hash; +} + +/* + * Return the hash table entry for the URI and vhost, or NULL if none. + */ +static struct qsc_entry * +qsc_lookup_uri(const char *uri, const server_rec *server) +{ + struct qsc_entry *ep; + + ep = qsc->hash_table[qsc_hash_uri(uri) % QSC_HASH_SIZE]; + while (ep && (ep->server != server || strcmp(ep->uri, uri))) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif + ep = ep->next; + } + + /* printf("%d: qsc_lookup_uri(%s, 0x%08x) -> 0x%08x\n", getpid(), uri, server, ep); */ + + return ep; +} + +/* + * Insert a new hash table entry for the URI and vhost and return it, or + * NULL if not possible. + */ +static struct qsc_entry * +qsc_insert_uri(const char *uri, const server_rec *server) +{ + struct qsc_entry *nep; + + nep = (struct qsc_entry *) qsc_malloc(sizeof *nep); + if (nep) { + size_t nb; + + nep->next = NULL; + + nb = strlen(uri) + 1; + nep->uri = (char *) qsc_malloc(nb); + if (nep->uri) { + memcpy(nep->uri, uri, nb); + nep->server = server; + + /* + * insert it even if some other thread already did; + * suffer an occasional duplicate entry rather than + * have to spin-lock the table + */ + qsc_atomic_insert(&qsc->hash_table[qsc_hash_uri(uri) % + QSC_HASH_SIZE], nep); + } else { + qsc_free(nep); + nep = NULL; + } + } + + /* printf("%d: qsc_insert_uri(%s, 0x%08x) -> 0x%08x\n", getpid(), uri, server, nep); */ + + return nep; +} + +/* + * Clear out the shared QSC global data. Does not destroy it, just + * clears it. + */ +/*ARGSUSED0*/ +static void +qsc_cleanup(void *junk) +{ + ap_atomic n; + + /* + * No locking here because this is only ever called while the server + * is single-threaded (single-processed, whatever). + */ + + n = qsc->stats.nresets; + memset(qsc, 0, sizeof *qsc); + qsc->stats.nresets = n + 1; + + qsc_init_malloc(); +} + +/* + * Increment the insertion-failure counter and log an error if this is + * the first failure. + */ +static void +qsc_failure(void) +{ + if (qsc_atomic_add(&qsc->stats.nfailures, 1) == 0) + ap_log_error(APLOG_MARK, APLOG_WARNING | APLOG_NOERRNO, NULL, + "QSC is full; compile with larger QSC_MAX_SIZE and/or QSC_MAX_ALLOC to cache more"); +} + +/* + * Update a stats counter from a scoreboard counter. + */ +static void +qsc_counter_sync(ap_atomic *score_counter, ap_atomic *stats_counter) +{ + ap_atomic n; + + do + n = *score_counter; + while (n && !qsc_cas(score_counter, n, 0)); + + if (n) + qsc_atomic_add(stats_counter, n); +} + +/* + * Update the QSC stats counters from the individual scoreboard server + * counters. + */ +static void +qsc_sync_from_scoreboard(void) +{ + int i; + + for (i = 0; i < HARD_SERVER_LIMIT; i++) { + qsc_counter_sync(&ap_scoreboard_image->servers[i].qsc_nucreq, + &qsc->stats.nucreq); + qsc_counter_sync(&ap_scoreboard_image->servers[i].qsc_nucres, + &qsc->stats.nucres); + qsc_counter_sync(&ap_scoreboard_image->servers[i].qsc_nhits, + &qsc->stats.nhits); + qsc_counter_sync(&ap_scoreboard_image->servers[i].qsc_nmisses, + &qsc->stats.nmisses); + + /* + * This really only works with shared memory scoreboards. + * To make this work with a file-based scoreboard: + * - make qsc_counter_sync() return nonzero when it updates + * - if any call above returns nonzero, call put_scoreboard_info + * - but first make put_scoreboard_info global + * - call ap_sync_scoreboard_image() once before loop + * - pray two processes don't call this function at the same time + */ + } +} + +/* + * HTTP/1.1 header fields, from RFC 2068, and their effects on QSC operation. + * + * Header Field Name Type Cachability + * ----------------- ---- ------------ + * Accept request ignore, but should obey + * Accept-Charset request ignore, but should obey + * Accept-Encoding request ignore, but should obey + * Accept-Language request ignore, but should obey + * Accept-Ranges response ignore + * Age response ignore + * Allow entity ignore + * Alternates response ignore + * Authorization request uncachable by choice (could handle) + * Cache-Control general uncachable + * Connection general keep separate ka & !ka headers cached + * Content-Base entity ignore + * Content-Encoding entity ignore + * Content-Language entity ignore + * Content-Length entity ignore + * Content-Location entity ignore + * Content-MD5 entity ignore + * Content-Range entity uncachable by choice (could handle) + * Content-Type entity ignore + * Content-Version entity ignore + * Date general ignore + * Derived-From entity ignore + * ETag entity uncachable if weak, otherwise ignore + * Expires entity uncachable? (see 14.21) + * From request ignore + * Host request secondary cache key? (see 14.23) + * If-Modified-Since request uncachable by choice (could handle) + * If-Match request ignore: cached etags don't change + * If-None-Match request uncachable by choice (could handle) + * If-Range request uncachable by choice (could handle) + * If-Unmodified-Since request ignore: cached dates don't change + * Keep-Alive connection ignore + * Last-Modified entity ignore + * Link entity ignore + * Location response ignore + * Max-Forwards request ignore + * Pragma general uncachable if "no-cache", otherwise ignore + * Proxy-Authenticate response ignore + * Proxy-Authorization request ignore + * Public response ignore + * Range request uncachable by choice + * Referer request ignore + * Retry-After response ignore + * Server response ignore + * Transfer-Encoding general ignore + * Upgrade general ignore + * User-Agent request ignore + * Vary response uncachable + * Via general ignore + * Warning response ignore + * WWW-Authenticate response ignore + */ + +/* + * Return nonzero if the request is cachable, zero otherwise. + */ +static int +qsc_request_is_cachable(const request_rec *r) +{ + int cachable; + const array_header *ap; + int i; + + /* + * Requests are cachable if they: + * - are GET, and + * - are not explicitly marked no_cache, + * unless they contain one of the following headers: + * Authorization: ... + * QSC does not support authorization. + * Cache-Control: ... + * Most values limit cachability so assume all do, for speed. + * If-Modified-Since: ... + * If-None-Match: ... + * Both require extra processing. + * If-Range: ... + * QSC does not support ranges yet. + * Pragma: no-cache + * Explicit. + * Range: ... + * QSC does not support ranges yet. + */ + + cachable = r->method_number == M_GET && !r->header_only && !r->no_cache; + ap = ap_table_elts(r->headers_in); + for (i = 0; cachable && i < ap->nelts; i++) { + const table_entry *tep = &((table_entry *) ap->elts)[i]; + + switch (ap_tolower(tep->key[0])) { + case 'a': + if (!strcasecmp(tep->key, "authorization")) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif + cachable = 0; + } + break; + case 'c': + if (!strcasecmp(tep->key, "cache-control")) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif + cachable = 0; + } + break; + case 'i': + if (!strcasecmp(tep->key, "if-modified-since") || + !strcasecmp(tep->key, "if-none-match") || + !strcasecmp(tep->key, "if-range")) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif + cachable = 0; + } + break; + case 'p': + if (!strcasecmp(tep->key, "pragma") && + !strcasecmp(tep->val, "no-cache")) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif + cachable = 0; + } + break; + case 'r': + if (!strcasecmp(tep->key, "range")) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif + cachable = 0; + } + break; + } + } + + return cachable; +} + +/* + * Return nonzero if the response is cachable, zero otherwise. + */ +static int +qsc_response_is_cachable(const request_rec *r) +{ + int cachable; + const array_header *ap; + int i; + + /* + * Responses are cachable if they: + * - have status 200 OK, and + * - are not chunked, and + * - are not explicitly marked no_cache, + * unless they contain one of the following headers: + * Cache-Control: ... + * Most values limit cachability so assume all do, for speed. + * Content-Range: ... + * QSC does not support ranges yet. + * ETag: W/... (that is, strong etags are cachable, weaks ones are not) + * Cache only strong entity-tags. Weak etags will change to + * strong soon enough (see ap_set_etag()). + * Expires: ... + * QSC does not support removal or update of cache entries. + * Pragma: no-cache + * Explicit. + * Vary: ... + * Response depends on values other than URI, and QSC uses only + * the URI to look up cache entries. + */ + + cachable = r->status == HTTP_OK && !r->chunked && !r->no_cache; + ap = ap_table_elts(r->headers_out); + for (i = 0; cachable && i < ap->nelts; i++) { + const table_entry *tep = &((table_entry *) ap->elts)[i]; + + switch (ap_tolower(tep->key[0])) { + case 'c': + if (!strcasecmp(tep->key, "cache-control") || + !strcasecmp(tep->key, "content-range")) + cachable = 0; + break; + case 'e': + if ((!strcasecmp(tep->key, "etag") && + !strncasecmp(tep->val, "w/", 2)) || + !strcasecmp(tep->key, "expires")) + cachable = 0; + break; + case 'p': + if (!strcasecmp(tep->key, "pragma") && + !strcasecmp(tep->val, "no-cache")) + cachable = 0; + break; + case 'v': + if (!strcasecmp(tep->key, "vary")) + cachable = 0; + break; + } + } + + return cachable; +} + +/* + * Return nonzero if the request uses keep-alive. Also sets + * r->connection->keepalive. + */ +static int +qsc_set_keepalive(request_rec *r) +{ + conn_rec *c; + const server_rec *s; + const char *ch; + int ka; + + /* + * This performs the same function as ap_set_keepalive() but we can + * make some simplifying assumptions which speed up the decision. + * Specifically, we know: + * r->status == HTTP_OK + * !r->header_only + * r->headers_out contains a Content-Length header + * r->headers_out does not contain a Connection header + * r->subprocess_env does not contain a nokeepalive header + * Also we do not send a Keep-Alive header back, since it's optional + * anyway and the value changes every time if s->keep_alive_max > 0 + * (making it hard to cache and optimize). + */ + c = r->connection; + s = r->server; + ch = ap_table_get(r->headers_in, "Connection"); + if (c->keepalive >= 0 && + s->keep_alive && + s->keep_alive_timeout > 0 && + (s->keep_alive_max == 0 || s->keep_alive_max > c->keepalives) && + (ch == NULL || strcasecmp(ch, "close")) && + (r->proto_num >= HTTP_VERSION(1,1) || + (ch && !strcasecmp(ch, "keep-alive")))) { + ka = 1; + c->keepalives++; + } else + ka = 0; + + c->keepalive = ka; + return ka; +} + +/* + * Initialize the QSC. The given pool must match the one + * mod_mmap_static registers its cleanup upon, since we share pointers + * with it which it unmaps during its cleanup. + */ +void +qsc_init(pool *p) +{ + if (ap_qsc_enabled) { + if (ap_find_linked_module("mod_mmap_static.c")) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +/* disable warning about constant controlling expression */ +#pragma set woff 1209 +#endif + if (QSC_MAX_SIZE >= sizeof *qsc) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma reset woff 1209 +#endif + caddr_t m; + + /* + * Use the same mechanism as the scoreboard, except it + * must be shared memory of some sort (not a file). + */ +#ifdef USE_SHMGET_SCOREBOARD + m = ap_share_anonymous(p, 0, QSC_MAX_SIZE); +#else + m = ap_map_anonymous(p, 0, QSC_MAX_SIZE); +#endif + if (m != (caddr_t) (ap_ptr) -1) { + qsc = (struct qsc *) m; + qsc_init_malloc(); + ap_register_cleanup(p, NULL, qsc_cleanup, ap_null_cleanup); + } else + ap_log_error(APLOG_MARK, APLOG_WARNING | APLOG_NOERRNO, NULL, + "cannot obtain %d bytes of anonymous shared memory; QSC disabled", + QSC_MAX_SIZE); + } else + ap_log_error(APLOG_MARK, APLOG_WARNING | APLOG_NOERRNO, NULL, + "QSC_MAX_SIZE too small; QSC disabled"); + } else + ap_log_error(APLOG_MARK, APLOG_WARNING | APLOG_NOERRNO, NULL, + "mmap_static module not configured; QSC disabled"); + } +} + +/* + * Try to shortcut the request through the QSC. Returns nonzero if + * successful, zero if the server should continue normal processing. + */ +int +qsc_process_request(request_rec *r) +{ + int handled = 0; + + if (qsc) { + short_score *sp; + + sp = &ap_scoreboard_image->servers[r->connection->child_num]; + if (qsc_request_is_cachable(r)) { + const struct qsc_entry *ep; + + /* + * Used to increment shared stats counters directly but on + * large systems that can cause cache line thrashing. + * qsc_atomic_add(ep ? &qsc->stats.nhits : &qsc->stats.nmisses, 1); + * Instead increment nonshared scoreboard server counters + * and rely on qsc_sync_from_scoreboard() to update the + * shared stats counters. + */ + + QSC_ASSERT(r->prev == NULL); /* r is original request */ + ep = qsc_lookup_uri(r->unparsed_uri, r->server); + if (ep) { + struct iovec iovec[2]; + + qsc_atomic_add(&sp->qsc_nhits, 1); + + /* + * The set of headers sent depends on the connection + * status, keep-alive (ka) vs. single-shot (cc, for + * connection: close). + */ + if (qsc_set_keepalive(r)) { + iovec[0].iov_base = ep->kaheaders; + iovec[0].iov_len = ep->nkaheaderbytes; + } else { + iovec[0].iov_base = ep->ccheaders; + iovec[0].iov_len = ep->nccheaderbytes; + } +#if QSC_HEADER_GRAIN > 0 + QSC_ASSERT((iovec[0].iov_len & (QSC_HEADER_GRAIN - 1)) == 0); +#endif + iovec[1].iov_base = ep->body; + iovec[1].iov_len = ep->nbodybytes; + + if (iovec[1].iov_len <= MMAP_SEGMENT_SIZE) { + /* nice and small, write all at once */ + ap_send_iovec(r, iovec, 2); + } else { + /* + * bigger than we'd like; segment it WITHOUT using + * ap_bwrite() which copies data around and + * unnecessarily handles chunked encoding. + * ap_send_iovec() is streamlined for us. + */ + iovec[1].iov_len = MMAP_SEGMENT_SIZE; + if (ap_send_iovec(r, iovec, 2) > 0) { + size_t nw = MMAP_SEGMENT_SIZE; + do { + iovec[1].iov_base = (char *) ep->body + nw; + iovec[1].iov_len = ep->nbodybytes - nw; + if (iovec[1].iov_len > MMAP_SEGMENT_SIZE) + iovec[1].iov_len = MMAP_SEGMENT_SIZE; + } while (ap_send_iovec(r, &iovec[1], 1) > 0 && + (nw += iovec[1].iov_len) < ep->nbodybytes); + } + } + + /* keep logging happy */ + r->sent_bodyct = 1; + ap_table_addn(r->headers_out, "Content-Length", + ep->nbodybytesstr); + + handled = 1; + } else + qsc_atomic_add(&sp->qsc_nmisses, 1); + } else + qsc_atomic_add(&sp->qsc_nucreq, 1); + } + + return handled; +} + +/* + * Insert an entry into the QSC. The given basic header, headers from + * the request, and given body are all cached together indexed by the + * original request's URI. + */ +void +qsc_insert_request(request_rec *r, const char *basic_header, + size_t basic_header_len, void *body, size_t nbodybytes, + const char *nbodybytesstr, const char *filename) +{ + if (qsc && qsc_request_is_cachable(r) && qsc_response_is_cachable(r)) { + array_header *ap; + struct header_size { + size_t keylen; + size_t vallen; + } *header_sizes; + int i; + size_t nheaderbytes; +#if QSC_HEADER_GRAIN > 0 + size_t akalen, acclen; + const char *pp, *padpoint; +#endif + char *kaheaders, *ccheaders; + static const char katail[] = "Connection: keep-alive\r\n\r\n"; + static const char cctail[] = "Connection: close\r\n\r\n"; + enum { + kalength = 26, /* strlen(katail) */ + cclength = 21 /* strlen(cctail) */ + }; + + ap = ap_table_elts(r->headers_out); + header_sizes = (struct header_size *) ap_palloc(r->pool, + ap->nelts * sizeof *header_sizes); + +#if QSC_HEADER_GRAIN > 0 + /* + * Find where we will insert padding if necessary: append to + * the Server header value. Probe the most likely place first + * (where we think ap_tee_basic_http_header() put it) and + * failing that, scan for it. + */ + if (basic_header_len >= 12 && + !strncmp(basic_header + basic_header_len - + strlen(ap_get_server_version()) - 12, "\r\nServer: ", 10)) + padpoint = basic_header + basic_header_len - 2; + else { + padpoint = NULL; + for (pp = basic_header + basic_header_len; --pp >= basic_header; ) { + if (*pp == '\015') + padpoint = pp; + if ((*pp == 'S' || *pp == 's') && + pp + 8 < basic_header + basic_header_len && + !strncasecmp(pp, "server: ", 8)) + break; + } + if (pp < basic_header) + padpoint = NULL; + } +#endif + + /* measure lengths of strings and total length of linearized headers */ + nheaderbytes = basic_header_len; + for (i = 0; i < ap->nelts; i++) { + table_entry *tep; + int h; + + tep = &((table_entry *) ap->elts)[i]; + h = 1; + switch (ap_tolower(tep->key[0])) { + case 'c': + /* the Connection header is handled separately */ + if (!strcasecmp(tep->key, "connection")) + h = 0; + break; + case 'k': + /* don't cache the Keep-Alive header */ + if (!strcasecmp(tep->key, "keep-alive")) + h = 0; + break; + } + + if (h) { + header_sizes[i].keylen = strlen(tep->key); + header_sizes[i].vallen = strlen(tep->val); + + /* +4 for ": " and "\r\n" */ + nheaderbytes += header_sizes[i].keylen + + header_sizes[i].vallen + 4; + } else + header_sizes[i].keylen = 0; + } + + /* create ka & cc linearized headers using above info */ +#if QSC_HEADER_GRAIN > 0 + /* round up to QSC_HEADER_GRAIN */ + akalen = QSC_ALIGN(nheaderbytes + kalength, QSC_HEADER_GRAIN); + acclen = QSC_ALIGN(nheaderbytes + cclength, QSC_HEADER_GRAIN); + /* align that to QSC_HEADER_GRAIN vaddr */ + kaheaders = (char *) qsc_hmalloc(akalen); + ccheaders = (char *) qsc_hmalloc(acclen); +#else + kaheaders = (char *) qsc_malloc(nheaderbytes + kalength); + ccheaders = (char *) qsc_malloc(nheaderbytes + cclength); +#endif + if (kaheaders && ccheaders) { +#if QSC_HEADER_GRAIN > 0 + size_t npad; +#endif + char *hp; + request_rec *or; + struct qsc_entry *ep; + + /* linearize ka headers first */ +#if QSC_HEADER_GRAIN > 0 + npad = akalen - (nheaderbytes + kalength); + if (padpoint && npad > 0) { + size_t padoff = padpoint - basic_header; + + /* copy up to padpoint */ + memcpy(kaheaders, basic_header, padoff); + hp = kaheaders + padoff; + + /* pad with spaces */ + memset(hp, ' ', npad); + hp += npad; + + /* copy the rest */ + npad = basic_header_len - padoff; + memcpy(hp, basic_header + padoff, npad); + hp += npad; + } else { +#endif + memcpy(kaheaders, basic_header, basic_header_len); + hp = kaheaders + basic_header_len; +#if QSC_HEADER_GRAIN > 0 + } +#endif + for (i = 0; i < ap->nelts; i++) { + if (header_sizes[i].keylen > 0) { + table_entry *tep = &((table_entry *) ap->elts)[i]; + memcpy(hp, tep->key, header_sizes[i].keylen); + hp += header_sizes[i].keylen + 2; + hp[-2] = ':'; + hp[-1] = ' '; + memcpy(hp, tep->val, header_sizes[i].vallen); + hp += header_sizes[i].vallen + 2; + hp[-2] = '\r'; + hp[-1] = '\n'; + } + } + memcpy(hp, katail, kalength); +#if QSC_HEADER_GRAIN > 0 + QSC_ASSERT(((ap_ptr) kaheaders & (QSC_HEADER_GRAIN - 1)) == 0); + QSC_ASSERT(((ap_ptr) (hp + kalength) & (QSC_HEADER_GRAIN - 1)) == 0 || + padpoint == NULL); +#endif + + /* now linearize the cc headers */ +#if QSC_HEADER_GRAIN > 0 + npad = acclen - (nheaderbytes + cclength); + if (padpoint && npad > 0) { + size_t padoff = padpoint - basic_header; + + /* copy up to padpoint */ + memcpy(ccheaders, basic_header, padoff); + hp = ccheaders + padoff; + + /* pad with spaces */ + memset(hp, ' ', npad); + hp += npad; + + /* copy the rest */ + npad = basic_header_len - padoff; + memcpy(hp, basic_header + padoff, npad); + hp += npad; + } else { + memcpy(ccheaders, basic_header, basic_header_len); + hp = ccheaders + basic_header_len; + } + for (i = 0; i < ap->nelts; i++) { + if (header_sizes[i].keylen > 0) { + table_entry *tep = &((table_entry *) ap->elts)[i]; + memcpy(hp, tep->key, header_sizes[i].keylen); + hp += header_sizes[i].keylen + 2; + hp[-2] = ':'; + hp[-1] = ' '; + memcpy(hp, tep->val, header_sizes[i].vallen); + hp += header_sizes[i].vallen + 2; + hp[-2] = '\r'; + hp[-1] = '\n'; + } + } + memcpy(hp, cctail, cclength); + QSC_ASSERT(((ap_ptr) ccheaders & (QSC_HEADER_GRAIN - 1)) == 0); + QSC_ASSERT(((ap_ptr) (hp + cclength) & (QSC_HEADER_GRAIN - 1)) == 0 || + padpoint == NULL); +#else + /* ka & cc headers differ only in the tail portion */ + QSC_ASSERT(hp - kaheaders == nheaderbytes); + memcpy(ccheaders, kaheaders, nheaderbytes); + memcpy(ccheaders + nheaderbytes, cctail, cclength); +#endif + + /* + * insert headers and body into cache, indexed by original + * uri and current vhost + */ + for (or = r; or->prev; or = or->prev) + ; + ep = qsc_insert_uri(or->uri, r->server); + if (ep) { + ep->kaheaders = kaheaders; + ep->nkaheaderbytes = +#if QSC_HEADER_GRAIN > 0 + padpoint ? akalen : +#endif + nheaderbytes + kalength; + ep->ccheaders = ccheaders; + ep->nccheaderbytes = +#if QSC_HEADER_GRAIN > 0 + padpoint ? acclen : +#endif + nheaderbytes + cclength; + ep->body = body; + ep->nbodybytes = nbodybytes; + ep->nbodybytesstr = nbodybytesstr; +#ifdef QSC_DEBUG + ep->filename = filename; +#endif + } else { + qsc_free(ccheaders); + qsc_free(kaheaders); + qsc_failure(); + } + } else { + qsc_failure(); + if (ccheaders) + qsc_free(ccheaders); + if (kaheaders) + qsc_free(kaheaders); + } + } else if (qsc) + qsc_atomic_add(&ap_scoreboard_image->servers[r->connection->child_num].qsc_nucres, 1); +} + +/* + * Send a QSC report card. + * Options are: + * full show detailed info about each entry + * quick don't compute anything, just dump counters + */ +void +qsc_status(request_rec *r, const char *option) +{ + ap_rputs("
      Quick Shortcut Cache (QSC) Status:\n", r);
      +
      +    if (qsc) {
      +	static const char fmt[] = "  %-20s %s\n";
      +	char buf[128];
      +	struct qsc_stats stats;
      +	int i, full, quick, nbuckets, nentries, longest_chain, ndupent;
      +	ap_atomic nlookups, nuribytes, nheaderbytes, nbodybytes, nbodyvas;
      +	int histogram[QSC_HIST_SIZE], pagesize;
      +	struct qsc_entry *ep;
      +
      +	full = 0;
      +	quick = 0;
      +	if (option) {
      +	    if (!strcasecmp(option, "full"))
      +		full = 1;
      +	    else if (!strcasecmp(option, "quick"))
      +		quick = 1;
      +	    else
      +		ap_rprintf(r, "Unknown QSC status option \"%s\"\n",
      +		    ap_escape_html(r->pool, option));
      +	}
      +
      +	qsc_sync_from_scoreboard();
      +
      +	stats = qsc->stats;	/* take a more or less consistent snapshot */
      +	nbuckets = 0;
      +	nentries = 0;
      +	longest_chain = 0;
      +	nuribytes = 0;
      +	nheaderbytes = 0;
      +	nbodybytes = 0;
      +	nbodyvas = 0;
      +	ndupent = 0;
      +	memset(histogram, 0, sizeof histogram);
      +	pagesize = getpagesize();
      +	if (pagesize <= 0 || (pagesize & (pagesize - 1)) != 0)
      +	    pagesize = 4096;
      +
      +	if (!quick) {
      +	    for (i = 0; i < QSC_HASH_SIZE; i++) {
      +		ep = qsc->hash_table[i];
      +		if (ep) {
      +		    int cl;
      +
      +		    nbuckets++;
      +
      +		    cl = 0;
      +		    do {
      +			struct qsc_entry *dp;
      +
      +			cl++;
      +			nentries++;
      +			nuribytes += strlen(ep->uri) + 1;
      +			nheaderbytes += ep->nkaheaderbytes + ep->nccheaderbytes;
      +			nbodybytes += ep->nbodybytes;
      +			nbodyvas += QSC_ALIGN(ep->nbodybytes, pagesize);
      +
      +			for (dp = ep->next; dp; dp = dp->next)
      +			    if (ep->server == dp->server &&
      +				!strcmp(ep->uri, dp->uri))
      +				ndupent++;
      +
      +			ep = ep->next;
      +		    } while (ep);
      +
      +		    if (cl > longest_chain)
      +			longest_chain = cl;
      +		    histogram[((cl <= QSC_HIST_SIZE) ? cl : QSC_HIST_SIZE) - 1]++;
      +		}
      +	    }
      +	}
      +
      +	/*
      +	 * ap_vformatter() botches some conversions (like %.2f) so use
      +	 * sprintf() then ap_rprintf()
      +	 */
      +
      +	nlookups = stats.nucreq + stats.nucres + stats.nhits + stats.nmisses;
      +	sprintf(buf, "%ld/%ld (%.2f%%)",
      +	    (long) stats.nhits, (long) nlookups,
      +	    nlookups ? (double) stats.nhits * 100.0 / (double) nlookups : 0);
      +	ap_rprintf(r, fmt, "hit ratio", buf);
      +	if (!quick) {
      +	    ap_atomic uncachable;
      +
      +	    uncachable = stats.nucreq + stats.nucres + stats.nmisses -
      +	        nentries;
      +	    sprintf(buf, "%ld/%ld (%.2f%%)",
      +		(long) uncachable, (long) nlookups,
      +		nlookups ? (double) uncachable * 100.0 / (double) nlookups : 0);
      +	    ap_rprintf(r, fmt, "uncachable", buf);
      +
      +	    uncachable = stats.nmisses - nentries;
      +	    sprintf(buf, "%ld/%ld (%.2f%%)",
      +		(long) uncachable, (long) stats.nmisses,
      +		stats.nmisses ? (double) uncachable * 100.0 / (double) stats.nmisses : 0);
      +	    ap_rprintf(r, fmt, "uncachable misses", buf);
      +	}
      +	sprintf(buf, "%ld/%ld (%.2f%%)",
      +	    (long) stats.nucreq, (long) nlookups,
      +	    nlookups ? (double) stats.nucreq * 100.0 / (double) nlookups : 0);
      +	ap_rprintf(r, fmt, "uncachable requests", buf);
      +	sprintf(buf, "%ld/%ld (%.2f%%)",
      +	    (long) stats.nucres, (long) nlookups,
      +	    nlookups ? (double) stats.nucres * 100.0 / (double) nlookups : 0);
      +	ap_rprintf(r, fmt, "uncachable responses", buf);
      +	sprintf(buf, "%ld", (long) stats.nresets);
      +	ap_rprintf(r, fmt, "resets", buf);
      +
      +	ap_rputs("Hash table\n", r);
      +	sprintf(buf, "%ld", (long) stats.nfailures);
      +	ap_rprintf(r, fmt, "failed insertions", buf);
      +	if (!quick) {
      +	    ap_atomic inuse;
      +
      +	    sprintf(buf, "%d", nentries);
      +	    ap_rprintf(r, fmt, "entries", buf);
      +	    sprintf(buf, "%d", ndupent);
      +	    ap_rprintf(r, fmt, "duplicate entries", buf);
      +	    sprintf(buf, "%d/%d (%.2f%%)", nbuckets, QSC_HASH_SIZE,
      +		(double) nbuckets * 100.0 / (double) QSC_HASH_SIZE);
      +	    ap_rprintf(r, fmt, "bucket use", buf);
      +	    sprintf(buf, "%d/%d (%.2f%%)", nbuckets, nentries,
      +		nentries ? (double) nbuckets * 100.0 / (double) nentries : 0);
      +	    ap_rprintf(r, fmt, "hash effectiveness", buf);
      +	    sprintf(buf, "%d", longest_chain);
      +	    ap_rprintf(r, fmt, "longest chain", buf);
      +	    sprintf(buf, "%.1f", (double) nentries / QSC_HASH_SIZE);
      +	    ap_rprintf(r, fmt, "avg. chain", buf);
      +	    sprintf(buf, "%.1f", nbuckets ?
      +		(double) nentries / (double) nbuckets : 0);
      +	    ap_rprintf(r, fmt, "avg. nonempty chain", buf);
      +
      +	    ap_rputs("  Chain length histogram:\n    ", r);
      +	    for (i = 1; i < QSC_HIST_SIZE; i++)
      +		ap_rprintf(r, "%5d ", i);
      +	    ap_rprintf(r, "%5d+\n    ", i);
      +	    for (i = 1; i <= QSC_HIST_SIZE; i++)
      +		ap_rprintf(r, "%5d ", histogram[i - 1]);
      +	    ap_rputc('\n', r);
      +
      +	    ap_rputs("Memory use (in bytes)\n", r);
      +	    sprintf(buf, "%ld", (long) sizeof *qsc);
      +	    ap_rprintf(r, fmt, "table + misc", buf);
      +	    sprintf(buf, "%ld", (long) nentries * sizeof (struct qsc_entry));
      +	    ap_rprintf(r, fmt, "entries", buf);
      +	    sprintf(buf, "%lu", (unsigned long) nuribytes);
      +	    ap_rprintf(r, fmt, "URIs", buf);
      +	    sprintf(buf, "%lu", (unsigned long) nheaderbytes);
      +	    ap_rprintf(r, fmt, "headers", buf);
      +	    inuse = qsc_inuse();
      +	    sprintf(buf, "%ld/%ld (%.2f%%)", (long) inuse, (long) QSC_MAX_SIZE,
      +		(double) inuse * 100.0 / (double) QSC_MAX_SIZE);
      +	    ap_rprintf(r, fmt, "total", buf);
      +	    sprintf(buf, "%lu", (unsigned long) nbodybytes);
      +	    ap_rprintf(r, fmt, "mapped file data", buf);
      +	    sprintf(buf, "%lu (%lu %d-byte pages)", (unsigned long) nbodyvas,
      +		(unsigned long) (nbodyvas / pagesize), pagesize);
      +	    ap_rprintf(r, fmt, "mapped file vaddrs", buf);
      +	}
      +
      +	if (full) {
      +	    ap_rputs("Full entry info\n", r);
      +#ifndef QSC_DEBUG
      +	    ap_rputs("File names available only -DQSC_DEBUG\n", r);
      +#endif
      +	    ap_rputs("  server * URI @ hash-bucket -> keep-alive-header-bytes;non-keep-alive-header-bytes + body-bytes file-name\n", r);
      +
      +	    for (i = 0; i < QSC_HASH_SIZE; i++) {
      +		for (ep = qsc->hash_table[i]; ep; ep = ep->next) {
      +		    if (ep->server->defn_name)
      +			sprintf(buf, "%s:%u", ep->server->defn_name,
      +			    ep->server->defn_line_number);
      +		    else
      +			strcpy(buf, "main");
      +
      +		    ap_rprintf(r, "  %s * %s @ %d -> %lu;%lu + %lu ",
      +			ap_escape_html(r->pool, buf),
      +			ap_escape_html(r->pool, ep->uri),
      +			i,
      +			(unsigned long) ep->nkaheaderbytes,
      +			(unsigned long) ep->nccheaderbytes,
      +			(unsigned long) ep->nbodybytes);
      +#ifdef QSC_DEBUG
      +		    ap_rputs(ep->filename, r);
      +#else
      +		    ap_rwrite("n/a", 3, r);
      +#endif
      +		    ap_rputc('\n', r);
      +		}
      +	    }
      +	}
      +    } else
      +	ap_rputs("QSC disabled\n", r);
      +
      +    ap_rputs("
      \n", r); +} + +#endif diff -Naur apache_1.3.12/src/main/rfc1413.c-orig apache_1.3.12/src/main/rfc1413.c --- apache_1.3.12/src/main/rfc1413.c-orig Fri Dec 10 03:03:35 1999 +++ apache_1.3.12/src/main/rfc1413.c Wed Feb 9 17:34:31 2000 @@ -117,7 +117,6 @@ int i; char *cp; char buffer[RFC1413_MAXDATA + 1]; - int buflen; /* * Bind the local and remote ends of the query socket to the same @@ -152,7 +151,7 @@ return -1; /* send the data */ - buflen = ap_snprintf(buffer, sizeof(buffer), "%u,%u\r\n", ntohs(rmt_sin->sin_port), + ap_snprintf(buffer, sizeof(buffer), "%u,%u\r\n", ntohs(rmt_sin->sin_port), ntohs(our_sin->sin_port)); /* send query to server. Handle short write. */ @@ -162,7 +161,7 @@ i = 0; while(i < strlen(buffer)) { int j; - j = write(sock, buffer+i, (strlen(buffer+i))); + j = (int) write(sock, buffer+i, (strlen(buffer+i))); if (j < 0 && errno != EINTR) { ap_log_error(APLOG_MARK, APLOG_CRIT, srv, "write: rfc1413: error sending request"); @@ -202,7 +201,7 @@ return -1; } #endif /* TPF */ - j = read(sock, buffer+i, (sizeof(buffer) - 1) - i); + j = (int) read(sock, buffer+i, (sizeof(buffer) - 1) - i); if (j < 0 && errno != EINTR) { ap_log_error(APLOG_MARK, APLOG_CRIT, srv, "read: rfc1413: error reading response"); diff -Naur apache_1.3.12/src/main/util.c-orig apache_1.3.12/src/main/util.c --- apache_1.3.12/src/main/util.c-orig Wed Feb 23 04:44:57 2000 +++ apache_1.3.12/src/main/util.c Thu Mar 2 10:09:30 2000 @@ -108,7 +108,7 @@ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; -API_EXPORT(char *) ap_get_time() +API_EXPORT(char *) ap_get_time(void) { time_t t; char *time_string; @@ -188,47 +188,120 @@ return ap_pstrdup(p, ts); } +API_EXPORT(int) ap_gm_timestr_822_buf(char *buf, size_t size, time_t sec) +{ + struct tm *tms = gmtime(&sec); + + /* RFC date format; as strftime '%a, %d %b %Y %T GMT' */ + return ap_snprintf(buf, size, "%s, %.2d %s %d %.2d:%.2d:%.2d GMT", + ap_day_snames[tms->tm_wday], tms->tm_mday, + ap_month_snames[tms->tm_mon], tms->tm_year + 1900, + tms->tm_hour, tms->tm_min, tms->tm_sec); +} + +/*ARGSUSED*/ API_EXPORT(char *) ap_gm_timestr_822(pool *p, time_t sec) { - struct tm *tms; + /* + * Assume we're called most often to convert the current time of + * day. Since that changes at most once a second, cache the result + * to avoid unnecessary formatting under very heavy load. + */ + static struct { + time_t time; + char str[32]; + } last; + + if (sec != last.time) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif + last.time = sec; + ap_gm_timestr_822_buf(last.str, sizeof last.str, sec); + } - tms = gmtime(&sec); + return last.str; +} - /* RFC date format; as strftime '%a, %d %b %Y %T GMT' */ - return ap_psprintf(p, - "%s, %.2d %s %d %.2d:%.2d:%.2d GMT", ap_day_snames[tms->tm_wday], - tms->tm_mday, ap_month_snames[tms->tm_mon], tms->tm_year + 1900, - tms->tm_hour, tms->tm_min, tms->tm_sec); +#ifdef FAST_TIME +# include "scoreboard.h" +#endif +/* + * Return the current time of day, ala time() only faster. + */ +API_EXPORT(time_t) ap_time(void) +{ +#ifdef FAST_TIME + /* + * Use the global shared time that the timekeeper maintains for us, + * unless there is no timekeeper. + */ + time_t t = ap_scoreboard_image ? ap_scoreboard_image->global.time : 0; + if (t == 0) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif + t = time(NULL); + } + return t; +#else + return time(NULL); +#endif } +/* + * The GMT offset hardly ever changes, so recompute it only once a + * second to avoid unnecessary work under very heavy load. + */ +struct { + time_t time; + struct tm tm; + int off; +} gmt_info; + /* What a pain in the ass. */ #if defined(HAVE_GMTOFF) API_EXPORT(struct tm *) ap_get_gmtoff(int *tz) { - time_t tt = time(NULL); - struct tm *t; + time_t tt = ap_time(); - t = localtime(&tt); - *tz = (int) (t->tm_gmtoff / 60); - return t; + if (tt != gmt_info.time) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif + gmt_info.time = tt; + gmt_info.tm = *localtime(&tt); + gmt_info.off = (int) (gmt_info.tm.tm_gmtoff / 60); + } + + *tz = gmt_info.off; + return &gmt_info.tm; } #else API_EXPORT(struct tm *) ap_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; + time_t tt = ap_time(); + + if (tt != gmt_info.time) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif + struct tm *gmt; + int days, hours; + + gmt_info.time = tt; + /* Assume we are never more than 24 hours away. */ + /* remember that gmtime/localtime return ptr to static buffer... so be careful */ + gmt_info.tm = *localtime(&tt); + gmt = gmtime(&tt); + days = gmt_info.tm.tm_yday - gmt->tm_yday; + hours = ((days < -1 ? 24 : 1 < days ? -24 : days * 24) + + gmt_info.tm.tm_hour - gmt->tm_hour); + gmt_info.off = hours * 60 + gmt_info.tm.tm_min - gmt->tm_min; + } + + *tz = gmt_info.off; + return &gmt_info.tm; } #endif @@ -314,7 +387,7 @@ /* an empty s2 */ return((char *)s1); } - while(1) { + for (;;) { for ( ; (*s1 != '\0') && (ap_tolower(*s1) != ap_tolower(*s2)); s1++); if (*s1 == '\0') return(NULL); /* found first character of s2, see if the rest matches */ @@ -374,7 +447,7 @@ char *dest, *dst; char c; size_t no; - int len; + size_t len; if (!source) return NULL; @@ -562,7 +635,7 @@ { char *last_slash = strrchr(s, '/'); char *d; - int l; + size_t l; if (last_slash == NULL) { /* XXX: well this is really broken if this happens */ @@ -721,7 +794,7 @@ * all honored */ -static char *substring_conf(pool *p, const char *start, int len, char quote) +static char *substring_conf(pool *p, const char *start, size_t len, char quote) { char *result = ap_palloc(p, len + 2); char *resp = result; @@ -815,7 +888,7 @@ static void *cfg_getstr(void *buf, size_t bufsiz, void *param) { poolfile_t *cfp = (poolfile_t *) param; - return (fgets(buf, bufsiz, cfp->file)); + return (fgets(buf, (int) bufsiz, cfp->file)); } /* Open a configfile_t as FILE, return open configfile_t struct pointer */ @@ -930,7 +1003,7 @@ char *cbuf = buf; size_t cbufsize = bufsize; - while (1) { + for (;;) { ++cfp->line_number; if (cfp->getstr(cbuf, cbufsize, cfp->param) == NULL) return 1; @@ -1008,7 +1081,7 @@ return 1; } - while (1) { + for (;;) { if ((c == '\t') || (c == ' ')) { buf[i++] = ' '; while ((c == '\t') || (c == ' ')) @@ -1100,7 +1173,7 @@ } } - if ((*len = (ptr - token)) == 0) { + if ((*len = (int) (ptr - token)) == 0) { *field = (const char *)ptr; return NULL; } @@ -1209,6 +1282,7 @@ * This would be much more efficient if we stored header fields as * an array of list items as they are received instead of a plain string. */ +/*ARGSUSED*/ API_EXPORT(int) ap_find_list_item(pool *p, const char *line, const char *tok) { const unsigned char *pos; @@ -1317,7 +1391,7 @@ const char *ptr = *accept_line; const char *tok_start; char *token; - int tok_len; + size_t tok_len; /* Find first non-white byte */ @@ -1352,6 +1426,7 @@ /* find http tokens, see the definition of token from RFC2068 */ +/*ARGSUSED*/ API_EXPORT(int) ap_find_token(pool *p, const char *line, const char *tok) { const unsigned char *start_token; @@ -1386,9 +1461,11 @@ } +/*ARGSUSED*/ API_EXPORT(int) ap_find_last_token(pool *p, const char *line, const char *tok) { - int llen, tlen, lidx; + size_t llen, tlen; + int lidx; if (!line) return 0; @@ -1395,7 +1472,7 @@ llen = strlen(line); tlen = strlen(tok); - lidx = llen - tlen; + lidx = (int) (llen - tlen); if ((lidx < 0) || ((lidx > 0) && !(ap_isspace(line[lidx - 1]) || line[lidx - 1] == ','))) @@ -1495,6 +1572,7 @@ return OK; } +/*ARGSUSED3*/ API_EXPORT(char *) ap_construct_server(pool *p, const char *hostname, unsigned port, const request_rec *r) { @@ -1643,7 +1721,7 @@ API_EXPORT(char *) ap_make_full_path(pool *a, const char *src1, const char *src2) { - register int x; + size_t x; x = strlen(src1); if (x == 0) @@ -1695,7 +1773,7 @@ return 1; } #endif - return (finfo->st_mode & S_IXOTH); + return (finfo->st_mode & S_IXOTH) != 0; #endif } @@ -1850,7 +1928,7 @@ { register int x; - for (x = strlen(s) - 1; x != -1; x--) + for (x = ap_strlen(s) - 1; x != -1; x--) if (s[x] == c) return x; @@ -1906,10 +1984,10 @@ * Parses a host of the form
      [:port] * :port is permitted if 'port' is not NULL */ -unsigned long ap_get_virthost_addr(char *w, unsigned short *ports) +ap_uint32 ap_get_virthost_addr(char *w, unsigned short *ports) { struct hostent *hep; - unsigned long my_addr; + ap_uint32 my_addr; char *p; p = strchr(w, ':'); @@ -2015,7 +2093,7 @@ API_EXPORT(char *) ap_pbase64encode(pool *p, char *string) { char *encoded; - int l = strlen(string); + int l = ap_strlen(string); encoded = (char *) ap_palloc(p, 1 + ap_base64encode_len(l)); l = ap_base64encode(encoded, string, l); @@ -2183,4 +2261,64 @@ } *outchr = '\0'; return outstring; +} + +/* + * Fast implementation of inet_ntoa(). buf should be 16 bytes. Returns + * buf and, if rlen is non-null, sets *rlen to strlen(buf). + */ +API_EXPORT(char *) +ap_inet_ntoa(struct in_addr in, char *buf, int *rlen) +{ + int i; + char *bp; + + /* + * This implementation is fast because it avoids sprintf(), + * division/modulo, and global static array lookups. + */ + + bp = buf; + for (i = 0; i < 4; i++) { + unsigned int o, n; + + o = ((unsigned char *) &in)[i]; + n = o; + if (n >= 200) { + *bp++ = '2'; + n -= 200; + } else if (n >= 100) { + *bp++ = '1'; + n -= 100; + } + if (o >= 10) { + int i; + for (i = 0; n >= 10; i++) + n -= 10; + *bp++ = i + '0'; + } + *bp++ = n + '0'; + *bp++ = '.'; + } + *--bp = 0; + if (rlen) + *rlen = (int) (bp - buf); + + return buf; +} + +/* Return nonzero if the given file size is too large to serve. */ +API_EXPORT(int) +ap_oversized_file(off_t size) +{ + /* + * For now, only files with sizes that exceed 32 bits are too large + * to serve. Serving them would be possible if someone ported a bunch + * of code to allow for 64-bit file sizes. I don't feel like it today. + * (Ain't no 64-bit browsers neither.) + * + * Maybe the rule should instead be files with sizes larger than 2^31-1? + */ + ap_uint32 s = (ap_uint32) size; + return s != size; } diff -Naur apache_1.3.12/src/main/util_md5.c-orig apache_1.3.12/src/main/util_md5.c --- apache_1.3.12/src/main/util_md5.c-orig Fri Apr 9 05:57:07 1999 +++ apache_1.3.12/src/main/util_md5.c Wed Feb 9 17:34:31 2000 @@ -193,11 +193,10 @@ { AP_MD5_CTX context; unsigned char buf[1000]; - long length = 0; int nbytes; ap_MD5Init(&context); - while ((nbytes = fread(buf, 1, sizeof(buf), infile))) { + while ((nbytes = (int) fread(buf, 1, sizeof(buf), infile))) { length += nbytes; if (!convert) { ascii2ebcdic(buf, buf, nbytes); @@ -214,14 +213,11 @@ { AP_MD5_CTX context; unsigned char buf[1000]; - long length = 0; unsigned int nbytes; ap_MD5Init(&context); - while ((nbytes = fread(buf, 1, sizeof(buf), infile))) { - length += nbytes; + while ((nbytes = (int) fread(buf, 1, sizeof(buf), infile))) ap_MD5Update(&context, buf, nbytes); - } rewind(infile); return ap_md5contextTo64(p, &context); } diff -Naur apache_1.3.12/src/main/util_script.c-orig apache_1.3.12/src/main/util_script.c --- apache_1.3.12/src/main/util_script.c-orig Thu Dec 9 09:19:45 1999 +++ apache_1.3.12/src/main/util_script.c Wed Feb 9 17:34:31 2000 @@ -332,8 +332,8 @@ API_EXPORT(int) ap_find_path_info(const char *uri, const char *path_info) { - int lu = strlen(uri); - int lp = strlen(path_info); + int lu = ap_strlen(uri); + int lp = ap_strlen(path_info); while (lu-- && lp-- && uri[lu] == path_info[lp]); @@ -474,7 +474,7 @@ cookie_table = ap_make_table(r->pool, 2); ap_table_do(set_cookie_doo_doo, cookie_table, r->err_headers_out, "Set-Cookie", NULL); - while (1) { + for (;;) { if ((*getsfunc) (w, MAX_STRING_LEN - 1, getsfunc_data) == 0) { ap_kill_timeout(r); @@ -485,7 +485,7 @@ /* Delete terminal (CR?)LF */ - p = strlen(w); + p = ap_strlen(w); /* Indeed, the host's '\n': '\012' for UNIX; '\015' for MacOS; '\025' for OS/390 -- whatever the script generates. @@ -663,13 +663,13 @@ ap_rputs(" 1k", r); } else if (size < 1048576) { - ap_rprintf(r, "%4dk", (size + 512) / 1024); + ap_rprintf(r, "%4ldk", (long) (size + 512) / 1024); } else if (size < 103809024) { - ap_rprintf(r, "%4.1fM", size / 1048576.0); + ap_rprintf(r, "%4.1fM", (double) size / 1048576.0); } else { - ap_rprintf(r, "%4dM", (size + 524288) / 1048576); + ap_rprintf(r, "%4ldM", (long) (size + 524288) / 1048576); } } @@ -707,6 +707,7 @@ #endif +/*ARGSUSED*/ API_EXPORT(int) ap_call_exec(request_rec *r, child_info *pinfo, char *argv0, char **env, int shellcmd) { diff -Naur apache_1.3.12/src/main/util_uri.c-orig apache_1.3.12/src/main/util_uri.c --- apache_1.3.12/src/main/util_uri.c-orig Wed Jul 21 05:53:52 1999 +++ apache_1.3.12/src/main/util_uri.c Wed Feb 9 17:34:31 2000 @@ -447,7 +447,6 @@ const char *s1; const char *hostinfo; char *endstr; - int port; /* Initialize the structure. parse_uri() and parse_uri_components() * can be called more than once per request. @@ -534,8 +533,7 @@ ++s; uptr->port_str = ap_pstrndup(p, s, uri - s); if (uri != s) { - port = strtol(uptr->port_str, &endstr, 10); - uptr->port = port; + uptr->port = (unsigned short) strtol(uptr->port_str, &endstr, 10); if (*endstr == '\0') { goto deal_with_path; } @@ -588,7 +586,7 @@ ++s; uptr->port_str = ap_pstrdup(p, s); if (*s != '\0') { - uptr->port = strtol(uptr->port_str, &endstr, 10); + uptr->port = (unsigned short) strtol(uptr->port_str, &endstr, 10); if (*endstr == '\0') { return HTTP_OK; } diff -Naur apache_1.3.12/src/modules/example/Makefile.tmpl-orig apache_1.3.12/src/modules/example/Makefile.tmpl --- apache_1.3.12/src/modules/example/Makefile.tmpl-orig Sun Sep 6 23:59:33 1998 +++ apache_1.3.12/src/modules/example/Makefile.tmpl Wed Feb 9 17:34:31 2000 @@ -5,11 +5,11 @@ # DO NOT REMOVE mod_example.o: mod_example.c $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_core.h $(INCDIR)/http_log.h \ - $(INCDIR)/http_main.h $(INCDIR)/http_protocol.h \ - $(INCDIR)/util_script.h + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_core.h \ + $(INCDIR)/http_log.h $(INCDIR)/http_main.h \ + $(INCDIR)/http_protocol.h $(INCDIR)/util_script.h diff -Naur apache_1.3.12/src/modules/example/mod_example.c-orig apache_1.3.12/src/modules/example/mod_example.c --- apache_1.3.12/src/modules/example/mod_example.c-orig Sat Jun 5 08:48:10 1999 +++ apache_1.3.12/src/modules/example/mod_example.c Wed Feb 9 17:34:31 2000 @@ -288,7 +288,7 @@ /* * This routine sets up some module-wide cells if they haven't been already. */ -static void setup_module_cells() +static void setup_module_cells(void) { /* * If we haven't already allocated our module-private pool, do so now. @@ -325,6 +325,7 @@ #define TRACE_NOTE "example-trace" +/*ARGSUSED*/ static void trace_add(server_rec *s, request_rec *r, excfg *mconfig, const char *note) { @@ -424,9 +425,11 @@ * on the size (and readability) of the error_log is considerable. */ #define EXAMPLE_LOG_EACH 0 - if (EXAMPLE_LOG_EACH && (s != NULL)) { +#if EXAMPLE_LOG_EACH + if (s != NULL) { ap_log_error(APLOG_MARK, APLOG_DEBUG, s, "mod_example: %s", note); } +#endif } /*--------------------------------------------------------------------------*/ diff -Naur apache_1.3.12/src/modules/experimental/Makefile.tmpl-orig apache_1.3.12/src/modules/experimental/Makefile.tmpl --- apache_1.3.12/src/modules/experimental/Makefile.tmpl-orig Tue Aug 17 12:29:58 1999 +++ apache_1.3.12/src/modules/experimental/Makefile.tmpl Wed Feb 9 17:34:31 2000 @@ -4,20 +4,23 @@ $(OBJS) $(OBJS_PIC): Makefile # DO NOT REMOVE -mod_mmap_static.o: mod_mmap_static.c $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_log.h $(INCDIR)/http_protocol.h \ - $(INCDIR)/http_request.h $(INCDIR)/http_core.h mod_auth_digest.o: mod_auth_digest.c $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_core.h $(INCDIR)/http_log.h \ - $(INCDIR)/http_protocol.h $(INCDIR)/util_md5.h \ - $(INCDIR)/ap_md5.h + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_conf_globals.h \ + $(INCDIR)/http_core.h $(INCDIR)/http_request.h \ + $(INCDIR)/http_log.h $(INCDIR)/http_protocol.h \ + $(INCDIR)/util_md5.h $(INCDIR)/ap_md5.h \ + $(INCDIR)/ap_sha1.h +mod_mmap_static.o: mod_mmap_static.c $(INCDIR)/httpd.h \ + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_log.h \ + $(INCDIR)/http_protocol.h $(INCDIR)/http_request.h \ + $(INCDIR)/http_core.h diff -Naur apache_1.3.12/src/modules/experimental/mod_mmap_static.c-orig apache_1.3.12/src/modules/experimental/mod_mmap_static.c --- apache_1.3.12/src/modules/experimental/mod_mmap_static.c-orig Fri Jan 1 11:05:01 1999 +++ apache_1.3.12/src/modules/experimental/mod_mmap_static.c Fri Mar 3 11:07:58 2000 @@ -128,6 +128,8 @@ char *filename; void *mm; struct stat finfo; + char mtimestr[32]; + char sizestr[21]; /* big enough to hold any 64-bit file size + null */ } a_file; typedef struct { @@ -136,6 +138,7 @@ } a_server_config; +/*ARGSUSED1*/ static void *create_server_config(pool *p, server_rec *s) { a_server_config *sconf = ap_palloc(p, sizeof(*sconf)); @@ -160,6 +163,7 @@ } } +/*ARGSUSED1*/ static const char *mmapfile(cmd_parms *cmd, void *dummy, char *filename) { a_server_config *sconf; @@ -178,6 +182,11 @@ "mmap_static: %s isn't a regular file, skipping", filename); return NULL; } + if (ap_oversized_file(tmp.finfo.st_size)) { + ap_log_error(APLOG_MARK, APLOG_WARNING | APLOG_NOERRNO, cmd->server, + "mmap_static: %s is too large, skipping", filename); + return NULL; + } ap_block_alarms(); fd = open(filename, O_RDONLY, 0); if (fd == -1) { @@ -186,7 +195,7 @@ return NULL; } mm = mmap(NULL, tmp.finfo.st_size, PROT_READ, MAP_SHARED, fd, 0); - if (mm == (caddr_t)-1) { + if (mm == (caddr_t) (ap_ptr) -1) { int save_errno = errno; close(fd); ap_unblock_alarms(); @@ -198,6 +207,9 @@ close(fd); tmp.mm = mm; tmp.filename = ap_pstrdup(cmd->pool, filename); + ap_gm_timestr_822_buf(tmp.mtimestr, sizeof tmp.mtimestr, + tmp.finfo.st_mtime); + ap_snprintf(tmp.sizestr, sizeof tmp.sizestr, "%ld", (long) tmp.finfo.st_size); sconf = ap_get_module_config(cmd->server->module_config, &mmap_static_module); new_file = ap_push_array(sconf->files); *new_file = tmp; @@ -232,11 +244,14 @@ { const a_file *a = *(a_file **)av; const a_file *b = *(a_file **)bv; - long c; + int c; - c = a->finfo.st_ino - b->finfo.st_ino; + c = (int) (a->finfo.st_ino - b->finfo.st_ino); if (c == 0) { - return a->finfo.st_dev - b->finfo.st_dev; +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif + return (int) (a->finfo.st_dev - b->finfo.st_dev); } return c; } @@ -312,12 +327,26 @@ a_file **pmatch; a_file *match; int rangestatus, errstatus; +#ifdef USE_QSC + char basic_header[1024]; + size_t basic_header_len; +#endif /* we don't handle anything but GET */ - if (r->method_number != M_GET) return DECLINED; + if (r->method_number != M_GET) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif + return DECLINED; + } /* file doesn't exist, we won't be dealing with it */ - if (r->finfo.st_mode == 0) return DECLINED; + if (r->finfo.st_mode == 0) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif + return DECLINED; + } sconf = ap_get_module_config(r->server->module_config, &mmap_static_module); tmp.finfo.st_dev = r->finfo.st_dev; @@ -326,6 +355,9 @@ pmatch = (a_file **)bsearch(&ptmp, sconf->inode_sorted->elts, sconf->inode_sorted->nelts, sizeof(a_file *), inode_compare); if (pmatch == NULL) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif return DECLINED; } match = *pmatch; @@ -336,19 +368,53 @@ /* This handler has no use for a request body (yet), but we still * need to read and discard it if the client sent one. */ - if ((errstatus = ap_discard_request_body(r)) != OK) + if ((errstatus = ap_discard_request_body(r)) != OK) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif return errstatus; + } ap_update_mtime(r, match->finfo.st_mtime); - ap_set_last_modified(r); + + /* + * ap_set_last_modified() always converts the file mtime to a string + * which is slow. Accelerate the common case. + * ap_set_last_modified(r); + */ + { + time_t mod_time = ap_rationalize_mtime(r, r->mtime); + ap_table_setn(r->headers_out, "Last-Modified", + (mod_time == match->finfo.st_mtime) ? match->mtimestr : + ap_gm_timestr_822(r->pool, mod_time)); + } + ap_set_etag(r); - if (((errstatus = ap_meets_conditions(r)) != OK) - || (errstatus = ap_set_content_length (r, match->finfo.st_size))) { - return errstatus; + + if ((errstatus = ap_meets_conditions(r)) != OK) { +#if defined(IRIX) && _MIPS_SIM != _ABIO32 +#pragma mips_frequency_hint NEVER +#endif + return errstatus; } + /* + * ap_set_content_length() always converts the same number and never + * returns an error. Accelerate it. + * if ((errstatus = ap_set_content_length (r, (ap_int32) match->finfo.st_size))) + * return errstatus; + */ + r->clength = (ap_int32) match->finfo.st_size; + ap_table_setn(r->headers_out, "Content-Length", match->sizestr); + rangestatus = ap_set_byterange(r); + +#ifdef USE_QSC + basic_header_len = sizeof basic_header; + ap_tee_http_header(r, basic_header, &basic_header_len); +#else ap_send_http_header(r); +#endif if (!r->header_only) { if (!rangestatus) { @@ -355,12 +421,23 @@ ap_send_mmap (match->mm, r, 0, match->finfo.st_size); } else { - long offset, length; + ap_int32 offset, length; while (ap_each_byterange(r, &offset, &length)) { ap_send_mmap(match->mm, r, offset, length); } } } + +#ifdef USE_QSC + if (basic_header_len > 0) { + /* convert from bytes remaining to bytes used */ + basic_header_len = sizeof basic_header - basic_header_len; + + qsc_insert_request(r, basic_header, basic_header_len, + match->mm, match->finfo.st_size, match->sizestr, match->filename); + } +#endif + return OK; } diff -Naur apache_1.3.12/src/modules/proxy/Makefile.tmpl-orig apache_1.3.12/src/modules/proxy/Makefile.tmpl --- apache_1.3.12/src/modules/proxy/Makefile.tmpl-orig Tue May 4 04:21:13 1999 +++ apache_1.3.12/src/modules/proxy/Makefile.tmpl Wed Feb 9 17:34:31 2000 @@ -58,56 +58,60 @@ # DO NOT REMOVE mod_proxy.o: mod_proxy.c mod_proxy.h $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_protocol.h $(INCDIR)/explain.h \ - $(INCDIR)/http_log.h $(INCDIR)/http_vhost.h \ - $(INCDIR)/http_request.h + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_protocol.h \ + $(INCDIR)/explain.h $(INCDIR)/http_log.h \ + $(INCDIR)/http_vhost.h $(INCDIR)/http_request.h proxy_cache.o: proxy_cache.c mod_proxy.h $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_protocol.h $(INCDIR)/explain.h \ + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_protocol.h \ + $(INCDIR)/explain.h $(INCDIR)/http_conf_globals.h \ $(INCDIR)/http_log.h $(INCDIR)/http_main.h \ $(INCDIR)/util_date.h $(INCDIR)/multithread.h \ $(INCDIR)/ap_md5.h proxy_connect.o: proxy_connect.c mod_proxy.h $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_protocol.h $(INCDIR)/explain.h \ - $(INCDIR)/http_log.h $(INCDIR)/http_main.h + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_protocol.h \ + $(INCDIR)/explain.h $(INCDIR)/http_log.h \ + $(INCDIR)/http_main.h proxy_ftp.o: proxy_ftp.c mod_proxy.h $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_protocol.h $(INCDIR)/explain.h \ - $(INCDIR)/http_main.h $(INCDIR)/http_log.h + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_protocol.h \ + $(INCDIR)/explain.h $(INCDIR)/http_main.h \ + $(INCDIR)/http_log.h $(INCDIR)/http_core.h proxy_http.o: proxy_http.c mod_proxy.h $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_protocol.h $(INCDIR)/explain.h \ - $(INCDIR)/http_log.h $(INCDIR)/http_main.h \ - $(INCDIR)/http_core.h $(INCDIR)/util_date.h -proxy_util.o: proxy_util.c mod_proxy.h $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_protocol.h $(INCDIR)/explain.h \ - $(INCDIR)/http_main.h $(INCDIR)/ap_md5.h \ - $(INCDIR)/multithread.h $(INCDIR)/http_log.h \ + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_protocol.h \ + $(INCDIR)/explain.h $(INCDIR)/http_log.h \ + $(INCDIR)/http_main.h $(INCDIR)/http_core.h \ $(INCDIR)/util_date.h +proxy_util.o: proxy_util.c mod_proxy.h $(INCDIR)/httpd.h \ + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_protocol.h \ + $(INCDIR)/explain.h $(INCDIR)/http_main.h \ + $(INCDIR)/ap_md5.h $(INCDIR)/multithread.h \ + $(INCDIR)/http_log.h $(INCDIR)/util_date.h diff -Naur apache_1.3.12/src/modules/proxy/mod_proxy.c-orig apache_1.3.12/src/modules/proxy/mod_proxy.c --- apache_1.3.12/src/modules/proxy/mod_proxy.c-orig Tue Jan 11 06:13:43 2000 +++ apache_1.3.12/src/modules/proxy/mod_proxy.c Wed Feb 9 17:34:31 2000 @@ -126,7 +126,7 @@ * doubled slashes) */ - return urip - uri; + return (int) (urip - uri); } /* Detect if an absoluteURI should be proxied or not. Note that we @@ -246,6 +246,7 @@ /* domain in this case. I think it is better to redirect to a FQDN, since */ /* these will later be found in the bookmarks files. */ /* The "ProxyDomain" directive determines what domain will be appended */ +/*ARGSUSED1*/ static int proxy_needsdomain(request_rec *r, const char *url, const char *domain) { char *nuri; @@ -301,7 +302,7 @@ if (r->method_number == M_TRACE && (maxfwd_str = ap_table_get(r->headers_in, "Max-Forwards")) != NULL) { - int maxfwd = strtol(maxfwd_str, NULL, 10); + long maxfwd = strtol(maxfwd_str, NULL, 10); if (maxfwd < 1) { int access_status; r->proxyreq = NOT_PROXY; @@ -312,7 +313,7 @@ return OK; } ap_table_setn(r->headers_in, "Max-Forwards", - ap_psprintf(r->pool, "%d", (maxfwd > 0) ? maxfwd-1 : 0)); + ap_psprintf(r->pool, "%ld", (maxfwd > 0) ? maxfwd-1 : 0)); } if ((rc = ap_setup_client_block(r, REQUEST_CHUNKED_ERROR))) @@ -403,6 +404,7 @@ /* -------------------------------------------------------------- */ /* Setup configurable data */ +/*ARGSUSED1*/ static void * create_proxy_config(pool *p, server_rec *s) { @@ -480,6 +482,7 @@ return ps; } +/*ARGSUSED1*/ static const char * add_proxy(cmd_parms *cmd, void *dummy, char *f, char *r) { @@ -522,6 +525,7 @@ return NULL; } +/*ARGSUSED1*/ static const char * add_pass(cmd_parms *cmd, void *dummy, char *f, char *r) { @@ -536,6 +540,7 @@ return NULL; } +/*ARGSUSED1*/ static const char * add_pass_reverse(cmd_parms *cmd, void *dummy, char *f, char *r) { @@ -551,6 +556,7 @@ return NULL; } +/*ARGSUSED1*/ static const char * set_proxy_exclude(cmd_parms *parms, void *dummy, char *arg) { @@ -585,6 +591,7 @@ /* * Set the ports CONNECT can use */ +/*ARGSUSED1*/ static const char * set_allowed_ports(cmd_parms *parms, void *dummy, char *arg) { @@ -604,6 +611,7 @@ /* Similar to set_proxy_exclude(), but defining directly connected hosts, * which should never be accessed via the configured ProxyRemote servers */ +/*ARGSUSED1*/ static const char * set_proxy_dirconn(cmd_parms *parms, void *dummy, char *arg) { @@ -654,6 +662,7 @@ return NULL; } +/*ARGSUSED1*/ static const char * set_proxy_domain(cmd_parms *parms, void *dummy, char *arg) { @@ -667,6 +676,7 @@ return NULL; } +/*ARGSUSED1*/ static const char * set_proxy_req(cmd_parms *parms, void *dummy, int flag) { @@ -679,6 +689,7 @@ } +/*ARGSUSED1*/ static const char * set_cache_size(cmd_parms *parms, char *struct_ptr, char *arg) { @@ -693,6 +704,7 @@ return NULL; } +/*ARGSUSED1*/ static const char * set_cache_root(cmd_parms *parms, void *dummy, char *arg) { @@ -704,6 +716,7 @@ return NULL; } +/*ARGSUSED1*/ static const char * set_cache_factor(cmd_parms *parms, void *dummy, char *arg) { @@ -719,6 +732,7 @@ return NULL; } +/*ARGSUSED1*/ static const char * set_cache_maxex(cmd_parms *parms, void *dummy, char *arg) { @@ -733,6 +747,7 @@ return NULL; } +/*ARGSUSED1*/ static const char * set_cache_defex(cmd_parms *parms, void *dummy, char *arg) { @@ -747,6 +762,7 @@ return NULL; } +/*ARGSUSED1*/ static const char * set_cache_gcint(cmd_parms *parms, void *dummy, char *arg) { @@ -761,6 +777,7 @@ return NULL; } +/*ARGSUSED1*/ static const char * set_cache_dirlevels(cmd_parms *parms, char *struct_ptr, char *arg) { @@ -778,6 +795,7 @@ return NULL; } +/*ARGSUSED1*/ static const char * set_cache_dirlength(cmd_parms *parms, char *struct_ptr, char *arg) { @@ -795,6 +813,7 @@ return NULL; } +/*ARGSUSED1*/ static const char * set_cache_exclude(cmd_parms *parms, void *dummy, char *arg) { @@ -826,6 +845,7 @@ return NULL; } +/*ARGSUSED1*/ static const char * set_recv_buffer_size(cmd_parms *parms, void *dummy, char *arg) { @@ -841,6 +861,7 @@ return NULL; } +/*ARGSUSED1*/ static const char* set_cache_completion(cmd_parms *parms, void *dummy, char *arg) { @@ -859,6 +880,7 @@ return NULL; } +/*ARGSUSED1*/ static const char* set_via_opt(cmd_parms *parms, void *dummy, char *arg) { diff -Naur apache_1.3.12/src/modules/proxy/mod_proxy.h-orig apache_1.3.12/src/modules/proxy/mod_proxy.h --- apache_1.3.12/src/modules/proxy/mod_proxy.h-orig Tue Jan 11 06:13:44 2000 +++ apache_1.3.12/src/modules/proxy/mod_proxy.h Wed Feb 9 17:34:31 2000 @@ -185,7 +185,7 @@ /* static information about the local cache */ struct cache_conf { const char *root; /* the location of the cache directory */ - off_t space; /* Maximum cache size (in 1024 bytes) */ + ap_int32 space; /* Maximum cache size (in 1024 bytes) */ char space_set; time_t maxexpire; /* Maximum time to keep cached files in secs */ char maxexpire_set; @@ -245,7 +245,7 @@ time_t lmod; /* last-modified date of cached entity */ time_t date; /* the date the cached file was last touched */ int version; /* update count of the file */ - off_t len; /* content length */ + ap_int32 len; /* content length */ char *protocol; /* Protocol, and major/minor number, e.g. HTTP/1.1 */ int status; /* the status of the cached file */ unsigned int written; /* total *content* bytes written to cache */ @@ -292,13 +292,13 @@ int ap_proxy_hex2c(const char *x); void ap_proxy_c2hex(int ch, char *x); -char *ap_proxy_canonenc(pool *p, const char *x, int len, enum enctype t, +char *ap_proxy_canonenc(pool *p, const char *x, size_t len, enum enctype t, enum proxyreqtype isenc); char *ap_proxy_canon_netloc(pool *p, char **const urlp, char **userp, char **passwordp, char **hostp, int *port); const char *ap_proxy_date_canon(pool *p, const char *x); table *ap_proxy_read_headers(request_rec *r, char *buffer, int size, BUFF *f); -long int ap_proxy_send_fb(BUFF *f, request_rec *r, cache_req *c); +ap_int32 ap_proxy_send_fb(BUFF *f, request_rec *r, cache_req *c); void ap_proxy_send_headers(request_rec *r, const char *respline, table *hdrs); int ap_proxy_liststr(const char *list, const char *val); void ap_proxy_hash(const char *it, char *val, int ndepth, int nlength); diff -Naur apache_1.3.12/src/modules/proxy/proxy_cache.c-orig apache_1.3.12/src/modules/proxy/proxy_cache.c --- apache_1.3.12/src/modules/proxy/proxy_cache.c-orig Wed Dec 8 15:02:43 1999 +++ apache_1.3.12/src/modules/proxy/proxy_cache.c Wed Feb 9 17:34:31 2000 @@ -80,7 +80,7 @@ DEF_Explain struct gc_ent { - unsigned long int len; + ap_uint32 len; time_t expire; char file[HASH_LEN + 1]; }; @@ -87,8 +87,8 @@ /* Poor man's 61 bit arithmetic */ typedef struct { - long lower; /* lower 30 bits of result */ - long upper; /* upper 31 bits of result */ + ap_int32 lower; /* lower 30 bits of result */ + ap_int32 upper; /* upper 31 bits of result */ } long61_t; /* FIXME: The block size can be different on a `per file system' base. @@ -107,12 +107,13 @@ */ #define ROUNDUP2BLOCKS(_bytes) (((_bytes)+block_size-1) & ~(block_size-1)) -static long block_size = 512; /* this must be a power of 2 */ +static ap_int32 block_size = 512; /* this must be a power of 2 */ static long61_t curbytes, cachesize; static time_t garbage_now, garbage_expire; static mutex *garbage_mutex = NULL; +/*ARGSUSED*/ int ap_proxy_garbage_init(server_rec *r, pool *p) { if (!garbage_mutex) @@ -160,22 +161,22 @@ static void -add_long61 (long61_t *accu, long val) +add_long61 (long61_t *accu, ap_int32 val) { /* Add in lower 30 bits */ - accu->lower += (val & 0x3FFFFFFFL); + accu->lower += (val & (ap_int32) 0x3FFFFFFF); /* add in upper bits, and carry */ - accu->upper += (val >> 30) + ((accu->lower & ~0x3FFFFFFFL) != 0L); + accu->upper += (val >> 30) + ((accu->lower & ~((ap_int32) 0x3FFFFFFF)) != 0); /* Clear carry */ - accu->lower &= 0x3FFFFFFFL; + accu->lower &= (ap_int32) 0x3FFFFFFF; } static void -sub_long61 (long61_t *accu, long val) +sub_long61 (long61_t *accu, ap_int32 val) { - int carry = (val & 0x3FFFFFFFL) > accu->lower; + int carry = (val & (ap_int32) 0x3FFFFFFF) > accu->lower; /* Subtract lower 30 bits */ - accu->lower = accu->lower - (val & 0x3FFFFFFFL) + ((carry) ? 0x40000000 : 0); + accu->lower = accu->lower - (val & (ap_int32) 0x3FFFFFFF) + ((carry) ? 0x40000000 : 0); /* add in upper bits, and carry */ accu->upper -= (val >> 30) + carry; } @@ -185,7 +186,7 @@ * return 0 when left == right * return >0 when left > right */ -static long +static ap_int32 cmp_long61 (long61_t *left, long61_t *right) { return (left->upper == right->upper) ? (left->lower - right->lower) @@ -195,8 +196,8 @@ /* Compare two gc_ent's, sort them by expiration date */ static int gcdiff(const void *ap, const void *bp) { - const struct gc_ent *a = (const struct gc_ent * const) ap; - const struct gc_ent *b = (const struct gc_ent * const) bp; + const struct gc_ent *a = (const struct gc_ent *) ap; + const struct gc_ent *b = (const struct gc_ent *) bp; if (a->expire > b->expire) return 1; @@ -211,7 +212,6 @@ { pid_t pid; int status; - pid_t pgrp; #if 0 ap_log_error(APLOG_MARK, APLOG_DEBUG, r->server, @@ -238,7 +238,7 @@ case 0: /* Child */ /* The setpgrp() stuff was snarfed from http_main.c */ #ifndef NO_SETSID - if ((pgrp = setsid()) == -1) { + if (setsid() == -1) { perror("setsid"); fprintf(stderr, "%s: setsid failed\n", ap_server_argv0); @@ -245,7 +245,7 @@ exit(1); } #elif defined(NEXT) || defined(NEWSOS) - if (setpgrp(0, getpid()) == -1 || (pgrp = getpgrp(0)) == -1) { + if (setpgrp(0, getpid()) == -1 || getpgrp(0) == -1) { perror("setpgrp"); fprintf(stderr, "%S: setpgrp or getpgrp failed\n", ap_server_argv0); @@ -252,7 +252,7 @@ exit(1); } #else - if ((pgrp = setpgrp(getpid(), 0)) == -1) { + if (setpgrp(getpid(), 0) == -1) { perror("setpgrp"); fprintf(stderr, "%s: setpgrp failed\n", ap_server_argv0); @@ -367,11 +367,11 @@ ap_block_alarms(); /* avoid SIGALRM on big cache cleanup */ files = ap_make_array(r->pool, 100, sizeof(struct gc_ent)); - curbytes.upper = curbytes.lower = 0L; + curbytes.upper = curbytes.lower = 0; sub_garbage_coll(r, files, cachedir, "/"); - if (cmp_long61(&curbytes, &cachesize) < 0L) { + if (cmp_long61(&curbytes, &cachesize) < 0) { ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, r->server, "proxy GC: Cache is %ld%% full (nothing deleted)", (long)(((curbytes.upper<<20)|(curbytes.lower>>10))*100/conf->space)); @@ -385,7 +385,7 @@ for (i = 0; i < files->nelts; i++) { fent = &((struct gc_ent *) files->elts)[i]; sprintf(filename, "%s%s", cachedir, fent->file); - Explain3("GC Unlinking %s (expiry %ld, garbage_now %ld)", filename, fent->expire, garbage_now); + Explain3("GC Unlinking %s (expiry %ld, garbage_now %ld)", filename, (long) fent->expire, (long) garbage_now); #if TESTING fprintf(stderr, "Would unlink %s\n", filename); #else @@ -513,6 +513,13 @@ continue; } + if (ap_oversized_file(buf.st_size)) { + ap_log_error(APLOG_MARK, APLOG_WARNING | APLOG_NOERRNO, r->server, + "proxy gc: %s: File too large", filename); + close(fd); + continue; + } + /* In OS/2 and TPF this has already been done above */ #if !defined(OS2) && !defined(TPF) if (S_ISDIR(buf.st_mode)) { @@ -531,13 +538,13 @@ --nfiles; } else { /* Directory is not empty. Account for its size: */ - add_long61(&curbytes, ROUNDUP2BLOCKS(buf.st_size)); + add_long61(&curbytes, ROUNDUP2BLOCKS((ap_int32) buf.st_size)); } continue; } #endif - i = read(fd, line, 26); + i = (int) read(fd, line, 26); close(fd); if (i == -1) { ap_log_error(APLOG_MARK, APLOG_ERR, r->server, @@ -569,13 +576,13 @@ * */ fent = (struct gc_ent *) ap_push_array(files); - fent->len = buf.st_size; + fent->len = (ap_uint32) buf.st_size; fent->expire = garbage_expire; strcpy(fent->file, cachesubdir); strcat(fent->file, ent->d_name); /* accumulate in blocks, to cope with directories > 4Gb */ - add_long61(&curbytes, ROUNDUP2BLOCKS(buf.st_size)); + add_long61(&curbytes, ROUNDUP2BLOCKS(fent->len)); } closedir(dir); @@ -677,7 +684,7 @@ time_t now; BUFF *cachefp; int cfd, i; - const long int zero = 0L; + const ap_int32 zero = 0; void *sconf = r->server->module_config; proxy_server_conf *pconf = (proxy_server_conf *) ap_get_module_config(sconf, &proxy_module); @@ -710,7 +717,7 @@ pragma = ap_table_get(r->headers_in, "Pragma"); auth = ap_table_get(r->headers_in, "Authorization"); Explain5("Request for %s, pragma=%s, auth=%s, ims=%ld, imstr=%s", url, - pragma, auth, c->ims, imstr); + pragma, auth, (long) c->ims, imstr); if (c->filename != NULL && r->method_number == M_GET && strlen(url) < 1024 && !ap_proxy_liststr(pragma, "no-cache") && auth == NULL) { @@ -840,7 +847,7 @@ void *sconf = r->server->module_config; proxy_server_conf *conf = (proxy_server_conf *) ap_get_module_config(sconf, &proxy_module); - const long int zero = 0L; + const ap_int32 zero = 0; c->tempfile = NULL; @@ -947,7 +954,7 @@ * else * expire date = now + defaultexpire */ - Explain1("Expiry date is %ld", expc); + Explain1("Expiry date is %ld", (long) expc); if (expc == BAD_DATE) { if (lmod != BAD_DATE) { double x = (double) (date - lmod) * conf->cache.lmfactor; @@ -958,7 +965,7 @@ } else expc = now + conf->cache.defaultexpire; - Explain1("Expiry date calculated %ld", expc); + Explain1("Expiry date calculated %ld", (long) expc); } /* get the content-length header */ @@ -1089,7 +1096,7 @@ void ap_proxy_cache_tidy(cache_req *c) { server_rec *s; - long int bc; + ap_int32 bc; if (c == NULL || c->fp == NULL) return; diff -Naur apache_1.3.12/src/modules/proxy/proxy_connect.c-orig apache_1.3.12/src/modules/proxy/proxy_connect.c --- apache_1.3.12/src/modules/proxy/proxy_connect.c-orig Fri Aug 27 13:21:51 1999 +++ apache_1.3.12/src/modules/proxy/proxy_connect.c Wed Feb 9 17:34:31 2000 @@ -111,6 +111,7 @@ } +/*ARGSUSED1*/ int ap_proxy_connect_handler(request_rec *r, cache_req *c, char *url, const char *proxyhost, int proxyport) { @@ -238,7 +239,7 @@ ap_bflush(r->connection->client); } - while (1) { /* Infinite loop until error (one side closes the connection) */ + for (;;) { /* Infinite loop until error (one side closes the connection) */ FD_ZERO(&fds); FD_SET(sock, &fds); FD_SET(ap_bfileno(r->connection->client, B_WR), &fds); @@ -252,7 +253,7 @@ if (i) { if (FD_ISSET(sock, &fds)) { Explain0("sock was set"); - if ((nbytes = read(sock, buffer, HUGE_STRING_LEN)) != 0) { + if ((nbytes = (int) read(sock, buffer, HUGE_STRING_LEN)) != 0) { if (nbytes == -1) break; if (write(ap_bfileno(r->connection->client, B_WR), buffer, nbytes) == EOF) @@ -264,7 +265,7 @@ } else if (FD_ISSET(ap_bfileno(r->connection->client, B_WR), &fds)) { Explain0("client->fd was set"); - if ((nbytes = read(ap_bfileno(r->connection->client, B_WR), buffer, + if ((nbytes = (int) read(ap_bfileno(r->connection->client, B_WR), buffer, HUGE_STRING_LEN)) != 0) { if (nbytes == -1) break; diff -Naur apache_1.3.12/src/modules/proxy/proxy_ftp.c-orig apache_1.3.12/src/modules/proxy/proxy_ftp.c --- apache_1.3.12/src/modules/proxy/proxy_ftp.c-orig Tue Jan 11 06:13:45 2000 +++ apache_1.3.12/src/modules/proxy/proxy_ftp.c Wed Feb 9 17:34:31 2000 @@ -263,15 +263,15 @@ return status; } -static long int send_dir(BUFF *f, request_rec *r, cache_req *c, char *cwd) +static ap_int32 send_dir(BUFF *f, request_rec *r, cache_req *c, char *cwd) { char buf[IOBUFSIZE]; char buf2[IOBUFSIZE]; char *filename; - int searchidx = 0; + size_t searchidx = 0; char *searchptr = NULL; int firstfile = 1; - unsigned long total_bytes_sent = 0; + ap_uint32 total_bytes_sent = 0; register int n, o, w; conn_rec *con = r->connection; char *dir, *path, *reldir, *site; @@ -284,7 +284,7 @@ /* Copy path, strip (all except the last) trailing slashes */ path = dir = ap_pstrcat(r->pool, path, "/", NULL); - while ((n = strlen(path)) > 1 && path[n-1] == '/' && path[n-2] == '/') + while ((n = ap_strlen(path)) > 1 && path[n-1] == '/' && path[n-2] == '/') path[n-1] = '\0'; /* print "ftp://host/" */ @@ -337,11 +337,11 @@ } while (filename[0] != ' '); *(filename++) = '\0'; *(link_ptr++) = '\0'; - if ((n = strlen(link_ptr)) > 1 && link_ptr[n - 1] == '\n') + if ((n = ap_strlen(link_ptr)) > 1 && link_ptr[n - 1] == '\n') link_ptr[n - 1] = '\0'; ap_snprintf(buf2, sizeof(buf2), "%s %s %s\n", buf, filename, filename, link_ptr); ap_cpystrn(buf, buf2, sizeof(buf)); - n = strlen(buf); + n = ap_strlen(buf); } else if (buf[0] == 'd' || buf[0] == '-' || buf[0] == 'l' || ap_isdigit(buf[0])) { if (ap_isdigit(buf[0])) { /* handle DOS dir */ @@ -377,7 +377,7 @@ ap_snprintf(buf2, sizeof(buf2), "%s %s\n", buf, filename, filename); } ap_cpystrn(buf, buf2, sizeof(buf)); - n = strlen(buf); + n = ap_strlen(buf); } o = 0; @@ -442,6 +442,7 @@ * Troy Morrison * PASV added by Chuck */ +/*ARGSUSED2*/ int ap_proxy_ftp_handler(request_rec *r, cache_req *c, char *url) { char *host, *path, *strp, *parms; @@ -460,7 +461,7 @@ BUFF *data = NULL; pool *p = r->pool; int one = 1; - const long int zero = 0L; + const ap_int32 zero = 0; NET_SIZE_T clen; struct tbl_do_args tdo; diff -Naur apache_1.3.12/src/modules/proxy/proxy_http.c-orig apache_1.3.12/src/modules/proxy/proxy_http.c --- apache_1.3.12/src/modules/proxy/proxy_http.c-orig Tue Jan 11 06:13:45 2000 +++ apache_1.3.12/src/modules/proxy/proxy_http.c Wed Feb 9 17:34:31 2000 @@ -117,7 +117,8 @@ void *sconf; proxy_server_conf *conf; struct proxy_alias *ent; - int i, l1, l2; + int i; + size_t l1, l2; char *u; sconf = r->server->module_config; @@ -183,7 +184,7 @@ char buffer[HUGE_STRING_LEN]; char portstr[32]; pool *p = r->pool; - const long int zero = 0L; + const ap_int32 zero = 0; int destport = 0; char *destportstr = NULL; const char *urlptr = NULL; diff -Naur apache_1.3.12/src/modules/proxy/proxy_util.c-orig apache_1.3.12/src/modules/proxy/proxy_util.c --- apache_1.3.12/src/modules/proxy/proxy_util.c-orig Mon Feb 7 16:34:40 2000 +++ apache_1.3.12/src/modules/proxy/proxy_util.c Wed Mar 1 17:04:30 2000 @@ -134,10 +134,11 @@ * and encodes those which must be encoded, and does not touch * those which must not be touched. */ -char *ap_proxy_canonenc(pool *p, const char *x, int len, enum enctype t, +char *ap_proxy_canonenc(pool *p, const char *x, size_t len, enum enctype t, enum proxyreqtype isenc) { - int i, j, ch; + size_t i, j; + int ch; char *y; const char *allowed; /* characters which should not be encoded */ const char *reserved; /* characters which much not be en/de-coded */ @@ -239,12 +240,12 @@ strp = strchr(user, ':'); if (strp != NULL) { *strp = '\0'; - password = ap_proxy_canonenc(p, strp + 1, strlen(strp + 1), enc_user, 1); + password = ap_proxy_canonenc(p, strp + 1, strlen(strp + 1), enc_user, STD_PROXY); if (password == NULL) return "Bad %-escape in URL (password)"; } - user = ap_proxy_canonenc(p, user, strlen(user), enc_user, 1); + user = ap_proxy_canonenc(p, user, strlen(user), enc_user, STD_PROXY); if (user == NULL) return "Bad %-escape in URL (username)"; } @@ -489,11 +490,11 @@ return resp_hdrs; } -long int ap_proxy_send_fb(BUFF *f, request_rec *r, cache_req *c) +ap_int32 ap_proxy_send_fb(BUFF *f, request_rec *r, cache_req *c) { int ok; char buf[IOBUFSIZE]; - long total_bytes_rcvd; + ap_int32 total_bytes_rcvd; register int n, o, w; conn_rec *con = r->connection; int alternate_timeouts = 1; /* 1 if we alternate between soft & hard timeouts */ @@ -597,7 +598,7 @@ */ ok = (c->len > 0) && (c->cache_completion > 0) && - (c->len * c->cache_completion < total_bytes_rcvd); + ((ap_int32) ((float) c->len * c->cache_completion) < total_bytes_rcvd); if (! ok) { ap_pclosef(c->req->pool, ap_bfileno(c->fp, B_WR)); @@ -655,7 +656,7 @@ */ int ap_proxy_liststr(const char *list, const char *val) { - int len, i; + size_t len, i; const char *p; len = strlen(val); @@ -751,7 +752,7 @@ #endif ap_MD5Init(&context); - ap_MD5Update(&context, (const unsigned char *) it, strlen(it)); + ap_MD5Update(&context, (const unsigned char *) it, ap_strlen(it)); ap_MD5Final(digest, &context); /* encode 128 bits as 22 characters, using a modified uuencoding */ @@ -868,7 +869,7 @@ int i; struct hostent *hp; static APACHE_TLS struct hostent hpbuf; - static APACHE_TLS u_long ipaddr; + static APACHE_TLS ap_uint32 ipaddr; static APACHE_TLS char *charpbuf[2]; for (i = 0; host[i] != '\0'; i++) @@ -882,12 +883,12 @@ } else { ipaddr = ap_inet_addr(host); - hp = gethostbyaddr((char *) &ipaddr, sizeof(u_long), AF_INET); + hp = gethostbyaddr((char *) &ipaddr, sizeof ipaddr, AF_INET); if (hp == NULL) { memset(&hpbuf, 0, sizeof(hpbuf)); hpbuf.h_name = 0; hpbuf.h_addrtype = AF_INET; - hpbuf.h_length = sizeof(u_long); + hpbuf.h_length = sizeof ipaddr; hpbuf.h_addr_list = charpbuf; hpbuf.h_addr_list[0] = (char *) &ipaddr; hpbuf.h_addr_list[1] = 0; @@ -926,6 +927,7 @@ } /* Return TRUE if addr represents an IP address (or an IP network address) */ +/*ARGSUSED1*/ int ap_proxy_is_ipaddr(struct dirconn_entry *This, pool *p) { const char *addr = This->name; @@ -1107,6 +1109,7 @@ } /* Return TRUE if addr represents a domain name */ +/*ARGSUSED1*/ int ap_proxy_is_domainname(struct dirconn_entry *This, pool *p) { char *addr = This->name; @@ -1131,7 +1134,7 @@ return 0; /* Strip trailing dots */ - for (i = strlen(addr) - 1; i > 0 && addr[i] == '.'; --i) + for (i = ap_strlen(addr) - 1; i > 0 && addr[i] == '.'; --i) addr[i] = '\0'; This->matcher = proxy_match_domainname; @@ -1142,7 +1145,7 @@ static int proxy_match_domainname(struct dirconn_entry *This, request_rec *r) { const char *host = proxy_get_host_of_request(r); - int d_len = strlen(This->name), h_len; + size_t d_len = strlen(This->name), h_len; if (host == NULL) /* some error was logged already */ return 0; @@ -1186,7 +1189,7 @@ This->hostentry = ap_pduphostent (p, &host); /* Strip trailing dots */ - for (i = strlen(addr) - 1; i > 0 && addr[i] == '.'; --i) + for (i = ap_strlen(addr) - 1; i > 0 && addr[i] == '.'; --i) addr[i] = '\0'; This->matcher = proxy_match_hostname; @@ -1198,8 +1201,8 @@ { char *host = This->name; const char *host2 = proxy_get_host_of_request(r); - int h2_len; - int h1_len; + size_t h2_len; + size_t h1_len; if (host == NULL || host2 == NULL) return 0; /* oops! */ @@ -1226,6 +1229,7 @@ } /* Return TRUE if addr is to be matched as a word */ +/*ARGSUSED1*/ int ap_proxy_is_word(struct dirconn_entry *This, pool *p) { This->matcher = proxy_match_word; diff -Naur apache_1.3.12/src/modules/standard/Makefile.tmpl-orig apache_1.3.12/src/modules/standard/Makefile.tmpl --- apache_1.3.12/src/modules/standard/Makefile.tmpl-orig Sun Sep 6 23:59:35 1998 +++ apache_1.3.12/src/modules/standard/Makefile.tmpl Wed Feb 9 17:34:31 2000 @@ -5,252 +5,284 @@ # DO NOT REMOVE mod_access.o: mod_access.c $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_core.h \ + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h $(INCDIR)/http_core.h \ $(INCDIR)/http_config.h $(INCDIR)/http_log.h \ $(INCDIR)/http_request.h mod_actions.o: mod_actions.c $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_request.h $(INCDIR)/http_core.h \ - $(INCDIR)/http_protocol.h $(INCDIR)/http_main.h \ - $(INCDIR)/http_log.h $(INCDIR)/util_script.h + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_request.h \ + $(INCDIR)/http_core.h $(INCDIR)/http_protocol.h \ + $(INCDIR)/http_main.h $(INCDIR)/http_log.h \ + $(INCDIR)/util_script.h mod_alias.o: mod_alias.c $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h -mod_asis.o: mod_asis.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ - $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ - $(OSDIR)/os.h $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_protocol.h $(INCDIR)/http_log.h \ - $(INCDIR)/util_script.h $(INCDIR)/http_main.h \ - $(INCDIR)/http_request.h -mod_auth.o: mod_auth.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ - $(OSDIR)/os.h $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_core.h $(INCDIR)/http_log.h \ - $(INCDIR)/http_protocol.h -mod_auth_anon.o: mod_auth_anon.c $(INCDIR)/httpd.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h +mod_asis.o: mod_asis.c $(INCDIR)/httpd.h $(INCDIR)/ap_types.h \ $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_core.h $(INCDIR)/http_log.h \ - $(INCDIR)/http_protocol.h $(INCDIR)/http_request.h -mod_auth_db.o: mod_auth_db.c $(INCDIR)/httpd.h \ + $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_protocol.h \ + $(INCDIR)/http_log.h $(INCDIR)/util_script.h \ + $(INCDIR)/http_main.h $(INCDIR)/http_request.h +mod_auth.o: mod_auth.c $(INCDIR)/httpd.h $(INCDIR)/ap_types.h \ $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_core.h $(INCDIR)/http_log.h \ - $(INCDIR)/http_protocol.h + $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_core.h \ + $(INCDIR)/http_log.h $(INCDIR)/http_protocol.h +mod_auth_anon.o: mod_auth_anon.c $(INCDIR)/httpd.h \ + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_core.h \ + $(INCDIR)/http_log.h $(INCDIR)/http_protocol.h \ + $(INCDIR)/http_request.h +mod_auth_db.o: mod_auth_db.c $(INCDIR)/httpd.h \ + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_core.h \ + $(INCDIR)/http_log.h $(INCDIR)/http_protocol.h mod_auth_dbm.o: mod_auth_dbm.c $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_core.h $(INCDIR)/http_log.h \ - $(INCDIR)/http_protocol.h + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_core.h \ + $(INCDIR)/http_log.h $(INCDIR)/http_protocol.h mod_autoindex.o: mod_autoindex.c $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_core.h $(INCDIR)/http_request.h \ - $(INCDIR)/http_protocol.h $(INCDIR)/http_log.h \ - $(INCDIR)/http_main.h $(INCDIR)/util_script.h + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_core.h \ + $(INCDIR)/http_request.h $(INCDIR)/http_protocol.h \ + $(INCDIR)/http_log.h $(INCDIR)/http_main.h \ + $(INCDIR)/util_script.h $(INCDIR)/fnmatch.h mod_cern_meta.o: mod_cern_meta.c $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/util_script.h $(INCDIR)/http_log.h \ - $(INCDIR)/http_request.h -mod_cgi.o: mod_cgi.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ - $(OSDIR)/os.h $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_request.h $(INCDIR)/http_core.h \ - $(INCDIR)/http_protocol.h $(INCDIR)/http_main.h \ - $(INCDIR)/http_log.h $(INCDIR)/util_script.h \ - $(INCDIR)/http_conf_globals.h -mod_digest.o: mod_digest.c $(INCDIR)/httpd.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/util_script.h \ + $(INCDIR)/http_log.h $(INCDIR)/http_request.h +mod_cgi.o: mod_cgi.c $(INCDIR)/httpd.h $(INCDIR)/ap_types.h \ $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_core.h $(INCDIR)/http_log.h \ - $(INCDIR)/http_protocol.h $(INCDIR)/util_md5.h \ - $(INCDIR)/ap_md5.h -mod_dir.o: mod_dir.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ - $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ - $(OSDIR)/os.h $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_core.h $(INCDIR)/http_request.h \ - $(INCDIR)/http_protocol.h $(INCDIR)/http_log.h \ - $(INCDIR)/http_main.h $(INCDIR)/util_script.h -mod_env.o: mod_env.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ - $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ - $(OSDIR)/os.h $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h + $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_request.h \ + $(INCDIR)/http_core.h $(INCDIR)/http_protocol.h \ + $(INCDIR)/http_main.h $(INCDIR)/http_log.h \ + $(INCDIR)/util_script.h $(INCDIR)/http_conf_globals.h +mod_digest.o: mod_digest.c $(INCDIR)/httpd.h \ + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_core.h \ + $(INCDIR)/http_log.h $(INCDIR)/http_protocol.h \ + $(INCDIR)/util_md5.h $(INCDIR)/ap_md5.h +mod_dir.o: mod_dir.c $(INCDIR)/httpd.h $(INCDIR)/ap_types.h \ + $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ + $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ + $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_core.h \ + $(INCDIR)/http_request.h $(INCDIR)/http_protocol.h \ + $(INCDIR)/http_log.h $(INCDIR)/http_main.h \ + $(INCDIR)/util_script.h +mod_env.o: mod_env.c $(INCDIR)/httpd.h $(INCDIR)/ap_types.h \ + $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ + $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ + $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h mod_expires.o: mod_expires.c $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_log.h + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_log.h mod_headers.o: mod_headers.c $(INCDIR)/httpd.h \ + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h +mod_imap.o: mod_imap.c $(INCDIR)/httpd.h $(INCDIR)/ap_types.h \ $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h -mod_imap.o: mod_imap.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ - $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ - $(OSDIR)/os.h $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_request.h $(INCDIR)/http_core.h \ - $(INCDIR)/http_protocol.h $(INCDIR)/http_main.h \ - $(INCDIR)/http_log.h $(INCDIR)/util_script.h + $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_request.h \ + $(INCDIR)/http_core.h $(INCDIR)/http_protocol.h \ + $(INCDIR)/http_main.h $(INCDIR)/http_log.h \ + $(INCDIR)/util_script.h mod_include.o: mod_include.c $(INCDIR)/httpd.h \ + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_request.h \ + $(INCDIR)/http_core.h $(INCDIR)/http_protocol.h \ + $(INCDIR)/http_log.h $(INCDIR)/http_main.h \ + $(INCDIR)/util_script.h +mod_info.o: mod_info.c $(INCDIR)/httpd.h $(INCDIR)/ap_types.h \ $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_request.h $(INCDIR)/http_core.h \ - $(INCDIR)/http_protocol.h $(INCDIR)/http_log.h \ - $(INCDIR)/http_main.h $(INCDIR)/util_script.h -mod_info.o: mod_info.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ - $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ - $(OSDIR)/os.h $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_core.h $(INCDIR)/http_log.h \ - $(INCDIR)/http_main.h $(INCDIR)/http_protocol.h \ - $(INCDIR)/util_script.h $(INCDIR)/http_conf_globals.h + $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_core.h \ + $(INCDIR)/http_log.h $(INCDIR)/http_main.h \ + $(INCDIR)/http_protocol.h $(INCDIR)/util_script.h \ + $(INCDIR)/http_conf_globals.h mod_log_agent.o: mod_log_agent.c $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_log.h + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_log.h mod_log_config.o: mod_log_config.c $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_core.h $(INCDIR)/http_log.h -mod_log_referer.o: mod_log_referer.c $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_log.h -mod_mime.o: mod_mime.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ - $(OSDIR)/os.h $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_core.h \ $(INCDIR)/http_log.h -mod_mime_magic.o: mod_mime_magic.c $(INCDIR)/httpd.h \ +mod_log_referer.o: mod_log_referer.c $(INCDIR)/httpd.h \ + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_log.h +mod_mime.o: mod_mime.c $(INCDIR)/httpd.h $(INCDIR)/ap_types.h \ $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_request.h $(INCDIR)/http_core.h \ - $(INCDIR)/http_log.h $(INCDIR)/http_protocol.h + $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_log.h +mod_mime_magic.o: mod_mime_magic.c $(INCDIR)/httpd.h \ + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_request.h \ + $(INCDIR)/http_core.h $(INCDIR)/http_log.h \ + $(INCDIR)/http_protocol.h mod_negotiation.o: mod_negotiation.c $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_request.h $(INCDIR)/http_core.h \ + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_request.h \ + $(INCDIR)/http_protocol.h $(INCDIR)/http_core.h \ $(INCDIR)/http_log.h $(INCDIR)/util_script.h mod_rewrite.o: mod_rewrite.c mod_rewrite.h $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_conf_globals.h $(INCDIR)/http_request.h \ - $(INCDIR)/http_core.h $(INCDIR)/http_log.h \ - $(INCDIR)/http_vhost.h + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_conf_globals.h \ + $(INCDIR)/http_request.h $(INCDIR)/http_core.h \ + $(INCDIR)/http_log.h $(INCDIR)/http_vhost.h mod_setenvif.o: mod_setenvif.c $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_core.h $(INCDIR)/http_log.h -mod_so.o: mod_so.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ - $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ - $(OSDIR)/os.h $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_core.h \ $(INCDIR)/http_log.h -mod_speling.o: mod_speling.c $(INCDIR)/httpd.h \ +mod_so.o: mod_so.c $(INCDIR)/httpd.h $(INCDIR)/ap_types.h \ $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_core.h \ + $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_log.h +mod_speling.o: mod_speling.c $(INCDIR)/httpd.h \ + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h $(INCDIR)/http_core.h \ $(INCDIR)/http_config.h $(INCDIR)/http_log.h mod_status.o: mod_status.c $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_core.h $(INCDIR)/http_protocol.h \ - $(INCDIR)/http_conf_globals.h $(INCDIR)/http_main.h \ - $(INCDIR)/util_script.h $(INCDIR)/scoreboard.h \ - $(INCDIR)/http_log.h + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_core.h \ + $(INCDIR)/http_protocol.h $(INCDIR)/http_conf_globals.h \ + $(INCDIR)/http_main.h $(INCDIR)/util_script.h \ + $(INCDIR)/scoreboard.h $(INCDIR)/http_log.h mod_unique_id.o: mod_unique_id.c $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_log.h $(INCDIR)/multithread.h + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_log.h \ + $(INCDIR)/multithread.h mod_userdir.o: mod_userdir.c $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h mod_usertrack.o: mod_usertrack.c $(INCDIR)/httpd.h \ - $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ - $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ - $(INCDIR)/alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ - $(INCDIR)/http_core.h + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_core.h +mod_vhost_alias.o: mod_vhost_alias.c $(INCDIR)/httpd.h \ + $(INCDIR)/ap_types.h $(INCDIR)/ap_config.h \ + $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h \ + $(OSDIR)/os.h $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h $(INCDIR)/alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_config.h $(INCDIR)/http_core.h diff -Naur apache_1.3.12/src/modules/standard/mod_access.c-orig apache_1.3.12/src/modules/standard/mod_access.c --- apache_1.3.12/src/modules/standard/mod_access.c-orig Thu Aug 5 18:37:58 1999 +++ apache_1.3.12/src/modules/standard/mod_access.c Wed Feb 9 17:34:31 2000 @@ -81,8 +81,8 @@ union { char *from; struct { - unsigned long net; - unsigned long mask; + ap_uint32 net; + ap_uint32 mask; } ip; } x; enum allowdeny_type type; @@ -101,6 +101,7 @@ module MODULE_VAR_EXPORT access_module; +/*ARGSUSED1*/ static void *create_access_dir_config(pool *p, char *dummy) { access_dir_conf *conf = @@ -166,7 +167,7 @@ } else if ((s = strchr(where, '/'))) { - unsigned long mask; + ap_uint32 mask; a->type = T_IP; /* trample on where, we won't be using it any more */ @@ -198,7 +199,7 @@ a->type = T_FAIL; return "invalid mask in network/netmask"; } - mask = 0xFFFFFFFFUL << (32 - mask); + mask = ((ap_uint32) 0xFFFFFFFF) << (32 - mask); mask = htonl(mask); } a->x.ip.mask = mask; @@ -241,7 +242,7 @@ return "each octet must be between 0 and 255 inclusive"; } a->x.ip.net |= octet << shift; - a->x.ip.mask |= 0xFFUL << shift; + a->x.ip.mask |= ((ap_uint32) 0xFF) << shift; s = t; shift -= 8; } @@ -270,8 +271,8 @@ static int in_domain(const char *domain, const char *what) { - int dl = strlen(domain); - int wl = strlen(what); + int dl = ap_strlen(domain); + int wl = ap_strlen(what); if ((wl - dl) >= 0) { if (strcasecmp(domain, &what[wl - dl]) != 0) diff -Naur apache_1.3.12/src/modules/standard/mod_actions.c-orig apache_1.3.12/src/modules/standard/mod_actions.c --- apache_1.3.12/src/modules/standard/mod_actions.c-orig Wed Feb 2 12:44:00 2000 +++ apache_1.3.12/src/modules/standard/mod_actions.c Wed Mar 1 17:04:30 2000 @@ -103,6 +103,7 @@ module action_module; +/*ARGSUSED1*/ static void *create_action_dir_config(pool *p, char *dummy) { action_dir_config *new = @@ -133,6 +134,7 @@ return new; } +/*ARGSUSED*/ static const char *add_action(cmd_parms *cmd, action_dir_config *m, char *type, char *script) { @@ -140,6 +142,7 @@ return NULL; } +/*ARGSUSED*/ static const char *set_script(cmd_parms *cmd, action_dir_config *m, char *method, char *script) { diff -Naur apache_1.3.12/src/modules/standard/mod_alias.c-orig apache_1.3.12/src/modules/standard/mod_alias.c --- apache_1.3.12/src/modules/standard/mod_alias.c-orig Fri May 21 05:16:26 1999 +++ apache_1.3.12/src/modules/standard/mod_alias.c Wed Feb 9 17:34:31 2000 @@ -85,6 +85,7 @@ module MODULE_VAR_EXPORT alias_module; +/*ARGSUSED1*/ static void *create_alias_config(pool *p, server_rec *s) { alias_server_conf *a = @@ -95,6 +96,7 @@ return a; } +/*ARGSUSED1*/ static void *create_alias_dir_config(pool *p, char *d) { alias_dir_conf *a = @@ -123,6 +125,7 @@ return a; } +/*ARGSUSED1*/ static const char *add_alias_internal(cmd_parms *cmd, void *dummy, char *f, char *r, int use_regex) { @@ -164,7 +167,7 @@ server_rec *s = cmd->server; alias_server_conf *serverconf = (alias_server_conf *) ap_get_module_config(s->module_config, &alias_module); - int status = (int) (long) cmd->info; + int status = (int) (ap_ptr) cmd->info; regex_t *r = NULL; char *f = arg2; char *url = arg3; @@ -231,7 +234,7 @@ "a fakename and a realname"}, {"ScriptAlias", add_alias, "cgi-script", RSRC_CONF, TAKE2, "a fakename and a realname"}, - {"Redirect", add_redirect, (void *) HTTP_MOVED_TEMPORARILY, + {"Redirect", add_redirect, (void *) (ap_ptr) HTTP_MOVED_TEMPORARILY, OR_FILEINFO, TAKE23, "an optional status, then document to be redirected and destination URL"}, {"AliasMatch", add_alias_regex, NULL, RSRC_CONF, TAKE2, @@ -238,13 +241,13 @@ "a regular expression and a filename"}, {"ScriptAliasMatch", add_alias_regex, "cgi-script", RSRC_CONF, TAKE2, "a regular expression and a filename"}, - {"RedirectMatch", add_redirect_regex, (void *) HTTP_MOVED_TEMPORARILY, + {"RedirectMatch", add_redirect_regex, (void *) (ap_ptr) HTTP_MOVED_TEMPORARILY, OR_FILEINFO, TAKE23, "an optional status, then a regular expression and destination URL"}, - {"RedirectTemp", add_redirect, (void *) HTTP_MOVED_TEMPORARILY, + {"RedirectTemp", add_redirect, (void *) (ap_ptr) HTTP_MOVED_TEMPORARILY, OR_FILEINFO, TAKE2, "a document to be redirected, then the destination URL"}, - {"RedirectPermanent", add_redirect, (void *) HTTP_MOVED_PERMANENTLY, + {"RedirectPermanent", add_redirect, (void *) (ap_ptr) HTTP_MOVED_PERMANENTLY, OR_FILEINFO, TAKE2, "a document to be redirected, then the destination URL"}, {NULL} @@ -285,7 +288,7 @@ * doubled slashes) */ - return urip - uri; + return (int) (urip - uri); } static char *try_alias_list(request_rec *r, array_header *aliases, int doesc, int *status) diff -Naur apache_1.3.12/src/modules/standard/mod_auth.c-orig apache_1.3.12/src/modules/standard/mod_auth.c --- apache_1.3.12/src/modules/standard/mod_auth.c-orig Sat Feb 5 04:33:15 2000 +++ apache_1.3.12/src/modules/standard/mod_auth.c Wed Mar 1 17:04:31 2000 @@ -81,6 +81,7 @@ int auth_authoritative; } auth_config_rec; +/*ARGSUSED1*/ static void *create_auth_dir_config(pool *p, char *d) { auth_config_rec *sec = diff -Naur apache_1.3.12/src/modules/standard/mod_auth_anon.c-orig apache_1.3.12/src/modules/standard/mod_auth_anon.c --- apache_1.3.12/src/modules/standard/mod_auth_anon.c-orig Thu Oct 21 13:45:15 1999 +++ apache_1.3.12/src/modules/standard/mod_auth_anon.c Wed Feb 9 17:34:31 2000 @@ -116,6 +116,7 @@ } anon_auth_config_rec; +/*ARGSUSED1*/ static void *create_anon_auth_dir_config(pool *p, char *d) { anon_auth_config_rec *sec = (anon_auth_config_rec *) @@ -135,6 +136,7 @@ return sec; } +/*ARGSUSED*/ static const char *anon_set_passwd_flag(cmd_parms *cmd, anon_auth_config_rec * sec, int arg) { @@ -142,6 +144,7 @@ return NULL; } +/*ARGSUSED*/ static const char *anon_set_userid_flag(cmd_parms *cmd, anon_auth_config_rec * sec, int arg) { @@ -148,6 +151,7 @@ sec->auth_anon_nouserid = arg; return NULL; } +/*ARGSUSED*/ static const char *anon_set_logemail_flag(cmd_parms *cmd, anon_auth_config_rec * sec, int arg) { @@ -154,6 +158,7 @@ sec->auth_anon_logemail = arg; return NULL; } +/*ARGSUSED*/ static const char *anon_set_verifyemail_flag(cmd_parms *cmd, anon_auth_config_rec * sec, int arg) { @@ -160,6 +165,7 @@ sec->auth_anon_verifyemail = arg; return NULL; } +/*ARGSUSED*/ static const char *anon_set_authoritative_flag(cmd_parms *cmd, anon_auth_config_rec * sec, int arg) { @@ -271,9 +277,9 @@ return DECLINED; } +#ifdef NOTYET static int check_anon_access(request_rec *r) { -#ifdef NOTYET conn_rec *c = r->connection; anon_auth_config_rec *sec = (anon_auth_config_rec *) ap_get_module_config(r->per_dir_config, @@ -286,10 +292,14 @@ return DECLINED; return OK; -#endif +} +#else +/*ARGSUSED*/ +static int check_anon_access(request_rec *r) +{ return DECLINED; } - +#endif module MODULE_VAR_EXPORT anon_auth_module = { diff -Naur apache_1.3.12/src/modules/standard/mod_auth_dbm.c-orig apache_1.3.12/src/modules/standard/mod_auth_dbm.c --- apache_1.3.12/src/modules/standard/mod_auth_dbm.c-orig Mon Aug 2 13:50:22 1999 +++ apache_1.3.12/src/modules/standard/mod_auth_dbm.c Wed Feb 9 17:34:31 2000 @@ -102,6 +102,7 @@ } dbm_auth_config_rec; +/*ARGSUSED1*/ static void *create_dbm_auth_dir_config(pool *p, char *d) { dbm_auth_config_rec *sec diff -Naur apache_1.3.12/src/modules/standard/mod_autoindex.c-orig apache_1.3.12/src/modules/standard/mod_autoindex.c --- apache_1.3.12/src/modules/standard/mod_autoindex.c-orig Wed Feb 2 12:44:01 2000 +++ apache_1.3.12/src/modules/standard/mod_autoindex.c Wed Mar 1 17:04:32 2000 @@ -294,6 +294,7 @@ #define WILDCARDS_REQUIRED 0 #endif +/*ARGSUSED*/ static const char *add_desc(cmd_parms *cmd, void *d, char *desc, char *to) { autoindex_config_rec *dcfg = (autoindex_config_rec *) d; @@ -340,6 +341,7 @@ /* A legacy directive, FancyIndexing is superseded by the IndexOptions * keyword. But for compatibility.. */ +/*ARGSUSED0*/ static const char *fancy_indexing(cmd_parms *cmd, void *d, int arg) { int curopts; @@ -594,6 +596,7 @@ {NULL} }; +/*ARGSUSED1*/ static void *create_autoindex_config(pool *p, char *dummy) { autoindex_config_rec *new = @@ -938,7 +941,7 @@ ap_rputs("
      \n", r);
           while (!feof(f)) {
       	do {
      -	    n = fread(buf, sizeof(char), IOBUFSIZE, f);
      +	    n = (int) fread(buf, sizeof(char), IOBUFSIZE, f);
       	}
       	while (n == -1 && ferror(f) && errno == EINTR);
       	if (n == -1 || n == 0) {
      @@ -1151,7 +1154,7 @@
               if (!(thefile = ap_pfopen(r->pool, r->filename, "r"))) {
       	    return NULL;
       	}
      -	n = fread(titlebuf, sizeof(char), MAX_STRING_LEN - 1, thefile);
      +	n = (int) fread(titlebuf, sizeof(char), MAX_STRING_LEN - 1, thefile);
       	if (n <= 0) {
       	    ap_pfclose(r->pool, thefile);
       	    return NULL;
      @@ -1263,6 +1266,7 @@
           return (p);
       }
       
      +/*ARGSUSED0*/
       static char *terminate_description(autoindex_config_rec *d, char *desc,
       				   int autoindex_opts, int desc_width)
       {
      @@ -1362,7 +1366,7 @@
           if (d->desc_adjust == K_ADJUST) {
       	for (x = 0; x < n; x++) {
       	    if (ar[x]->desc != NULL) {
      -		int t = strlen(ar[x]->desc);
      +		int t = ap_strlen(ar[x]->desc);
       		if (t > desc_width) {
       		    desc_width = t;
       		}
      @@ -1372,7 +1376,7 @@
           name_width = d->name_width;
           if (d->name_adjust == K_ADJUST) {
       	for (x = 0; x < n; x++) {
      -	    int t = strlen(ar[x]->name);
      +	    int t = ap_strlen(ar[x]->name);
       	    if (t > name_width) {
       		name_width = t;
       	    }
      @@ -1466,7 +1470,7 @@
       		ap_rputs("", r);
       	    }
       
      -	    nwidth = strlen(t2);
      +	    nwidth = ap_strlen(t2);
       	    if (nwidth > name_width) {
       		memcpy(name_scratch, t2, name_width - 3);
       		name_scratch[name_width - 3] = '.';
      diff -Naur apache_1.3.12/src/modules/standard/mod_cern_meta.c-orig apache_1.3.12/src/modules/standard/mod_cern_meta.c
      --- apache_1.3.12/src/modules/standard/mod_cern_meta.c-orig	Sat Feb  5 04:33:16 2000
      +++ apache_1.3.12/src/modules/standard/mod_cern_meta.c	Wed Mar  1 17:17:39 2000
      @@ -172,6 +172,7 @@
           int metafiles;
       } cern_meta_dir_config;
       
      +/*ARGSUSED1*/
       static void *create_cern_meta_dir_config(pool *p, char *dummy)
       {
           cern_meta_dir_config *new =
      @@ -198,6 +199,7 @@
           return new;
       }
       
      +/*ARGSUSED*/
       static const char *set_metadir(cmd_parms *parms, cern_meta_dir_config * dconf, char *arg)
       {
           dconf->metadir = arg;
      @@ -204,6 +206,7 @@
           return NULL;
       }
       
      +/*ARGSUSED1*/
       static const char *set_metasuffix(cmd_parms *parms, cern_meta_dir_config * dconf, char *arg)
       {
           dconf->metasuffix = arg;
      @@ -210,6 +213,7 @@
           return NULL;
       }
       
      +/*ARGSUSED*/
       static const char *set_metafiles(cmd_parms *parms, cern_meta_dir_config * dconf, int arg)
       {
           dconf->metafiles = arg;
      @@ -235,7 +239,7 @@
       {
           char w[MAX_STRING_LEN];
           char *l;
      -    int p;
      +    size_t p;
           table *tmp_headers;
       
           tmp_headers = ap_make_table(r->pool, 5);
      diff -Naur apache_1.3.12/src/modules/standard/mod_cgi.c-orig apache_1.3.12/src/modules/standard/mod_cgi.c
      --- apache_1.3.12/src/modules/standard/mod_cgi.c-orig	Thu Oct 21 13:45:22 1999
      +++ apache_1.3.12/src/modules/standard/mod_cgi.c	Wed Feb  9 17:34:31 2000
      @@ -103,6 +103,7 @@
           int bufbytes;
       } cgi_server_conf;
       
      +/*ARGSUSED1*/
       static void *create_cgi_config(pool *p, server_rec *s)
       {
           cgi_server_conf *c =
      @@ -115,6 +116,7 @@
           return c;
       }
       
      +/*ARGSUSED*/
       static void *merge_cgi_config(pool *p, void *basev, void *overridesv)
       {
           cgi_server_conf *base = (cgi_server_conf *) basev, *overrides = (cgi_server_conf *) overridesv;
      @@ -122,6 +124,7 @@
           return overrides->logname ? overrides : base;
       }
       
      +/*ARGSUSED1*/
       static const char *set_scriptlog(cmd_parms *cmd, void *dummy, char *arg)
       {
           server_rec *s = cmd->server;
      @@ -132,6 +135,7 @@
           return NULL;
       }
       
      +/*ARGSUSED1*/
       static const char *set_scriptlog_length(cmd_parms *cmd, void *dummy, char *arg)
       {
           server_rec *s = cmd->server;
      @@ -142,6 +146,7 @@
           return NULL;
       }
       
      +/*ARGSUSED1*/
       static const char *set_scriptlog_buffer(cmd_parms *cmd, void *dummy, char *arg)
       {
           server_rec *s = cmd->server;
      @@ -300,7 +305,9 @@
           struct cgi_child_stuff *cld = (struct cgi_child_stuff *) child_stuff;
           request_rec *r = cld->r;
           char *argv0 = cld->argv0;
      +#if defined(WIN32) || defined(OS2)
           int child_pid;
      +#endif
       
       #ifdef DEBUG_CGI
       #ifdef OS2
      @@ -344,7 +351,10 @@
       #else
           ap_cleanup_for_exec();
       
      -    child_pid = ap_call_exec(r, pinfo, argv0, env, 0);
      +#if defined(WIN32) || defined(OS2)
      +    child_pid = 
      +#endif
      +    ap_call_exec(r, pinfo, argv0, env, 0);
       #if defined(WIN32) || defined(OS2)
           return (child_pid);
       #else
      diff -Naur apache_1.3.12/src/modules/standard/mod_digest.c-orig apache_1.3.12/src/modules/standard/mod_digest.c
      --- apache_1.3.12/src/modules/standard/mod_digest.c-orig	Wed Jan 12 07:23:24 2000
      +++ apache_1.3.12/src/modules/standard/mod_digest.c	Wed Feb  9 17:34:31 2000
      @@ -82,6 +82,7 @@
           char *digest;
       } digest_header_rec;
       
      +/*ARGSUSED1*/
       static void *create_digest_dir_config(pool *p, char *d)
       {
           return ap_pcalloc(p, sizeof(digest_config_rec));
      @@ -137,7 +138,7 @@
       static int get_digest_rec(request_rec *r, digest_header_rec * response)
       {
           const char *auth_line;
      -    int l;
      +    size_t l;
           int s, vk = 0, vv = 0;
           const char *t;
           char *key, *value;
      diff -Naur apache_1.3.12/src/modules/standard/mod_dir.c-orig apache_1.3.12/src/modules/standard/mod_dir.c
      --- apache_1.3.12/src/modules/standard/mod_dir.c-orig	Sat May  1 06:42:09 1999
      +++ apache_1.3.12/src/modules/standard/mod_dir.c	Wed Feb  9 17:34:31 2000
      @@ -95,6 +95,7 @@
           {NULL}
       };
       
      +/*ARGSUSED1*/
       static void *create_dir_config(pool *p, char *dummy)
       {
           dir_config_rec *new =
      diff -Naur apache_1.3.12/src/modules/standard/mod_env.c-orig apache_1.3.12/src/modules/standard/mod_env.c
      --- apache_1.3.12/src/modules/standard/mod_env.c-orig	Sat Apr 10 14:51:06 1999
      +++ apache_1.3.12/src/modules/standard/mod_env.c	Wed Feb  9 17:34:31 2000
      @@ -109,6 +109,7 @@
       
       module MODULE_VAR_EXPORT env_module;
       
      +/*ARGSUSED1*/
       static void *create_env_dir_config(pool *p, char *dummy)
       {
           env_dir_config_rec *new =
      diff -Naur apache_1.3.12/src/modules/standard/mod_expires.c-orig apache_1.3.12/src/modules/standard/mod_expires.c
      --- apache_1.3.12/src/modules/standard/mod_expires.c-orig	Wed Feb  2 12:44:02 2000
      +++ apache_1.3.12/src/modules/standard/mod_expires.c	Wed Mar  1 17:04:32 2000
      @@ -213,6 +213,7 @@
       
       module MODULE_VAR_EXPORT expires_module;
       
      +/*ARGSUSED1*/
       static void *create_dir_expires_config(pool *p, char *dummy)
       {
           expires_dir_config *new =
      @@ -223,6 +224,7 @@
           return (void *) new;
       }
       
      +/*ARGSUSED*/
       static const char *set_expiresactive(cmd_parms *cmd, expires_dir_config * dir_config, int arg)
       {
           /* if we're here at all it's because someone explicitly
      diff -Naur apache_1.3.12/src/modules/standard/mod_headers.c-orig apache_1.3.12/src/modules/standard/mod_headers.c
      --- apache_1.3.12/src/modules/standard/mod_headers.c-orig	Wed Oct 27 02:26:53 1999
      +++ apache_1.3.12/src/modules/standard/mod_headers.c	Wed Feb  9 17:34:31 2000
      @@ -127,6 +127,7 @@
       
       module MODULE_VAR_EXPORT headers_module;
       
      +/*ARGSUSED1*/
       static void *create_headers_config(pool *p, server_rec *s)
       {
           headers_conf *a =
      @@ -136,6 +137,7 @@
           return a;
       }
       
      +/*ARGSUSED1*/
       static void *create_headers_dir_config(pool *p, char *d)
       {
           return (headers_conf *) create_headers_config(p, NULL);
      diff -Naur apache_1.3.12/src/modules/standard/mod_imap.c-orig apache_1.3.12/src/modules/standard/mod_imap.c
      --- apache_1.3.12/src/modules/standard/mod_imap.c-orig	Sat Jun  5 08:48:12 1999
      +++ apache_1.3.12/src/modules/standard/mod_imap.c	Wed Feb  9 17:34:31 2000
      @@ -121,6 +121,7 @@
           char *imap_base;
       } imap_conf_rec;
       
      +/*ARGSUSED1*/
       static void *create_imap_dir_config(pool *p, char *dummy)
       {
           imap_conf_rec *icr =
      @@ -441,7 +442,7 @@
       
           while (!strncmp(value, "../", 3) || !strcmp(value, "..")) {
       
      -        if (directory && (slen = strlen(directory))) {
      +        if (directory && (slen = ap_strlen(directory))) {
       
                   /* for each '..',  knock a directory off the end 
                      by ending the string right at the last slash.
      @@ -456,7 +457,7 @@
                       if ((string_pos = strrchr(directory, '/'))) {
                           *string_pos = '\0';
       		}
      -                clen = strlen(directory);
      +                clen = ap_strlen(directory);
                       if (clen == 0) {
                           break;
       		}
      diff -Naur apache_1.3.12/src/modules/standard/mod_include.c-orig apache_1.3.12/src/modules/standard/mod_include.c
      --- apache_1.3.12/src/modules/standard/mod_include.c-orig	Wed Feb  2 12:44:03 2000
      +++ apache_1.3.12/src/modules/standard/mod_include.c	Wed Mar  1 17:17:39 2000
      @@ -208,13 +208,13 @@
       
       static int find_string(FILE *in, const char *str, request_rec *r, int printing)
       {
      -    int x, l = strlen(str), p;
      +    int x, l = ap_strlen(str), p;
           char outbuf[OUTBUFSIZE];
           int outind = 0;
           char c;
       
           p = 0;
      -    while (1) {
      +    for (;;) {
               GET_CHAR(in, c, 1, r);
               if (c == str[p]) {
                   if ((++p) == l) {
      @@ -378,7 +378,7 @@
           }
       
           /* find end of tag name */
      -    while (1) {
      +    for (;;) {
               if (t - tag == tagbuf_len) {
                   *t = '\0';
                   return NULL;
      @@ -411,7 +411,7 @@
               return NULL;
           }
           term = c;
      -    while (1) {
      +    for (;;) {
               GET_CHAR(in, c, NULL, p);
               if (t - tag == tagbuf_len) {
                   *t = '\0';
      @@ -446,7 +446,7 @@
           --len;
       
           /* skip initial whitespace */
      -    while (1) {
      +    for (;;) {
               GET_CHAR(in, c, 1, p);
               if (!ap_isspace(c)) {
                   break;
      @@ -453,7 +453,7 @@
               }
           }
           /* now get directive */
      -    while (1) {
      +    for (;;) {
       	if (d - dest == len) {
       	    return 1;
       	}
      @@ -652,7 +652,7 @@
           char parsed_string[MAX_STRING_LEN];
           char *tag_val;
       
      -    while (1) {
      +    for (;;) {
               if (!(tag_val = get_tag(r->pool, in, tag, sizeof(tag), 1))) {
                   return 1;
               }
      @@ -875,7 +875,7 @@
           char *file = r->filename;
           char parsed_string[MAX_STRING_LEN];
       
      -    while (1) {
      +    for (;;) {
               if (!(tag_val = get_tag(r->pool, in, tag, sizeof(tag), 1))) {
                   return 1;
               }
      @@ -926,7 +926,7 @@
       
           encode = E_ENTITY;
       
      -    while (1) {
      +    for (;;) {
               if (!(tag_val = get_tag(r->pool, in, tag, sizeof(tag), 1))) {
                   return 1;
               }
      @@ -988,7 +988,7 @@
       		      r->filename);
               return DECLINED;
           }
      -    while (1) {
      +    for (;;) {
               if (!(tag_val = get_tag(r->pool, in, tag, sizeof(tag), 1))) {
                   break;
               }
      @@ -1021,7 +1021,7 @@
           char parsed_string[MAX_STRING_LEN];
           table *env = r->subprocess_env;
       
      -    while (1) {
      +    for (;;) {
               if (!(tag_val = get_tag(r->pool, in, tag, sizeof(tag), 0))) {
                   return 1;
               }
      @@ -1137,7 +1137,7 @@
           struct stat finfo;
           char parsed_string[MAX_STRING_LEN];
       
      -    while (1) {
      +    for (;;) {
               if (!(tag_val = get_tag(r->pool, in, tag, sizeof(tag), 1))) {
                   return 1;
               }
      @@ -1153,11 +1153,18 @@
                       else {
                           int l, x;
       #if defined(AP_OFF_T_IS_QUAD)
      +#if defined(IRIX) && _MIPS_SIM != _ABIO32
      +/* disable warning about invalid format string conversion (irix uses ll not q for 64-bit values) */
      +#pragma set woff 1199
      +#endif
                           ap_snprintf(tag, sizeof(tag), "%qd", finfo.st_size);
      +#if defined(IRIX) && _MIPS_SIM != _ABIO32
      +#pragma reset woff 1199
      +#endif
       #else
      -                    ap_snprintf(tag, sizeof(tag), "%ld", finfo.st_size);
      +                    ap_snprintf(tag, sizeof(tag), "%ld", (long) finfo.st_size);
       #endif
      -                    l = strlen(tag);    /* grrr */
      +                    l = ap_strlen(tag);    /* grrr */
                           for (x = 0; x < l; x++) {
                               if (x && (!((l - x) % 3))) {
                                   ap_rputc(',', r);
      @@ -1177,7 +1184,7 @@
           struct stat finfo;
           char parsed_string[MAX_STRING_LEN];
       
      -    while (1) {
      +    for (;;) {
               if (!(tag_val = get_tag(r->pool, in, tag, sizeof(tag), 1))) {
                   return 1;
               }
      @@ -1401,7 +1408,7 @@
           expr_pool = ap_make_sub_pool(r->pool);
       
           /* Create Parse Tree */
      -    while (1) {
      +    for (;;) {
               new = (struct parse_node *) ap_palloc(expr_pool,
                                                  sizeof(struct parse_node));
               new->parent = new->left = new->right = (struct parse_node *) NULL;
      @@ -1781,7 +1788,7 @@
                   ap_cpystrn(current->right->token.value, buffer,
       			sizeof(current->right->token.value));
                   if (current->right->token.value[0] == '/') {
      -                int len;
      +                size_t len;
                       len = strlen(current->right->token.value);
                       if (current->right->token.value[len - 1] == '/') {
                           current->right->token.value[len - 1] = '\0';
      @@ -1949,7 +1956,7 @@
           char *expr;
       
           expr = NULL;
      -    while (1) {
      +    for (;;) {
               tag_val = get_tag(r->pool, in, tag, sizeof(tag), 0);
               if (*tag == '\0') {
                   return 1;
      @@ -1992,7 +1999,7 @@
           char *expr;
       
           expr = NULL;
      -    while (1) {
      +    for (;;) {
               tag_val = get_tag(r->pool, in, tag, sizeof(tag), 0);
               if (*tag == '\0') {
                   return 1;
      @@ -2097,7 +2104,7 @@
           char *var;
       
           var = (char *) NULL;
      -    while (1) {
      +    for (;;) {
               if (!(tag_val = get_tag(r->pool, in, tag, sizeof(tag), 1))) {
                   return 1;
               }
      @@ -2130,12 +2137,11 @@
       static int handle_printenv(FILE *in, request_rec *r, const char *error)
       {
           char tag[MAX_STRING_LEN];
      -    char *tag_val;
           array_header *arr = ap_table_elts(r->subprocess_env);
           table_entry *elts = (table_entry *) arr->elts;
           int i;
       
      -    if (!(tag_val = get_tag(r->pool, in, tag, sizeof(tag), 1))) {
      +    if (!get_tag(r->pool, in, tag, sizeof(tag), 1)) {
               return 1;
           }
           else if (!strcmp(tag, "done")) {
      @@ -2190,7 +2196,7 @@
                         ap_escape_shell_cmd(r->pool, arg_copy));
           }
       
      -    while (1) {
      +    for (;;) {
               if (!find_string(f, STARTING_SEQUENCE, r, printing)) {
                   if (get_directive(f, directive, sizeof(directive), r->pool)) {
       		ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r,
      @@ -2317,6 +2323,7 @@
       #define DEFAULT_XBITHACK xbithack_off
       #endif
       
      +/*ARGSUSED1*/
       static void *create_includes_dir_config(pool *p, char *dummy)
       {
           enum xbithack *result = (enum xbithack *) ap_palloc(p, sizeof(enum xbithack));
      @@ -2324,6 +2331,7 @@
           return result;
       }
       
      +/*ARGSUSED0*/
       static const char *set_xbithack(cmd_parms *cmd, void *xbp, char *arg)
       {
           enum xbithack *state = (enum xbithack *) xbp;
      diff -Naur apache_1.3.12/src/modules/standard/mod_info.c-orig apache_1.3.12/src/modules/standard/mod_info.c
      --- apache_1.3.12/src/modules/standard/mod_info.c-orig	Mon Dec  6 20:54:29 1999
      +++ apache_1.3.12/src/modules/standard/mod_info.c	Wed Feb  9 17:34:31 2000
      @@ -105,6 +105,7 @@
       module MODULE_VAR_EXPORT info_module;
       extern module *top_module;
       
      +/*ARGSUSED1*/
       static void *create_info_config(pool *p, server_rec *s)
       {
           info_svr_conf *conf = (info_svr_conf *) ap_pcalloc(p, sizeof(info_svr_conf));
      @@ -645,6 +646,7 @@
           return 0;
       }
       
      +/*ARGSUSED1*/
       static const char *add_module_info(cmd_parms *cmd, void *dummy, char *name,
                                          char *info)
       {
      diff -Naur apache_1.3.12/src/modules/standard/mod_log_agent.c-orig apache_1.3.12/src/modules/standard/mod_log_agent.c
      --- apache_1.3.12/src/modules/standard/mod_log_agent.c-orig	Fri Jan  1 11:05:10 1999
      +++ apache_1.3.12/src/modules/standard/mod_log_agent.c	Wed Feb  9 17:34:31 2000
      @@ -75,6 +75,7 @@
           int agent_fd;
       } agent_log_state;
       
      +/*ARGSUSED1*/
       static void *make_agent_log_state(pool *p, server_rec *s)
       {
           agent_log_state *cls =
      @@ -86,6 +87,7 @@
           return (void *) cls;
       }
       
      +/*ARGSUSED1*/
       static const char *set_agent_log(cmd_parms *parms, void *dummy, char *arg)
       {
           agent_log_state *cls = ap_get_module_config(parms->server->module_config,
      diff -Naur apache_1.3.12/src/modules/standard/mod_log_config.c-orig apache_1.3.12/src/modules/standard/mod_log_config.c
      --- apache_1.3.12/src/modules/standard/mod_log_config.c-orig	Wed Feb  2 12:44:04 2000
      +++ apache_1.3.12/src/modules/standard/mod_log_config.c	Wed Mar  1 17:04:33 2000
      @@ -172,8 +172,6 @@
        *
        * --- rst */
       
      -#define DEFAULT_LOG_FORMAT "%h %l %u %t \"%r\" %>s %b"
      -
       #include "httpd.h"
       #include "http_config.h"
       #include "http_core.h"          /* For REMOTE_NAME */
      @@ -190,6 +188,20 @@
       static mode_t xfer_mode = (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
       #endif
       
      +static const char common_log_format[] = "%h %l %u %t \"%r\" %>s %b";
      +#ifdef USE_QUICK_LOG
      +#define QUICK_CLF_MARKER	((array_header *) (ap_ptr) 0x1)
      +
      +static const char quick_log_format[] = "%a %l %u %t \"%r\" %>s %b";
      +#define QUICK_QLF_MARKER	((array_header *) (ap_ptr) 0x2)
      +#endif
      +
      +/*
      + * Increasing LOG_BUFSIZE beyond PIPE_BUF is good for performance but do
      + * so only if you know you're not using piped logs and your system can
      + * write more than PIPE_BUF bytes atomically to disk at once
      + */
      +#ifndef LOG_BUFSIZE
       /* POSIX.1 defines PIPE_BUF as the maximum number of bytes that is
        * guaranteed to be atomic when writing a pipe.  And PIPE_BUF >= 512
        * is guaranteed.  So we'll just guess 512 in the event the system
      @@ -204,6 +216,7 @@
       #else
       #define LOG_BUFSIZE     (512)
       #endif
      +#endif
       
       /*
        * multi_log_state is our per-(virtual)-server configuration. We store
      @@ -254,140 +267,179 @@
        * Note that many of these could have ap_sprintfs replaced with static buffers.
        */
       
      -typedef const char *(*item_key_func) (request_rec *, char *);
      +typedef const char *(*item_key_func) (request_rec *, char *, size_t *);
       
       typedef struct {
           item_key_func func;
           char *arg;
      +    size_t arglen;
           int condition_sense;
           int want_orig;
           array_header *conditions;
       } log_format_item;
       
      -static char *format_integer(pool *p, int i)
      -{
      -    return ap_psprintf(p, "%d", i);
      -}
      -
      -static char *pfmt(pool *p, int i)
      -{
      -    if (i <= 0) {
      -        return "-";
      -    }
      -    else {
      -        return format_integer(p, i);
      -    }
      -}
      -
      -static const char *constant_item(request_rec *dummy, char *stuff)
      +/*ARGSUSED*/
      +static const char *constant_item(request_rec *dummy, char *stuff, size_t *rlen)
       {
           return stuff;
       }
       
      -static const char *log_remote_host(request_rec *r, char *a)
      +/*ARGSUSED1*/
      +static const char *log_remote_host(request_rec *r, char *a, size_t *rlen)
       {
           return ap_get_remote_host(r->connection, r->per_dir_config,
                                           REMOTE_NAME);
       }
       
      -static const char *log_remote_address(request_rec *r, char *a)
      +/*ARGSUSED1*/
      +static const char *log_remote_address(request_rec *r, char *a, size_t *rlen)
       {
      +    *rlen = r->connection->remote_ip_len;
           return r->connection->remote_ip;
       }
       
      -static const char *log_local_address(request_rec *r, char *a)
      +/*ARGSUSED1*/
      +static const char *log_local_address(request_rec *r, char *a, size_t *rlen)
       {
      +    *rlen = r->connection->local_ip_len;
           return r->connection->local_ip;
       }
       
      -static const char *log_remote_logname(request_rec *r, char *a)
      +/*ARGSUSED1*/
      +static const char *log_remote_logname(request_rec *r, char *a, size_t *rlen)
       {
           return ap_get_remote_logname(r);
       }
       
      -static const char *log_remote_user(request_rec *r, char *a)
      +/*ARGSUSED*/
      +static const char *log_remote_user(request_rec *r, char *a, size_t *rlen)
       {
           char *rvalue = r->connection->user;
       
      -    if (rvalue == NULL) {
      -        rvalue = "-";
      -    }
      -    else if (strlen(rvalue) == 0) {
      -        rvalue = "\"\"";
      +    if (rvalue && *rvalue == 0) {
      +#if defined(IRIX) && _MIPS_SIM != _ABIO32
      +#pragma mips_frequency_hint NEVER
      +#endif
      +	rvalue = "\"\"";
      +	*rlen = 2;
           }
      +
           return rvalue;
       }
       
      -static const char *log_request_line(request_rec *r, char *a)
      +/*ARGSUSED1*/
      +static const char *log_request_line(request_rec *r, char *a, size_t *rlen)
       {
      -	    /* NOTE: If the original request contained a password, we
      -	     * re-write the request line here to contain XXXXXX instead:
      -	     * (note the truncation before the protocol string for HTTP/0.9 requests)
      -	     * (note also that r->the_request contains the unmodified request)
      -	     */
      -    return (r->parsed_uri.password) ? ap_pstrcat(r->pool, r->method, " ",
      -					 ap_unparse_uri_components(r->pool, &r->parsed_uri, 0),
      -					 r->assbackwards ? NULL : " ", r->protocol, NULL)
      -					: r->the_request;
      +    /* NOTE: If the original request contained a password, we
      +     * re-write the request line here to contain XXXXXX instead:
      +     * (note the truncation before the protocol string for HTTP/0.9 requests)
      +     * (note also that r->the_request contains the unmodified request)
      +     */
      +
      +    if (r->parsed_uri.password == NULL) {
      +	*rlen = r->the_request_len;
      +	return r->the_request;
      +    }
      +
      +    return ap_pstrcat(r->pool, r->method, " ",
      +	ap_unparse_uri_components(r->pool, &r->parsed_uri, 0),
      +	r->assbackwards ? NULL : " ", r->protocol, NULL);
       }
       
      -static const char *log_request_file(request_rec *r, char *a)
      +/*ARGSUSED1*/
      +static const char *log_request_file(request_rec *r, char *a, size_t *rlen)
       {
           return r->filename;
       }
      -static const char *log_request_uri(request_rec *r, char *a)
      +
      +/*ARGSUSED1*/
      +static const char *log_request_uri(request_rec *r, char *a, size_t *rlen)
       {
           return r->uri;
       }
      -static const char *log_request_method(request_rec *r, char *a)
      +
      +/*ARGSUSED1*/
      +static const char *log_request_method(request_rec *r, char *a, size_t *rlen)
       {
           return r->method;
       }
      -static const char *log_request_protocol(request_rec *r, char *a)
      +
      +/*ARGSUSED1*/
      +static const char *log_request_protocol(request_rec *r, char *a, size_t *rlen)
       {
           return r->protocol;
       }
      -static const char *log_request_query(request_rec *r, char *a)
      +
      +/*ARGSUSED1*/
      +static const char *log_request_query(request_rec *r, char *a, size_t *rlen)
       {
           return (r->args != NULL) ? ap_pstrcat(r->pool, "?", r->args, NULL)
                                    : "";
       }
      -static const char *log_status(request_rec *r, char *a)
      +
      +/*ARGSUSED*/
      +static const char *log_status(request_rec *r, char *a, size_t *rlen)
       {
      -    return pfmt(r->pool, r->status);
      +    /* Cache the last converted status. */
      +    static struct {
      +	int	status;
      +	char	str[16];
      +	size_t	len;
      +    } last;
      +
      +    if (r->status > 0) {
      +	if (r->status != last.status) {
      +#if defined(IRIX) && _MIPS_SIM != _ABIO32
      +#pragma mips_frequency_hint NEVER
      +#endif
      +	    last.status = r->status;
      +	    last.len = sprintf(last.str, "%d", last.status);
      +	}
      +
      +	*rlen = last.len;
      +	return last.str;
      +    }
      +
      +    return NULL;
       }
       
      -static const char *clf_log_bytes_sent(request_rec *r, char *a)
      +/*ARGSUSED1*/
      +static const char *clf_log_bytes_sent(request_rec *r, char *a, size_t *rlen)
       {
      -    if (!r->sent_bodyct) {
      -        return "-";
      -    }
      +    const char *cp;
      +    const char *length;
      +
      +    if (!r->sent_bodyct)
      +        cp = NULL;
      +    else if ((length = ap_table_get(r->headers_out, "Content-Length")) != NULL)
      +	cp = length;
           else {
      -        long int bs;
      +        ap_int32 bs;
               ap_bgetopt(r->connection->client, BO_BYTECT, &bs);
      -	return ap_psprintf(r->pool, "%ld", bs);
      +	cp = ap_psprintf(r->pool, "%ld", (long) bs);
           }
      +
      +    return cp;
       }
       
      -static const char *log_bytes_sent(request_rec *r, char *a)
      +static const char *log_bytes_sent(request_rec *r, char *a, size_t *rlen)
       {
      -    if (!r->sent_bodyct) {
      -        return "0";
      -    }
      -    else {
      -        long int bs;
      -        ap_bgetopt(r->connection->client, BO_BYTECT, &bs);
      -	return ap_psprintf(r->pool, "%ld", bs);
      +    const char *cp = clf_log_bytes_sent(r, a, rlen);
      +    if (cp == NULL) {
      +	cp = "0";
      +	*rlen = 1;
           }
      +    return cp;
       }
       
      -
      -static const char *log_header_in(request_rec *r, char *a)
      +/*ARGSUSED2*/
      +static const char *log_header_in(request_rec *r, char *a, size_t *rlen)
       {
           return ap_table_get(r->headers_in, a);
       }
       
      -static const char *log_header_out(request_rec *r, char *a)
      +/*ARGSUSED2*/
      +static const char *log_header_out(request_rec *r, char *a, size_t *rlen)
       {
           const char *cp = ap_table_get(r->headers_out, a);
           if (!strcasecmp(a, "Content-type") && r->content_type) {
      @@ -399,55 +451,83 @@
           return ap_table_get(r->err_headers_out, a);
       }
       
      -static const char *log_note(request_rec *r, char *a)
      +/*ARGSUSED2*/
      +static const char *log_note(request_rec *r, char *a, size_t *rlen)
       {
           return ap_table_get(r->notes, a);
       }
      -static const char *log_env_var(request_rec *r, char *a)
      +
      +/*ARGSUSED2*/
      +static const char *log_env_var(request_rec *r, char *a, size_t *rlen)
       {
           return ap_table_get(r->subprocess_env, a);
       }
       
      -static const char *log_request_time(request_rec *r, char *a)
      +static const char *log_request_time(request_rec *r, char *a, size_t *rlen)
       {
      +    /* Cache the last converted time.  See ap_gm_timestr_822(). */
      +    static struct {
      +	time_t	time;
      +	char	str[64];
      +	size_t	len;
      +    } last;
           int timz;
           struct tm *t;
      -    char tstr[MAX_STRING_LEN];
      +    char *cp;
      +
      +    if (!a || !*a) {
      +	time_t now = ap_time();
      +	if (now != last.time) {
      +#if defined(IRIX) && _MIPS_SIM != _ABIO32
      +#pragma mips_frequency_hint NEVER
      +#endif
      +	    char sign;
       
      -    t = ap_get_gmtoff(&timz);
      +	    t = ap_get_gmtoff(&timz);
      +	    if (timz < 0) {
      +		sign = '-';
      +		timz = -timz;
      +	    } else
      +		sign = '+';
      +
      +	    last.time = now;
      +	    last.len = ap_snprintf(last.str, sizeof last.str,
      +		"[%02d/%s/%d:%02d:%02d:%02d %c%.2d%.2d]",
      +		t->tm_mday, ap_month_snames[t->tm_mon], t->tm_year+1900, 
      +		t->tm_hour, t->tm_min, t->tm_sec,
      +		sign, timz / 60, timz % 60);
      +	}
       
      -    if (a && *a) {              /* Custom format */
      -        strftime(tstr, MAX_STRING_LEN, a, t);
      -    }
      -    else {                      /* CLF format */
      -        char sign = (timz < 0 ? '-' : '+');
      +	cp = last.str;
      +	*rlen = last.len;
      +    } else {			/* Custom format */
      +	char tstr[MAX_STRING_LEN];
       
      -        if (timz < 0) {
      -            timz = -timz;
      -        }
      -        ap_snprintf(tstr, sizeof(tstr), "[%02d/%s/%d:%02d:%02d:%02d %c%.2d%.2d]",
      -                t->tm_mday, ap_month_snames[t->tm_mon], t->tm_year+1900, 
      -                t->tm_hour, t->tm_min, t->tm_sec,
      -                sign, timz / 60, timz % 60);
      +	t = ap_get_gmtoff(&timz);
      +        strftime(tstr, MAX_STRING_LEN, a, t);
      +	cp = ap_pstrdup(r->pool, tstr);
           }
       
      -    return ap_pstrdup(r->pool, tstr);
      +    return cp;
       }
       
      -static const char *log_request_duration(request_rec *r, char *a)
      +/*ARGSUSED1*/
      +static const char *log_request_duration(request_rec *r, char *a, size_t *rlen)
       {
      -    return ap_psprintf(r->pool, "%ld", time(NULL) - r->request_time);
      +    return ap_psprintf(r->pool, "%ld", (long) (time(NULL) - r->request_time));
       }
       
       /* These next two routines use the canonical name:port so that log
        * parsers don't need to duplicate all the vhost parsing crud.
        */
      -static const char *log_virtual_host(request_rec *r, char *a)
      +/*ARGSUSED1*/
      +static const char *log_virtual_host(request_rec *r, char *a, size_t *rlen)
       {
           return r->server->server_hostname;
       }
       
      -static const char *log_server_port(request_rec *r, char *a)
      +/*ARGSUSED1*/
      +static const char *log_server_port(request_rec *r, char *a, size_t *rlen)
       {
           return ap_psprintf(r->pool, "%u",
       	r->server->port ? r->server->port : ap_default_port(r));
      @@ -456,12 +536,14 @@
       /* This respects the setting of UseCanonicalName so that
        * the dynamic mass virtual hosting trick works better.
        */
      -static const char *log_server_name(request_rec *r, char *a)
      +/*ARGSUSED1*/
      +static const char *log_server_name(request_rec *r, char *a, size_t *rlen)
       {
           return ap_get_server_name(r);
       }
       
      -static const char *log_child_pid(request_rec *r, char *a)
      +/*ARGSUSED1*/
      +static const char *log_child_pid(request_rec *r, char *a, size_t *rlen)
       {
           return ap_psprintf(r->pool, "%ld", (long) getpid());
       }
      @@ -619,6 +701,7 @@
       	}
           }
           *d = '\0';
      +    it->arglen = d - it->arg;
       
           *sa = s;
           return NULL;
      @@ -637,6 +720,7 @@
           it->conditions = NULL;
           it->want_orig = -1;
           it->arg = "";               /* For safety's sake... */
      +    it->arglen = 0;
       
           while (*s) {
               int i;
      @@ -711,9 +795,17 @@
       
       static array_header *parse_log_string(pool *p, const char *s, const char **err)
       {
      -    array_header *a = ap_make_array(p, 30, sizeof(log_format_item));
      +    array_header *a;
           char *res;
       
      +#ifdef USE_QUICK_LOG
      +    if (s == common_log_format || !strcmp(s, common_log_format))
      +	return QUICK_CLF_MARKER;
      +    else if (s == quick_log_format || !strcmp(s, quick_log_format))
      +	return QUICK_QLF_MARKER;
      +#endif
      +
      +    a = ap_make_array(p, 30, sizeof(log_format_item));
           while (*s) {
               if ((res = parse_log_item(p, (log_format_item *) ap_push_array(a), &s))) {
                   *err = res;
      @@ -732,9 +824,10 @@
        */
       
       static const char *process_item(request_rec *r, request_rec *orig,
      -                          log_format_item *item)
      +                          log_format_item *item, size_t *rlen)
       {
           const char *cp;
      +    static const char dash[2] = "-";
       
           /* First, see if we need to process this thing at all... */
       
      @@ -752,14 +845,20 @@
       
               if ((item->condition_sense && in_list)
                   || (!item->condition_sense && !in_list)) {
      -            return "-";
      +	    *rlen = 1;
      +	    return dash;
               }
           }
       
           /* We do.  Do it... */
       
      -    cp = (*item->func) (item->want_orig ? orig : r, item->arg);
      -    return cp ? cp : "-";
      +    *rlen = item->arglen;
      +    cp = (*item->func) (item->want_orig ? orig : r, item->arg, rlen);
      +    if (cp)
      +	return cp;
      +
      +    *rlen = 1;
      +    return dash;
       }
       
       #ifdef BUFFERED_LOGS
      @@ -772,20 +871,192 @@
       }
       #endif
       
      +static void
      +log_vec(request_rec *r, config_log_state *cls, struct iovec *iovec,
      +    int iovcnt, size_t len)
      +{
      +    int i;
      +    char *s;
      +
      +#ifdef BUFFERED_LOGS
      +    if (len + cls->outcnt > LOG_BUFSIZE) {
      +#if defined(IRIX) && _MIPS_SIM != _ABIO32
      +#pragma mips_frequency_hint NEVER
      +#endif
      +        flush_log(cls);
      +    }
      +    if (len < LOG_BUFSIZE) {
      +	for (i = 0, s = &cls->outbuf[cls->outcnt]; i < iovcnt; i++) {
      +	    memcpy(s, iovec[i].iov_base, iovec[i].iov_len);
      +	    s += iovec[i].iov_len;
      +	}
      +	cls->outcnt += len;
      +    } else {
      +#endif
      +	char *str = ap_palloc(r->pool, len);
      +	for (i = 0, s = str; i < iovcnt; i++) {
      +	    memcpy(s, iovec[i].iov_base, iovec[i].iov_len);
      +	    s += iovec[i].iov_len;
      +	}
      +	write(cls->log_fd, str, len);
      +#ifdef BUFFERED_LOGS
      +    }
      +#endif
      +}
      +
      +#ifdef USE_QUICK_LOG
      +static int quick_log(request_rec *r, request_rec *orig, config_log_state *cls,
      +    const array_header *format)
      +{
      +    struct iovec iovec[14];
      +    static const char sqsdn[6] = " \" -\n";
      +
      +    /*
      +     * format is either:
      +     *	QUICK_CLF_MARKER for "%h %l %u %t \"%r\" %>s %b\n"
      +     * or
      +     *	QUICK_QLF_MARKER for "%a %l %u %t \"%r\" %>s %b\n"
      +     */
      +
      +    /* "%h" or "%a" */
      +    iovec[0].iov_len = 0;
      +    iovec[0].iov_base = (format == QUICK_QLF_MARKER) ?
      +	(void *) log_remote_address(r, NULL, &iovec[0].iov_len) :
      +	(void *) log_remote_host(r, NULL, &iovec[0].iov_len);
      +    if (iovec[0].iov_base) {
      +	if (iovec[0].iov_len == 0) {
      +#if defined(IRIX) && _MIPS_SIM != _ABIO32
      +#pragma mips_frequency_hint NEVER
      +#endif
      +	    iovec[0].iov_len = strlen(iovec[0].iov_base);
      +	}
      +    } else {
      +	iovec[0].iov_base = (void *) &sqsdn[3];
      +	iovec[0].iov_len = 1;
      +    }
      +
      +    /* " " */
      +    iovec[1].iov_base = (void *) sqsdn;
      +    iovec[1].iov_len = 1;
      +
      +    /* "%l" */
      +    iovec[2].iov_len = 0;
      +    iovec[2].iov_base = (void *) log_remote_logname(r, NULL, &iovec[2].iov_len);
      +    if (iovec[2].iov_base == NULL) {
      +	iovec[2].iov_base = (void *) &sqsdn[3];
      +	iovec[2].iov_len = 1;
      +    } else if (iovec[2].iov_len == 0)
      +	iovec[2].iov_len = strlen(iovec[2].iov_base);
      +
      +    /* " " */
      +    iovec[3].iov_base = (void *) sqsdn;
      +    iovec[3].iov_len = 1;
      +
      +    /* "%u" */
      +    iovec[4].iov_len = 0;
      +    iovec[4].iov_base = (void *) log_remote_user(r, NULL, &iovec[4].iov_len);
      +    if (iovec[4].iov_base == NULL) {
      +	iovec[4].iov_base = (void *) &sqsdn[3];
      +	iovec[4].iov_len = 1;
      +    } else if (iovec[4].iov_len == 0)
      +	iovec[4].iov_len = strlen(iovec[4].iov_base);
      +
      +    /* " " */
      +    iovec[5].iov_base = (void *) sqsdn;
      +    iovec[5].iov_len = 1;
      +
      +    /* "%t" */
      +    iovec[6].iov_len = 0;
      +    iovec[6].iov_base = (void *) log_request_time(r, NULL, &iovec[6].iov_len);
      +    if (iovec[6].iov_len == 0) {
      +#if defined(IRIX) && _MIPS_SIM != _ABIO32
      +#pragma mips_frequency_hint NEVER
      +#endif
      +	iovec[6].iov_len = strlen(iovec[6].iov_base);
      +    }
      +
      +    /* " \"" */
      +    iovec[7].iov_base = (void *) sqsdn;
      +    iovec[7].iov_len = 2;
      +
      +    /* "%r" */
      +    iovec[8].iov_len = 0;
      +    iovec[8].iov_base = (void *) log_request_line(orig, NULL, &iovec[8].iov_len);
      +    if (iovec[8].iov_base) {
      +	if (iovec[8].iov_len == 0) {
      +#if defined(IRIX) && _MIPS_SIM != _ABIO32
      +#pragma mips_frequency_hint NEVER
      +#endif
      +	    iovec[8].iov_len = strlen(iovec[8].iov_base); 
      +	}
      +    } else {
      +	iovec[8].iov_base = (void *) &sqsdn[3];
      +	iovec[8].iov_len = 1;
      +    }
      +
      +    /* "\" " */
      +    iovec[9].iov_base = (void *) &sqsdn[1];
      +    iovec[9].iov_len = 2;
      +
      +    /* "%>s" */
      +    iovec[10].iov_len = 0;
      +    iovec[10].iov_base = (void *) log_status(r, NULL, &iovec[10].iov_len);
      +    if (iovec[10].iov_base) {
      +	if (iovec[10].iov_len == 0) {
      +#if defined(IRIX) && _MIPS_SIM != _ABIO32
      +#pragma mips_frequency_hint NEVER
      +#endif
      +	    iovec[10].iov_len = strlen(iovec[10].iov_base);
      +	}
      +    } else {
      +	iovec[10].iov_base = (void *) &sqsdn[3];
      +	iovec[10].iov_len = 1;
      +    }
      +
      +    /* " " */
      +    iovec[11].iov_base = (void *) sqsdn;
      +    iovec[11].iov_len = 1;
      +
      +    /* "%b" */
      +    iovec[12].iov_len = 0;
      +    iovec[12].iov_base = (void *) clf_log_bytes_sent(r, NULL, &iovec[12].iov_len);
      +    if (iovec[12].iov_base) {
      +	if (iovec[12].iov_len == 0)
      +	    iovec[12].iov_len = strlen(iovec[12].iov_base);
      +    } else {
      +	iovec[12].iov_base = (void *) &sqsdn[3];
      +	iovec[12].iov_len = 1;
      +    }
      +
      +    /* "\n" */
      +    iovec[13].iov_base = (void *) &sqsdn[4];
      +    iovec[13].iov_len = 1;
      +
      +    log_vec(r, cls, iovec, 14,
      +	iovec[0].iov_len + iovec[1].iov_len + iovec[2].iov_len +
      +	iovec[3].iov_len + iovec[4].iov_len + iovec[5].iov_len +
      +	iovec[6].iov_len + iovec[7].iov_len + iovec[8].iov_len +
      +	iovec[9].iov_len + iovec[10].iov_len + iovec[11].iov_len +
      +	iovec[12].iov_len + iovec[13].iov_len);
      +
      +    return OK;
      +}
      +#endif
      +
       static int config_log_transaction(request_rec *r, config_log_state *cls,
                                         array_header *default_format)
       {
           log_format_item *items;
      -    char *str, *s;
      -    const char **strs;
      -    int *strl;
           request_rec *orig;
      -    int i;
      -    int len = 0;
      +    int i, len;
           array_header *format;
           char *envar;
      +    struct iovec local_iovec[20], *iovec;
       
           if (cls->fname == NULL) {
      +#if defined(IRIX) && _MIPS_SIM != _ABIO32
      +#pragma mips_frequency_hint NEVER
      +#endif
               return DECLINED;
           }
       
      @@ -794,6 +1065,9 @@
            * to make.
            */
           if (cls->condition_var != NULL) {
      +#if defined(IRIX) && _MIPS_SIM != _ABIO32
      +#pragma mips_frequency_hint NEVER
      +#endif
       	envar = cls->condition_var;
       	if (*envar != '!') {
       	    if (ap_table_get(r->subprocess_env, envar) == NULL) {
      @@ -807,12 +1081,6 @@
       	}
           }
       
      -    format = cls->format ? cls->format : default_format;
      -
      -    strs = ap_palloc(r->pool, sizeof(char *) * (format->nelts));
      -    strl = ap_palloc(r->pool, sizeof(int) * (format->nelts));
      -    items = (log_format_item *) format->elts;
      -
           orig = r;
           while (orig->prev) {
               orig = orig->prev;
      @@ -821,43 +1089,30 @@
               r = r->next;
           }
       
      -    for (i = 0; i < format->nelts; ++i) {
      -        strs[i] = process_item(r, orig, &items[i]);
      -    }
      +    format = cls->format ? cls->format : default_format;
       
      -    for (i = 0; i < format->nelts; ++i) {
      -        len += strl[i] = strlen(strs[i]);
      -    }
      +#ifdef USE_QUICK_LOG
      +    if (format == QUICK_CLF_MARKER || format == QUICK_QLF_MARKER)
      +	return quick_log(r, orig, cls, format);
      +#endif
       
      -#ifdef BUFFERED_LOGS
      -    if (len + cls->outcnt > LOG_BUFSIZE) {
      -        flush_log(cls);
      -    }
      -    if (len >= LOG_BUFSIZE) {
      -        str = ap_palloc(r->pool, len + 1);
      -        for (i = 0, s = str; i < format->nelts; ++i) {
      -            memcpy(s, strs[i], strl[i]);
      -            s += strl[i];
      -        }
      -        write(cls->log_fd, str, len);
      -    }
      -    else {
      -        for (i = 0, s = &cls->outbuf[cls->outcnt]; i < format->nelts; ++i) {
      -            memcpy(s, strs[i], strl[i]);
      -            s += strl[i];
      -        }
      -        cls->outcnt += len;
      -    }
      -#else
      -    str = ap_palloc(r->pool, len + 1);
      +    len = 0;
      +    if (format->nelts <= sizeof local_iovec / sizeof local_iovec[0])
      +	iovec = local_iovec;
      +    else
      +	iovec = ap_palloc(r->pool, sizeof *iovec * format->nelts);
      +    items = (log_format_item *) format->elts;
       
      -    for (i = 0, s = str; i < format->nelts; ++i) {
      -        memcpy(s, strs[i], strl[i]);
      -        s += strl[i];
      +    for (i = 0; i < format->nelts; ++i) {
      +	iovec[i].iov_len = 0;
      +	iovec[i].iov_base = (void *) process_item(r, orig, &items[i],
      +	    &iovec[i].iov_len);
      +	if (iovec[i].iov_len == 0)
      +	    iovec[i].iov_len = strlen(iovec[i].iov_base);
      +	len += iovec[i].iov_len;
           }
       
      -    write(cls->log_fd, str, len);
      -#endif
      +    log_vec(r, cls, iovec, format->nelts, len);
       
           return OK;
       }
      @@ -897,6 +1152,7 @@
        * Module glue...
        */
       
      +/*ARGSUSED1*/
       static void *make_config_log_state(pool *p, server_rec *s)
       {
           multi_log_state *mls;
      @@ -907,7 +1163,7 @@
           mls->default_format = NULL;
           mls->server_config_logs = NULL;
           mls->formats = ap_make_table(p, 4);
      -    ap_table_setn(mls->formats, "CLF", DEFAULT_LOG_FORMAT);
      +    ap_table_setn(mls->formats, "CLF", common_log_format);
       
           return mls;
       }
      @@ -936,6 +1192,7 @@
       /*
        * Set the default logfile format, or define a nickname for a format string.
        */
      +/*ARGSUSED1*/
       static const char *log_format(cmd_parms *cmd, void *dummy, char *fmt,
                                     char *name)
       {
      @@ -961,7 +1218,7 @@
           return err_string;
       }
       
      -
      +/*ARGSUSED1*/
       static const char *add_custom_log(cmd_parms *cmd, void *dummy, char *fn,
                                         char *fmt, char *envclause)
       {
      @@ -1020,6 +1277,7 @@
           {NULL}
       };
       
      +/*ARGSUSED3*/
       static config_log_state *open_config_log(server_rec *s, pool *p,
                                                config_log_state *cls,
                                                array_header *default_format)
      @@ -1073,7 +1331,7 @@
           }    
       
           if (!mls->default_format) {
      -        mls->default_format = parse_log_string(p, DEFAULT_LOG_FORMAT, &dummy);
      +        mls->default_format = parse_log_string(p, common_log_format, &dummy);
           }
       
           if (mls->config_logs->nelts) {
      @@ -1126,6 +1384,7 @@
       }
       
       #ifdef BUFFERED_LOGS
      +/*ARGSUSED1*/
       static void flush_all_logs(server_rec *s, pool *p)
       {
           multi_log_state *mls;
      diff -Naur apache_1.3.12/src/modules/standard/mod_log_referer.c-orig apache_1.3.12/src/modules/standard/mod_log_referer.c
      --- apache_1.3.12/src/modules/standard/mod_log_referer.c-orig	Fri Jan  1 11:05:11 1999
      +++ apache_1.3.12/src/modules/standard/mod_log_referer.c	Wed Feb  9 17:34:31 2000
      @@ -77,6 +77,7 @@
           array_header *referer_ignore_list;
       } referer_log_state;
       
      +/*ARGSUSED1*/
       static void *make_referer_log_state(pool *p, server_rec *s)
       {
           referer_log_state *cls =
      @@ -88,6 +89,7 @@
           return (void *) cls;
       }
       
      +/*ARGSUSED1*/
       static const char *set_referer_log(cmd_parms *parms, void *dummy, char *arg)
       {
           referer_log_state *cls = ap_get_module_config(parms->server->module_config,
      @@ -97,6 +99,7 @@
           return NULL;
       }
       
      +/*ARGSUSED1*/
       static const char *add_referer_ignore(cmd_parms *parms, void *dummy, char *arg)
       {
           char **addme;
      diff -Naur apache_1.3.12/src/modules/standard/mod_mime.c-orig apache_1.3.12/src/modules/standard/mod_mime.c
      --- apache_1.3.12/src/modules/standard/mod_mime.c-orig	Sat Feb  5 19:53:11 2000
      +++ apache_1.3.12/src/modules/standard/mod_mime.c	Wed Mar  1 17:04:34 2000
      @@ -112,6 +112,7 @@
       
       module MODULE_VAR_EXPORT mime_module;
       
      +/*ARGSUSED1*/
       static void *create_mime_dir_config(pool *p, char *dummy)
       {
           mime_dir_config *new =
      @@ -164,6 +165,7 @@
           return new;
       }
       
      +/*ARGSUSED*/
       static const char *add_type(cmd_parms *cmd, mime_dir_config *m, char *ct,
                                   char *ext)
       {
      @@ -175,6 +177,7 @@
           return NULL;
       }
       
      +/*ARGSUSED*/
       static const char *add_encoding(cmd_parms *cmd, mime_dir_config *m, char *enc,
                                       char *ext)
       {
      @@ -185,6 +188,7 @@
           return NULL;
       }
       
      +/*ARGSUSED*/
       static const char *add_charset(cmd_parms *cmd, mime_dir_config *m,
       			       char *charset, char *ext)
       {
      @@ -196,6 +200,7 @@
           return NULL;
       }
       
      +/*ARGSUSED*/
       static const char *add_language(cmd_parms *cmd, mime_dir_config *m, char *lang,
                                       char *ext)
       {
      @@ -207,6 +212,7 @@
           return NULL;
       }
       
      +/*ARGSUSED*/
       static const char *add_handler(cmd_parms *cmd, mime_dir_config *m, char *hdlr,
                                      char *ext)
       {
      @@ -239,6 +245,7 @@
        * the name of its config file, so...
        */
       
      +/*ARGSUSED1*/
       static const char *set_types_config(cmd_parms *cmd, void *dummy, char *arg)
       {
           ap_set_module_config(cmd->server->module_config, &mime_module, arg);
      @@ -512,7 +519,7 @@
       		}
       	    }
       	    else {
      -		while (1) {
      +		for (;;) {
       		    if (is_token((int) *cp) > 0) {
       			cp++;
       		    }
      diff -Naur apache_1.3.12/src/modules/standard/mod_mime_magic.c-orig apache_1.3.12/src/modules/standard/mod_mime_magic.c
      --- apache_1.3.12/src/modules/standard/mod_mime_magic.c-orig	Tue Apr 20 20:42:33 1999
      +++ apache_1.3.12/src/modules/standard/mod_mime_magic.c	Wed Feb  9 17:34:31 2000
      @@ -162,9 +162,9 @@
           short cont_level;		/* level of ">" */
           struct {
       	char type;		/* byte short long */
      -	long offset;		/* offset from indirection */
      +	ap_int32 offset;	/* offset from indirection */
           } in;
      -    long offset;		/* offset to magic number */
      +    ap_int32 offset;		/* offset to magic number */
           unsigned char reln;		/* relation (0=eq, '>'=gt, etc) */
           char type;			/* int, short, long or string. */
           char vallen;		/* length of string value, if any */
      @@ -182,12 +182,12 @@
           union VALUETYPE {
       	unsigned char b;
       	unsigned short h;
      -	unsigned long l;
      +	ap_uint32 l;
       	char s[MAXstring];
       	unsigned char hs[2];	/* 2 bytes of a fixed-endian "short" */
       	unsigned char hl[4];	/* 2 bytes of a fixed-endian "long" */
           } value;			/* either number or string */
      -    unsigned long mask;		/* mask before comparison with value */
      +    ap_uint32 mask;		/* mask before comparison with value */
           char nospflag;		/* supress space character */
       
           /* NOTE: this string is suspected of overrunning - find it! */
      @@ -258,7 +258,7 @@
       
       static int uncompress(request_rec *, int, 
       		      unsigned char **, int);
      -static long from_oct(int, char *);
      +static ap_int32 from_oct(int, char *);
       static int fsmagic(request_rec *r, const char *fn);
       
       /*
      @@ -498,6 +498,7 @@
       
       module mime_magic_module;
       
      +/*ARGSUSED1*/
       static void *create_magic_server_config(pool *p, server_rec *d)
       {
           /* allocate the config - use pcalloc because it needs to be zeroed */
      @@ -517,6 +518,7 @@
           return new;
       }
       
      +/*ARGSUSED1*/
       static const char *set_magicfile(cmd_parms *cmd, char *d, char *arg)
       {
           magic_server_config_rec *conf = (magic_server_config_rec *)
      @@ -610,6 +612,7 @@
       }
       
       /* RSL hook for printf-type functions */
      +/*PRINTFLIKE2*/
       static int magic_rsl_printf(request_rec *r, char *str,...)
       {
           va_list ap;
      @@ -877,7 +880,7 @@
           /*
            * try looking at the first HOWMANY bytes
            */
      -    if ((nbytes = read(fd, (char *) buf, sizeof(buf) - 1)) == -1) {
      +    if ((nbytes = (int) read(fd, (char *) buf, sizeof(buf) - 1)) == -1) {
       	ap_log_rerror(APLOG_MARK, APLOG_ERR, r,
       		    MODNAME ": read failed: %s", r->filename);
       	return HTTP_INTERNAL_SERVER_ERROR;
      @@ -1011,17 +1014,17 @@
           ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, s,
       		MODNAME ": apprentice test");
           for (m = conf->magic; m; m = m->next) {
      -	if (ap_isprint((((unsigned long) m) >> 24) & 255) &&
      -	    ap_isprint((((unsigned long) m) >> 16) & 255) &&
      -	    ap_isprint((((unsigned long) m) >> 8) & 255) &&
      -	    ap_isprint(((unsigned long) m) & 255)) {
      +	if (ap_isprint((((ap_uint32) m) >> 24) & 255) &&
      +	    ap_isprint((((ap_uint32) m) >> 16) & 255) &&
      +	    ap_isprint((((ap_uint32) m) >> 8) & 255) &&
      +	    ap_isprint(((ap_uint32) m) & 255)) {
       	    ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, s,
       			MODNAME ": apprentice: POINTER CLOBBERED! "
       			"m=\"%c%c%c%c\" line=%d",
      -			(((unsigned long) m) >> 24) & 255,
      -			(((unsigned long) m) >> 16) & 255,
      -			(((unsigned long) m) >> 8) & 255,
      -			((unsigned long) m) & 255,
      +			(((ap_uint32) m) >> 24) & 255,
      +			(((ap_uint32) m) >> 16) & 255,
      +			(((ap_uint32) m) >> 8) & 255,
      +			((ap_uint32) m) & 255,
       			prevm ? prevm->lineno : -1);
       	    break;
       	}
      @@ -1035,7 +1038,7 @@
       /*
        * extend the sign bit if the comparison is to be signed
        */
      -static unsigned long signextend(server_rec *s, struct magic *m, unsigned long v)
      +static ap_uint32 signextend(server_rec *s, struct magic *m, ap_uint32 v)
       {
           if (!(m->flag & UNSIGNED))
       	switch (m->type) {
      @@ -1057,7 +1060,7 @@
       	case LONG:
       	case BELONG:
       	case LELONG:
      -	    v = (long) v;
      +	    v = (ap_int32) v;
       	    break;
       	case STRING:
       	    break;
      @@ -1143,7 +1146,7 @@
       	if (*l == '+' || *l == '-')
       	    l++;
       	if (ap_isdigit((unsigned char) *l)) {
      -	    m->in.offset = strtol(l, &t, 0);
      +	    m->in.offset = (ap_int32) strtol(l, &t, 0);
       	    if (*s == '-')
       		m->in.offset = -m->in.offset;
       	}
      @@ -1231,10 +1234,10 @@
           /* New-style anding: "0 byte&0x80 =0x80 dynamically linked" */
           if (*l == '&') {
       	++l;
      -	m->mask = signextend(serv, m, strtol(l, &l, 0));
      +	m->mask = signextend(serv, m, (ap_uint32) strtol(l, &l, 0));
           }
           else
      -	m->mask = ~0L;
      +	m->mask = ~0;
           EATAB;
       
           switch (*l) {
      @@ -1309,7 +1312,7 @@
       	m->vallen = slen;
           }
           else if (m->reln != 'x')
      -	m->value.l = signextend(s, m, strtol(*p, p, 0));
      +	m->value.l = signextend(s, m, (ap_uint32) strtol(*p, p, 0));
           return 0;
       }
       
      @@ -1422,7 +1425,7 @@
           }
         out:
           *p = '\0';
      -    *slen = p - origp;
      +    *slen = (int) (p - origp);
           return s;
       }
       
      @@ -1573,17 +1576,17 @@
       
       #if MIME_MAGIC_DEBUG
           for (m = conf->magic; m; m = m->next) {
      -	if (ap_isprint((((unsigned long) m) >> 24) & 255) &&
      -	    ap_isprint((((unsigned long) m) >> 16) & 255) &&
      -	    ap_isprint((((unsigned long) m) >> 8) & 255) &&
      -	    ap_isprint(((unsigned long) m) & 255)) {
      +	if (ap_isprint((((ap_uint32) m) >> 24) & 255) &&
      +	    ap_isprint((((ap_uint32) m) >> 16) & 255) &&
      +	    ap_isprint((((ap_uint32) m) >> 8) & 255) &&
      +	    ap_isprint(((ap_uint32) m) & 255)) {
       	    ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, r,
       			MODNAME ": match: POINTER CLOBBERED! "
       			"m=\"%c%c%c%c\"",
      -			(((unsigned long) m) >> 24) & 255,
      -			(((unsigned long) m) >> 16) & 255,
      -			(((unsigned long) m) >> 8) & 255,
      -			((unsigned long) m) & 255);
      +			(((ap_uint32) m) >> 24) & 255,
      +			(((ap_uint32) m) >> 16) & 255,
      +			(((ap_uint32) m) >> 8) & 255,
      +			((ap_uint32) m) & 255);
       	    break;
       	}
           }
      @@ -1714,7 +1717,7 @@
       static void mprint(request_rec *r, union VALUETYPE *p, struct magic *m)
       {
           char *pp, *rt;
      -    unsigned long v;
      +    ap_uint32 v;
       
           switch (m->type) {
           case BYTE:
      @@ -1759,7 +1762,7 @@
           }
       
           v = signextend(r->server, m, v) & m->mask;
      -    (void) magic_rsl_printf(r, m->desc, (unsigned long) v);
      +    (void) magic_rsl_printf(r, m->desc, (ap_uint32) v);
       }
       
       /*
      @@ -1786,7 +1789,7 @@
       	return 1;
           case BELONG:
           case BEDATE:
      -	p->l = (long)
      +	p->l = (ap_int32)
       	    ((p->hl[0] << 24) | (p->hl[1] << 16) | (p->hl[2] << 8) | (p->hl[3]));
       	return 1;
           case LESHORT:
      @@ -1794,7 +1797,7 @@
       	return 1;
           case LELONG:
           case LEDATE:
      -	p->l = (long)
      +	p->l = (ap_int32)
       	    ((p->hl[3] << 24) | (p->hl[2] << 16) | (p->hl[1] << 8) | (p->hl[0]));
       	return 1;
           default:
      @@ -1808,7 +1811,7 @@
       static int mget(request_rec *r, union VALUETYPE *p, unsigned char *s,
       		struct magic *m, int nbytes)
       {
      -    long offset = m->offset;
      +    ap_int32 offset = m->offset;
       
           if (offset + sizeof(union VALUETYPE) > nbytes)
       	          return 0;
      @@ -1845,8 +1848,8 @@
       
       static int mcheck(request_rec *r, union VALUETYPE *p, struct magic *m)
       {
      -    register unsigned long l = m->value.l;
      -    register unsigned long v;
      +    register ap_uint32 l = m->value.l;
      +    register ap_uint32 v;
           int matched;
       
           if ((m->value.s[0] == 'x') && (m->value.s[1] == '\0')) {
      @@ -1906,7 +1909,7 @@
           case 'x':
       #if MIME_MAGIC_DEBUG
       	ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, r,
      -		    "%lu == *any* = 1", v);
      +		    "%lu == *any* = 1", (unsigned long) v);
       #endif
       	matched = 1;
       	break;
      @@ -1915,7 +1918,7 @@
       	matched = v != l;
       #if MIME_MAGIC_DEBUG
       	ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, r,
      -		    "%lu != %lu = %d", v, l, matched);
      +		    "%lu != %lu = %d", (unsigned long) v, (unsigned long) l, matched);
       #endif
       	break;
       
      @@ -1923,7 +1926,7 @@
       	matched = v == l;
       #if MIME_MAGIC_DEBUG
       	ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, r,
      -		    "%lu == %lu = %d", v, l, matched);
      +		    "%lu == %lu = %d", (unsigned long) v, (unsigned long) l, matched);
       #endif
       	break;
       
      @@ -1932,14 +1935,14 @@
       	    matched = v > l;
       #if MIME_MAGIC_DEBUG
       	    ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, r,
      -			"%lu > %lu = %d", v, l, matched);
      +			"%lu > %lu = %d", (unsigned long) v, (unsigned long) l, matched);
       #endif
       	}
       	else {
      -	    matched = (long) v > (long) l;
      +	    matched = (ap_int32) v > (ap_int32) l;
       #if MIME_MAGIC_DEBUG
       	    ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, r,
      -			"%ld > %ld = %d", v, l, matched);
      +			"%ld > %ld = %d", (long) v, (long) l, matched);
       #endif
       	}
       	break;
      @@ -1949,14 +1952,14 @@
       	    matched = v < l;
       #if MIME_MAGIC_DEBUG
       	    ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, r,
      -			"%lu < %lu = %d", v, l, matched);
      +			"%lu < %lu = %d", (unsigned long) v, (unsigned long) l, matched);
       #endif
       	}
       	else {
      -	    matched = (long) v < (long) l;
      +	    matched = (ap_int32) v < (ap_int32) l;
       #if MIME_MAGIC_DEBUG
       	    ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, r,
      -			"%ld < %ld = %d", v, l, matched);
      +			"%ld < %ld = %d", (long) v, (long) l, matched);
       #endif
       	}
       	break;
      @@ -1965,7 +1968,7 @@
       	matched = (v & l) == l;
       #if MIME_MAGIC_DEBUG
       	ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, r,
      -		    "((%lx & %lx) == %lx) = %d", v, l, l, matched);
      +		    "((%lx & %lx) == %lx) = %d", (unsigned long) v, (unsigned long) l, (unsigned long) l, matched);
       #endif
       	break;
       
      @@ -1973,7 +1976,7 @@
       	matched = (v & l) != l;
       #if MIME_MAGIC_DEBUG
       	ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, r,
      -		    "((%lx & %lx) != %lx) = %d", v, l, l, matched);
      +		    "((%lx & %lx) != %lx) = %d", (unsigned long) v, (unsigned long) l, (unsigned long) l, matched);
       #endif
       	break;
       
      @@ -2142,6 +2145,7 @@
           int method;
       };
       
      +/*ARGSUSED1*/
       static int uncompress_child(void *data, child_info *pinfo)
       {
           struct uncompress_parms *parm = data;
      @@ -2232,7 +2236,7 @@
       {
           register union record *header = (union record *) buf;
           register int i;
      -    register long sum, recsum;
      +    register ap_int32 sum, recsum;
           register char *p;
       
           if (nbytes < sizeof(union record))
      @@ -2269,9 +2273,9 @@
        *
        * Result is -1 if the field is invalid (all blank, or nonoctal).
        */
      -static long from_oct(int digs, char *where)
      +static ap_int32 from_oct(int digs, char *where)
       {
      -    register long value;
      +    register ap_int32 value;
       
           while (ap_isspace(*where)) {	/* Skip spaces */
       	where++;
      @@ -2312,7 +2316,7 @@
       #endif /* MIME_MAGIC_DEBUG */
       
           /* check for recognized revision suffix */
      -    suffix_pos = strlen(r->filename) - 1;
      +    suffix_pos = ap_strlen(r->filename) - 1;
           if (!ap_isdigit(r->filename[suffix_pos])) {
       	return 0;
           }
      @@ -2384,17 +2388,17 @@
       	    ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, s,
       			MODNAME ": magic_init 1 test");
       	    for (m = conf->magic; m; m = m->next) {
      -		if (ap_isprint((((unsigned long) m) >> 24) & 255) &&
      -		    ap_isprint((((unsigned long) m) >> 16) & 255) &&
      -		    ap_isprint((((unsigned long) m) >> 8) & 255) &&
      -		    ap_isprint(((unsigned long) m) & 255)) {
      +		if (ap_isprint((((ap_uint32) m) >> 24) & 255) &&
      +		    ap_isprint((((ap_uint32) m) >> 16) & 255) &&
      +		    ap_isprint((((ap_uint32) m) >> 8) & 255) &&
      +		    ap_isprint(((ap_uint32) m) & 255)) {
       		    ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, s,
       				MODNAME ": magic_init 1: POINTER CLOBBERED! "
       				"m=\"%c%c%c%c\" line=%d",
      -				(((unsigned long) m) >> 24) & 255,
      -				(((unsigned long) m) >> 16) & 255,
      -				(((unsigned long) m) >> 8) & 255,
      -				((unsigned long) m) & 255,
      +				(((ap_uint32) m) >> 24) & 255,
      +				(((ap_uint32) m) >> 16) & 255,
      +				(((ap_uint32) m) >> 8) & 255,
      +				((ap_uint32) m) & 255,
       				prevm ? prevm->lineno : -1);
       		    break;
       		}
      diff -Naur apache_1.3.12/src/modules/standard/mod_negotiation.c-orig apache_1.3.12/src/modules/standard/mod_negotiation.c
      --- apache_1.3.12/src/modules/standard/mod_negotiation.c-orig	Thu Jul 29 10:54:06 1999
      +++ apache_1.3.12/src/modules/standard/mod_negotiation.c	Wed Feb  9 17:34:31 2000
      @@ -80,6 +80,7 @@
       
       module MODULE_VAR_EXPORT negotiation_module;
       
      +/*ARGSUSED1*/
       static void *create_neg_dir_config(pool *p, char *dummy)
       {
           neg_dir_config *new = (neg_dir_config *) ap_palloc(p, sizeof(neg_dir_config));
      @@ -100,6 +101,7 @@
           return new;
       }
       
      +/*ARGSUSED*/
       static const char *set_language_priority(cmd_parms *cmd, void *n, char *lang)
       {
           array_header *arr = ((neg_dir_config *) n)->language_priority;
      @@ -109,6 +111,7 @@
           return NULL;
       }
       
      +/*ARGSUSED1*/
       static const char *cache_negotiated_docs(cmd_parms *cmd, void *dummy,
                                                char *dummy2)
       {
      @@ -906,7 +909,7 @@
           }
       
           ++filp;
      -    prefix_len = strlen(filp);
      +    prefix_len = ap_strlen(filp);
       
           dirp = ap_popendir(neg->pool, neg->dir_name);
       
      @@ -1027,7 +1030,7 @@
       {
           char *accept_type = accept_r->name;
           char *avail_type = avail->mime_type;
      -    int len = strlen(accept_type);
      +    int len = ap_strlen(accept_type);
       
           if (accept_type[0] == '*') {        /* Anything matches star/star */
               if (avail->mime_stars < 1) {
      @@ -1336,7 +1339,7 @@
                            * if it is longer than the previous best match.
                            */
                           
      -                    alen = strlen(accs[i].name);
      +                    alen = ap_strlen(accs[i].name);
                           
                           if ((strlen(lang) >= alen) &&
                               !strncmp(lang, accs[i].name, alen) &&
      @@ -1366,7 +1369,7 @@
                                * fiddle does not handle multi-level prefixes.
                                */
                               if ((p = strchr(accs[i].name, '-'))) {
      -                            int plen = p - accs[i].name;
      +                            size_t plen = p - accs[i].name;
       
                                   if (!strncmp(lang, accs[i].name, plen)) {
                                       fiddle_q = 0.001f;
      @@ -1729,6 +1732,7 @@
        * v1.0) from rfc2296.  This is the algorithm that goes together with
        * transparent content negotiation (TCN).
        */
      +/*ARGSUSED*/
       static int is_variant_better_rvsa(negotiation_state *neg, var_rec *variant,
                                         var_rec *best, float *p_bestq)
       {
      @@ -2172,7 +2176,7 @@
                * content-length, which currently leads to the correct result).
                */
               if (!(variant->sub_req && variant->sub_req->handler)
      -            && (len = find_content_length(neg, variant)) != 0) {
      +            && (len = (long) find_content_length(neg, variant)) != 0) {
       
                   lenstr = (char *) ap_palloc(r->pool, 22);
                   ap_snprintf(lenstr, 22, "%ld", len);
      diff -Naur apache_1.3.12/src/modules/standard/mod_rewrite.c-orig apache_1.3.12/src/modules/standard/mod_rewrite.c
      --- apache_1.3.12/src/modules/standard/mod_rewrite.c-orig	Sun Jan 16 10:06:30 2000
      +++ apache_1.3.12/src/modules/standard/mod_rewrite.c	Wed Feb  9 17:34:31 2000
      @@ -422,6 +422,7 @@
           return NULL;
       }
       
      +/*ARGSUSED1*/
       static const char *cmd_rewritelog(cmd_parms *cmd, void *dconf, char *a1)
       {
           rewrite_server_conf *sconf;
      @@ -434,6 +435,7 @@
           return NULL;
       }
       
      +/*ARGSUSED1*/
       static const char *cmd_rewriteloglevel(cmd_parms *cmd, void *dconf, char *a1)
       {
           rewrite_server_conf *sconf;
      @@ -446,6 +448,7 @@
           return NULL;
       }
       
      +/*ARGSUSED1*/
       static const char *cmd_rewritemap(cmd_parms *cmd, void *dconf, char *a1,
                                         char *a2)
       {
      @@ -524,6 +527,7 @@
           return NULL;
       }
       
      +/*ARGSUSED1*/
       static const char *cmd_rewritelock(cmd_parms *cmd, void *dconf, char *a1)
       {
           const char *error;
      @@ -680,6 +684,7 @@
           return NULL;
       }
       
      +/*ARGSUSED3*/
       static const char *cmd_rewritecond_setflag(pool *p, rewritecond_entry *cfg,
                                                  char *key, char *val)
       {
      @@ -1241,7 +1246,7 @@
                   n = prefix_stat(r->filename, &finfo);
                   if (n == 0) {
                       if ((ccp = ap_document_root(r)) != NULL) {
      -                    l = ap_cpystrn(docroot, ccp, sizeof(docroot)) - docroot;
      +                    l = (int) (ap_cpystrn(docroot, ccp, sizeof(docroot)) - docroot);
       
                           /* always NOT have a trailing slash */
                           if (docroot[l-1] == '/') {
      @@ -1316,7 +1321,7 @@
           char *cp2;
           const char *ccp;
           char *prefix;
      -    int l;
      +    size_t l;
           int n;
           char *ofilename;
       
      @@ -2012,7 +2017,7 @@
            *   location, i.e. if it's not starting with either a slash
            *   or a fully qualified URL scheme.
            */
      -    i = strlen(r->filename);
      +    i = ap_strlen(r->filename);
           if (   prefixstrip
               && !(   r->filename[0] == '/'
                    || (   (i > 7 && strncasecmp(r->filename, "http://",   7) == 0)
      @@ -2085,7 +2090,7 @@
            *  redirection (`RewriteRule .. ://...') then
            *  directly force an external HTTP redirect.
            */
      -    i = strlen(r->filename);
      +    i = ap_strlen(r->filename);
           if (   (i > 7 && strncasecmp(r->filename, "http://",   7) == 0)
               || (i > 8 && strncasecmp(r->filename, "https://",  8) == 0)
               || (i > 9 && strncasecmp(r->filename, "gopher://", 9) == 0)
      @@ -2149,6 +2154,7 @@
           return 1;
       }
       
      +/*ARGSUSED2*/
       static int apply_rewrite_cond(request_rec *r, rewritecond_entry *p,
                                     char *perdir, backrefinfo *briRR,
                                     backrefinfo *briRC)
      @@ -2370,7 +2376,7 @@
           char host[LONG_STRING_LEN];
           char buf[MAX_STRING_LEN];
           char *olduri;
      -    int l;
      +    size_t l;
       
           cp = ap_http_method(r);
           l  = strlen(cp);
      @@ -2442,20 +2448,20 @@
       
       static void fully_qualify_uri(request_rec *r)
       {
      -    int i;
      +    size_t l;
           char buf[32];
           const char *thisserver;
           char *thisport;
           int port;
       
      -    i = strlen(r->filename);
      -    if (!(   (i > 7 && strncasecmp(r->filename, "http://",   7) == 0)
      -          || (i > 8 && strncasecmp(r->filename, "https://",  8) == 0)
      -          || (i > 9 && strncasecmp(r->filename, "gopher://", 9) == 0)
      -          || (i > 6 && strncasecmp(r->filename, "ftp://",    6) == 0)
      -          || (i > 5 && strncasecmp(r->filename, "ldap:",     5) == 0)
      -          || (i > 5 && strncasecmp(r->filename, "news:",     5) == 0)
      -          || (i > 7 && strncasecmp(r->filename, "mailto:",   7) == 0))) {
      +    l = strlen(r->filename);
      +    if (!(   (l > 7 && strncasecmp(r->filename, "http://",   7) == 0)
      +          || (l > 8 && strncasecmp(r->filename, "https://",  8) == 0)
      +          || (l > 9 && strncasecmp(r->filename, "gopher://", 9) == 0)
      +          || (l > 6 && strncasecmp(r->filename, "ftp://",    6) == 0)
      +          || (l > 5 && strncasecmp(r->filename, "ldap:",     5) == 0)
      +          || (l > 5 && strncasecmp(r->filename, "news:",     5) == 0)
      +          || (l > 7 && strncasecmp(r->filename, "mailto:",   7) == 0))) {
       
               thisserver = ap_get_server_name(r);
               port = ap_get_server_port(r);
      @@ -2592,7 +2598,7 @@
           char mapname[LONG_STRING_LEN];
           char mapkey[LONG_STRING_LEN];
           char defaultvalue[LONG_STRING_LEN];
      -    int n;
      +    size_t n;
       
           cpI = uri;
           cpIE = cpI+strlen(cpI);
      @@ -3151,6 +3157,7 @@
           return;
       }
       
      +/*PRINTFLIKE3*/
       static void rewritelog(request_rec *r, int level, const char *text, ...)
       {
           rewrite_server_conf *conf;
      @@ -3275,10 +3282,6 @@
       
       static void rewritelock_create(server_rec *s, pool *p)
       {
      -    rewrite_server_conf *conf;
      -
      -    conf = ap_get_module_config(s->module_config, &rewrite_module);
      -
           /* only operate if a lockfile is used */
           if (lockname == NULL || *(lockname) == '\0') {
               return;
      @@ -3307,10 +3310,6 @@
       
       static void rewritelock_open(server_rec *s, pool *p)
       {
      -    rewrite_server_conf *conf;
      -
      -    conf = ap_get_module_config(s->module_config, &rewrite_module);
      -
           /* only operate if a lockfile is used */
           if (lockname == NULL || *(lockname) == '\0') {
               return;
      @@ -3327,6 +3326,7 @@
           return;
       }
       
      +/*ARGSUSED*/
       static void rewritelock_remove(void *data)
       {
           /* only operate if a lockfile is used */
      @@ -3418,6 +3418,7 @@
       }
       
       /* child process code */
      +/*ARGSUSED1*/
       static int rewritemap_program_child(void *cmd, child_info *pinfo)
       {
           int child_pid = 1;
      @@ -3820,6 +3821,7 @@
           return c;
       }
       
      +/*ARGSUSED2*/
       static void set_cache_string(cache *c, char *res, int mode, time_t t,
                                    char *key, char *value)
       {
      @@ -3856,7 +3858,7 @@
       
       static int cache_tlb_hash(char *key)
       {
      -    unsigned long n;
      +    ap_uint32 n;
           char *p;
       
           n = 0;
      @@ -3864,7 +3866,7 @@
               n = n * 53711 + 134561 + (unsigned)(*p & 0xff);
           }
       
      -    return n % CACHE_TLB_ROWS;
      +    return (int) (n % CACHE_TLB_ROWS);
       }
       
       static cacheentry *cache_tlb_lookup(cachetlbentry *tlb, cacheentry *elt,
      @@ -3895,7 +3897,7 @@
           for (i=1; i < CACHE_TLB_COLS; ++i)
               tlb->t[i] = tlb->t[i-1];
       
      -    tlb->t[0] = e - elt;
      +    tlb->t[0] = (int) (e - elt);
       }
       
       static void store_cache_string(cache *c, char *res, cacheentry *ce)
      @@ -4011,7 +4013,7 @@
           char matchbuf[LONG_STRING_LEN];
           char substbuf[LONG_STRING_LEN];
           char *output;
      -    int l;
      +    size_t l;
       
           output = input;
       
      @@ -4134,7 +4136,7 @@
           char var[MAX_STRING_LEN];
           char val[MAX_STRING_LEN];
           char *cp;
      -    int n;
      +    size_t n;
       
           if ((cp = strchr(s, ':')) != NULL) {
               n = ((cp-s) > MAX_STRING_LEN-1 ? MAX_STRING_LEN-1 : (cp-s));
      @@ -4261,8 +4263,8 @@
       
       static int compare_lexicography(char *cpNum1, char *cpNum2)
       {
      -    int i;
      -    int n1, n2;
      +    size_t i;
      +    size_t n1, n2;
       
           n1 = strlen(cpNum1);
           n2 = strlen(cpNum2);
      diff -Naur apache_1.3.12/src/modules/standard/mod_rewrite.h-orig apache_1.3.12/src/modules/standard/mod_rewrite.h
      --- apache_1.3.12/src/modules/standard/mod_rewrite.h-orig	Thu Oct 21 13:45:38 1999
      +++ apache_1.3.12/src/modules/standard/mod_rewrite.h	Wed Feb  9 17:34:31 2000
      @@ -354,7 +354,7 @@
            */
       typedef struct backrefinfo {
           char *source;
      -    int nsub;
      +    size_t nsub;
           regmatch_t regmatch[10];
       } backrefinfo;
       
      @@ -450,6 +450,7 @@
       
           /* rewriting logfile support */
       static void  open_rewritelog(server_rec *s, pool *p);
      +/*PRINTFLIKE3*/
       static void  rewritelog(request_rec *r, int level, const char *text, ...)
                               __attribute__((format(printf,3,4)));
       static char *current_logtime(request_rec *r);
      diff -Naur apache_1.3.12/src/modules/standard/mod_setenvif.c-orig apache_1.3.12/src/modules/standard/mod_setenvif.c
      --- apache_1.3.12/src/modules/standard/mod_setenvif.c-orig	Fri Jun  4 11:40:00 1999
      +++ apache_1.3.12/src/modules/standard/mod_setenvif.c	Wed Feb  9 17:34:31 2000
      @@ -145,6 +145,7 @@
       
       module MODULE_VAR_EXPORT setenvif_module;
       
      +/*ARGSUSED1*/
       static void *create_setenvif_config(pool *p, server_rec *dummy)
       {
           sei_cfg_rec *new = (sei_cfg_rec *) ap_palloc(p, sizeof(sei_cfg_rec));
      @@ -168,6 +169,7 @@
        */
       #define ICASE_MAGIC	((void *)(&setenvif_module))
       
      +/*ARGSUSED1*/
       static const char *add_setenvif_core(cmd_parms *cmd, void *mconfig,
       				     char *fname, const char *args)
       {
      diff -Naur apache_1.3.12/src/modules/standard/mod_so.c-orig apache_1.3.12/src/modules/standard/mod_so.c
      --- apache_1.3.12/src/modules/standard/mod_so.c-orig	Tue May  4 04:21:14 1999
      +++ apache_1.3.12/src/modules/standard/mod_so.c	Wed Feb  9 17:34:31 2000
      @@ -147,6 +147,7 @@
           array_header *loaded_modules;
       } so_server_conf;
       
      +/*ARGSUSED1*/
       static void *so_sconf_create(pool *p, server_rec *s)
       {
           so_server_conf *soc;
      @@ -202,6 +203,7 @@
        * a shared object file into the address space of the server process.
        */
       
      +/*ARGSUSED1*/
       static const char *load_module(cmd_parms *cmd, void *dummy, 
                                      char *modname, char *filename)
       {
      @@ -289,6 +291,7 @@
        * shared object file into the adress space of the server process.
        */
       
      +/*ARGSUSED1*/
       static const char *load_file(cmd_parms *cmd, void *dummy, char *filename)
       {
           ap_os_dso_handle_t handle;
      diff -Naur apache_1.3.12/src/modules/standard/mod_speling.c-orig apache_1.3.12/src/modules/standard/mod_speling.c
      --- apache_1.3.12/src/modules/standard/mod_speling.c-orig	Wed Feb 16 09:31:16 2000
      +++ apache_1.3.12/src/modules/standard/mod_speling.c	Wed Mar  1 17:04:35 2000
      @@ -110,6 +110,7 @@
        * Respond to a callback to create configuration record for a server or
        * vhost environment.
        */
      +/*ARGSUSED1*/
       static void *create_mconfig_for_server(pool *p, server_rec *s)
       {
           return mkconfig(p);
      @@ -118,6 +119,7 @@
       /*
        * Respond to a callback to create a config record for a specific directory.
        */
      +/*ARGSUSED1*/
       static void *create_mconfig_for_directory(pool *p, char *dir)
       {
           return mkconfig(p);
      @@ -126,6 +128,7 @@
       /*
        * Handler for the CheckSpelling directive, which is FLAG.
        */
      +/*ARGSUSED*/
       static const char *set_speling(cmd_parms *cmd, void *mconfig, int arg)
       {
           spconfig *cfg = (spconfig *) mconfig;
      @@ -277,8 +280,8 @@
           /* postgood = mispelling/more */
           postgood = ap_pstrcat(r->pool, bad, r->path_info, NULL);
       
      -    urlen = strlen(r->uri);
      -    pglen = strlen(postgood);
      +    urlen = ap_strlen(r->uri);
      +    pglen = ap_strlen(postgood);
       
           /* Check to see if the URL pieces add up */
           if (strcmp(postgood, r->uri + (urlen - pglen))) {
      @@ -298,7 +301,7 @@
       
           dotloc = ap_ind(bad, '.');
           if (dotloc == -1) {
      -        dotloc = strlen(bad);
      +        dotloc = ap_strlen(bad);
           }
       
           while ((dir_entry = readdir(dirp)) != NULL) {
      @@ -369,7 +372,7 @@
                    */
                   int entloc = ap_ind(dir_entry->d_name, '.');
                   if (entloc == -1) {
      -                entloc = strlen(dir_entry->d_name);
      +                entloc = ap_strlen(dir_entry->d_name);
       	    }
       
                   if ((dotloc == entloc)
      diff -Naur apache_1.3.12/src/modules/standard/mod_status.c-orig apache_1.3.12/src/modules/standard/mod_status.c
      --- apache_1.3.12/src/modules/standard/mod_status.c-orig	Sat Feb  5 04:33:16 2000
      +++ apache_1.3.12/src/modules/standard/mod_status.c	Wed Mar  1 17:17:39 2000
      @@ -74,6 +74,9 @@
        * /server-status?refresh - Returns page with 1 second refresh
        * /server-status?refresh=6 - Returns page with refresh every 6 seconds
        * /server-status?auto - Returns page with data for automatic parsing
      +#ifdef USE_QSC
      + * /server-status?qsc=... - Returns page with extra QSC status info
      +#endif
        *
        * Mark Cox, mark@ukweb.com, November 1995
        *
      @@ -135,6 +138,7 @@
        *command-related code. This is here to prevent use of ExtendedStatus
        * without status_module included.
        */
      +/*ARGSUSED1*/
       static const char *set_extended_status(cmd_parms *cmd, void *dummy, int arg) 
       {
           const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
      @@ -203,6 +207,7 @@
       #define STAT_OPT_REFRESH	0
       #define STAT_OPT_NOTABLE	1
       #define STAT_OPT_AUTO		2
      +#define STAT_OPT_QSC		3
       
       struct stat_opt {
           int id;
      @@ -215,6 +220,9 @@
           {STAT_OPT_REFRESH, "refresh", "Refresh"},
           {STAT_OPT_NOTABLE, "notable", NULL},
           {STAT_OPT_AUTO, "auto", NULL},
      +#ifdef USE_QSC
      +    {STAT_OPT_QSC, "qsc", NULL},
      +#endif
           {STAT_OPT_END, NULL, NULL}
       };
       
      @@ -237,7 +245,7 @@
           long req_time;
       #ifndef NO_TIMES
       #ifdef _SC_CLK_TCK
      -    float tick = sysconf(_SC_CLK_TCK);
      +    float tick = (float) sysconf(_SC_CLK_TCK);
       #else
           float tick = HZ;
       #endif
      @@ -248,8 +256,15 @@
           parent_score ps_record;
           char stat_buffer[HARD_SERVER_LIMIT];
           int pid_buffer[HARD_SERVER_LIMIT];
      +#ifdef SINGLE_LISTEN_UNSERIALIZED_ACCEPT
      +    int cpu_buffer[HARD_SERVER_LIMIT];
      +    struct sockaddr_in addr_buffer[HARD_SERVER_LIMIT];
      +#endif
           clock_t tu, ts, tcu, tcs;
           server_rec *vhost;
      +#ifdef USE_QSC
      +    const char *qscp = NULL;
      +#endif
       
           tu = ts = tcu = tcs = 0;
       
      @@ -277,7 +292,7 @@
       		    if (*(loc + strlen(status_options[i].form_data_str)) == '=')
       			ap_table_set(r->headers_out,
       			      status_options[i].hdr_out_str,
      -			      loc + strlen(status_options[i].hdr_out_str) + 1);
      +			      loc + strlen(status_options[i].form_data_str) + 1);
       		    else
       			ap_table_set(r->headers_out,
       			      status_options[i].hdr_out_str, "1");
      @@ -289,6 +304,12 @@
       		    r->content_type = "text/plain";
       		    short_report = 1;
       		    break;
      +#ifdef USE_QSC
      +		case STAT_OPT_QSC:
      +		    if (loc[strlen(status_options[i].form_data_str)] == '=')
      +			qscp = &loc[strlen(status_options[i].form_data_str) + 1];
      +		    break;
      +#endif
       		}
       	    }
       	    i++;
      @@ -307,6 +328,11 @@
       	res = score_record.status;
       	stat_buffer[i] = status_flags[res];
       	pid_buffer[i] = (int) ps_record.pid;
      +#ifdef SINGLE_LISTEN_UNSERIALIZED_ACCEPT
      +	cpu_buffer[i] = score_record.cpu;
      +	if (ap_single_listen)
      +	    addr_buffer[i] = score_record.single_addr;
      +#endif
       	if (res == SERVER_READY)
       	    ready++;
       	else if (res != SERVER_DEAD)
      @@ -365,7 +391,7 @@
       	    /* Allow for OS/2 not having CPU stats */
       	    if (ts || tu || tcu || tcs)
       		ap_rprintf(r, "CPULoad: %g\n",
      -		    (tu + ts + tcu + tcs) / tick / up_time * 100.);
      +		    (float) (tu + ts + tcu + tcs) / tick / (float) up_time * 100.);
       #endif
       
       	    ap_rprintf(r, "Uptime: %ld\n", (long) (up_time));
      @@ -389,11 +415,12 @@
       	    /* Allow for OS/2 not having CPU stats */
       	    ap_rputs("
      \n", r); ap_rprintf(r, "CPU Usage: u%g s%g cu%g cs%g", - tu / tick, ts / tick, tcu / tick, tcs / tick); + (float) tu / tick, (float) ts / tick, + (float) tcu / tick, (float) tcs / tick); if (ts || tu || tcu || tcs) ap_rprintf(r, " - %.3g%% CPU load", - (tu + ts + tcu + tcs) / tick / up_time * 100.); + (float) (tu + ts + tcu + tcs) / tick / (float) up_time * 100.); #endif ap_rputs("
      \n", r); @@ -403,12 +430,12 @@ (float) count / (float) up_time); if (up_time > 0) { - format_byte_out(r, KBYTE * (float) kbcount / (float) up_time); + format_byte_out(r, (unsigned long) (KBYTE * (float) kbcount / (float) up_time)); ap_rputs("/second - ", r); } if (count > 0) { - format_byte_out(r, KBYTE * (float) kbcount / (float) count); + format_byte_out(r, (unsigned long) (KBYTE * (float) kbcount / (float) count)); ap_rputs("/request", r); } @@ -456,6 +483,26 @@ ap_rputs("
      \n", r);
       	    for (i = 0; i < HARD_SERVER_LIMIT; ++i) {
       		if (stat_buffer[i] != '.') {
      +#ifdef SINGLE_LISTEN_UNSERIALIZED_ACCEPT
      +		    char slbuf[32];
      +
      +		    if (cpu_buffer[i] >= 0)
      +			ap_snprintf(slbuf, sizeof slbuf, "cpu %d", cpu_buffer[i]);
      +		    else
      +			strcpy(slbuf, "any cpu");
      +		    ap_rprintf(r, "   %d in state: %c on %s", pid_buffer[i],
      +		     stat_buffer[i], slbuf);
      +		    if (ap_single_listen)
      +			ap_rprintf(r, " listening to %s:%hu\n",
      +			    (addr_buffer[i].sin_addr.s_addr == htonl(INADDR_ANY)) ?
      +			    "*" : ap_inet_ntoa(addr_buffer[i].sin_addr, slbuf, NULL),
      +			    ntohs(addr_buffer[i].sin_port));
      +		    else if (++j >= 2) {
      +		    	ap_rputs("\n", r);
      +			j = 0;
      +		    } else
      +		    	ap_rputs(",", r);
      +#else
       		    ap_rprintf(r, "   %d in state: %c ", pid_buffer[i],
       		     stat_buffer[i]);
       		    if (++j >= 3) {
      @@ -463,6 +510,7 @@
       			j = 0;
       		    } else
       		    	ap_rputs(",", r);
      +#endif
       		}
       	    }
       	    ap_rputs("\n", r);
      @@ -495,7 +543,7 @@
       #ifndef NO_TIMES
       	    if (score_record.start_time == (clock_t) 0)
       #endif /* NO_TIMES */
      -		req_time = 0L;
      +		req_time = 0;
       #ifndef NO_TIMES
       	    else {
       		req_time = score_record.stop_time - score_record.start_time;
      @@ -503,16 +551,16 @@
       	    }
       #endif /* NO_TIMES */
       #else
      -	    if (score_record.start_time.tv_sec == 0L &&
      -		score_record.start_time.tv_usec == 0L)
      -		req_time = 0L;
      +	    if (score_record.start_time.tv_sec == 0 &&
      +		score_record.start_time.tv_usec == 0)
      +		req_time = 0;
       	    else
       		req_time =
       		    ((score_record.stop_time.tv_sec - score_record.start_time.tv_sec) * 1000) +
       		    ((score_record.stop_time.tv_usec - score_record.start_time.tv_usec) / 1000);
       #endif
      -	    if (req_time < 0L)
      -		req_time = 0L;
      +	    if (req_time < 0)
      +		req_time = 0;
       
       	    lres = score_record.access_count;
       	    my_lres = score_record.my_access_count;
      @@ -574,10 +622,10 @@
       #else
       
       			ap_rprintf(r, "] u%g s%g cu%g cs%g\n %.0f %ld (",
      -			    score_record.times.tms_utime / tick,
      -			    score_record.times.tms_stime / tick,
      -			    score_record.times.tms_cutime / tick,
      -			    score_record.times.tms_cstime / tick,
      +			    (float) score_record.times.tms_utime / tick,
      +			    (float) score_record.times.tms_stime / tick,
      +			    (float) score_record.times.tms_cutime / tick,
      +			    (float) score_record.times.tms_cstime / tick,
       #endif
       #ifdef OPTIMIZE_TIMEOUTS
       			    difftime(nowtime, ps_record.last_rtime),
      @@ -647,7 +695,7 @@
       			ap_rprintf(r, "\n%.0f%ld",
       #else
       			ap_rprintf(r, "\n%.2f%.0f%ld",
      -			    (score_record.times.tms_utime +
      +			    (float) (score_record.times.tms_utime +
       			     score_record.times.tms_stime +
       			     score_record.times.tms_cutime +
       			     score_record.times.tms_cstime) / tick,
      @@ -716,6 +764,11 @@
       
           }
       
      +#ifdef USE_QSC
      +    ap_rputs("
      ", r); + qsc_status(r, qscp); +#endif + if (!short_report) { ap_rputs(ap_psignature("
      \n",r), r); ap_rputs("\n", r); @@ -726,6 +779,7 @@ } +/*ARGSUSED0*/ static void status_init(server_rec *s, pool *p) { status_flags[SERVER_DEAD] = '.'; /* We don't want to assume these are in */ diff -Naur apache_1.3.12/src/modules/standard/mod_unique_id.c-orig apache_1.3.12/src/modules/standard/mod_unique_id.c --- apache_1.3.12/src/modules/standard/mod_unique_id.c-orig Sat Aug 14 01:35:53 1999 +++ apache_1.3.12/src/modules/standard/mod_unique_id.c Wed Feb 9 17:34:31 2000 @@ -155,6 +155,7 @@ unique_id_rec_total_size, unique_id_rec_size_uu; +/*ARGSUSED1*/ static void unique_id_global_init(server_rec *s, pool *p) { #ifndef MAXHOSTNAMELEN @@ -169,13 +170,13 @@ /* * Calculate the sizes and offsets in cur_unique_id. */ - unique_id_rec_offset[0] = XtOffsetOf(unique_id_rec, stamp); + unique_id_rec_offset[0] = (unsigned short) XtOffsetOf(unique_id_rec, stamp); unique_id_rec_size[0] = sizeof(cur_unique_id.stamp); - unique_id_rec_offset[1] = XtOffsetOf(unique_id_rec, in_addr); + unique_id_rec_offset[1] = (unsigned short) XtOffsetOf(unique_id_rec, in_addr); unique_id_rec_size[1] = sizeof(cur_unique_id.in_addr); - unique_id_rec_offset[2] = XtOffsetOf(unique_id_rec, pid); + unique_id_rec_offset[2] = (unsigned short) XtOffsetOf(unique_id_rec, pid); unique_id_rec_size[2] = sizeof(cur_unique_id.pid); - unique_id_rec_offset[3] = XtOffsetOf(unique_id_rec, counter); + unique_id_rec_offset[3] = (unsigned short) XtOffsetOf(unique_id_rec, counter); unique_id_rec_size[3] = sizeof(cur_unique_id.counter); unique_id_rec_total_size = unique_id_rec_size[0] + unique_id_rec_size[1] + unique_id_rec_size[2] + unique_id_rec_size[3]; @@ -236,6 +237,7 @@ #endif } +/*ARGSUSED1*/ static void unique_id_child_init(server_rec *s, pool *p) { pid_t pid; @@ -281,7 +283,7 @@ /* Some systems have very low variance on the low end of their * system counter, defend against that. */ - cur_unique_id.counter = tv.tv_usec / 10; + cur_unique_id.counter = (unsigned short) (tv.tv_usec / 10); } #else cur_unique_id.counter = 0; diff -Naur apache_1.3.12/src/modules/standard/mod_userdir.c-orig apache_1.3.12/src/modules/standard/mod_userdir.c --- apache_1.3.12/src/modules/standard/mod_userdir.c-orig Thu Oct 21 13:45:46 1999 +++ apache_1.3.12/src/modules/standard/mod_userdir.c Wed Feb 9 17:34:31 2000 @@ -108,6 +108,7 @@ * explicit) disablement, and the replacement string for all others. */ +/*ARGSUSED1*/ static void *create_userdir_config(pool *p, server_rec *s) { userdir_config @@ -124,6 +125,7 @@ #define O_ENABLE 1 #define O_DISABLE 2 +/*ARGSUSED1*/ static const char *set_user_dir(cmd_parms *cmd, void *dummy, char *arg) { userdir_config diff -Naur apache_1.3.12/src/modules/standard/mod_usertrack.c-orig apache_1.3.12/src/modules/standard/mod_usertrack.c --- apache_1.3.12/src/modules/standard/mod_usertrack.c-orig Fri Oct 29 14:29:53 1999 +++ apache_1.3.12/src/modules/standard/mod_usertrack.c Wed Feb 9 17:34:31 2000 @@ -248,6 +248,7 @@ return OK; /* We set our cookie */ } +/*ARGSUSED1*/ static void *make_cookie_log_state(pool *p, server_rec *s) { cookie_log_state *cls = @@ -258,6 +259,7 @@ return (void *) cls; } +/*ARGSUSED1*/ static void *make_cookie_dir(pool *p, char *d) { cookie_dir_rec *dcfg; @@ -268,6 +270,7 @@ return dcfg; } +/*ARGSUSED*/ static const char *set_cookie_enable(cmd_parms *cmd, void *mconfig, int arg) { cookie_dir_rec *dcfg = mconfig; @@ -276,6 +279,7 @@ return NULL; } +/*ARGSUSED1*/ static const char *set_cookie_exp(cmd_parms *parms, void *dummy, const char *arg) { cookie_log_state *cls = ap_get_module_config(parms->server->module_config, @@ -286,7 +290,7 @@ /* The simple case first - all numbers (we assume) */ if (ap_isdigit(arg[0]) && ap_isdigit(arg[strlen(arg) - 1])) { - cls->expires = atol(arg); + cls->expires = (time_t) atol(arg); return NULL; } diff -Naur apache_1.3.12/src/modules/standard/mod_vhost_alias.c-orig apache_1.3.12/src/modules/standard/mod_vhost_alias.c --- apache_1.3.12/src/modules/standard/mod_vhost_alias.c-orig Mon Dec 20 10:16:54 1999 +++ apache_1.3.12/src/modules/standard/mod_vhost_alias.c Wed Feb 9 17:34:31 2000 @@ -101,6 +101,7 @@ mva_mode_e cgi_root_mode; } mva_sconf_t; +/*ARGSUSED1*/ static void *mva_create_server_config(pool *p, server_rec *s) { mva_sconf_t *conf; @@ -149,6 +150,7 @@ vhost_alias_set_doc_root_name, vhost_alias_set_cgi_root_name; +/*ARGSUSED*/ static const char *vhost_alias_set(cmd_parms *cmd, void *dummy, char *map) { mva_sconf_t *conf; @@ -159,22 +161,22 @@ conf = (mva_sconf_t *) ap_get_module_config(cmd->server->module_config, &vhost_alias_module); /* there ought to be a better way of doing this */ - if (&vhost_alias_set_doc_root_ip == cmd->info) { + if ((void *) &vhost_alias_set_doc_root_ip == cmd->info) { mode = VHOST_ALIAS_IP; pmap = &conf->doc_root; pmode = &conf->doc_root_mode; } - else if (&vhost_alias_set_cgi_root_ip == cmd->info) { + else if ((void *) &vhost_alias_set_cgi_root_ip == cmd->info) { mode = VHOST_ALIAS_IP; pmap = &conf->cgi_root; pmode = &conf->cgi_root_mode; } - else if (&vhost_alias_set_doc_root_name == cmd->info) { + else if ((void *) &vhost_alias_set_doc_root_name == cmd->info) { mode = VHOST_ALIAS_NAME; pmap = &conf->doc_root; pmode = &conf->doc_root_mode; } - else if (&vhost_alias_set_cgi_root_name == cmd->info) { + else if ((void *) &vhost_alias_set_cgi_root_name == cmd->info) { mode = VHOST_ALIAS_NAME; pmap = &conf->cgi_root; pmode = &conf->cgi_root_mode; @@ -389,7 +391,7 @@ end = end-M+1; } } - vhost_alias_checkspace(r, buf, &dest, end - start); + vhost_alias_checkspace(r, buf, &dest, (int) (end - start)); for (p = start; p < end; ++p) { *dest++ = ap_tolower(*p); } diff -Naur apache_1.3.12/src/os/unix/Makefile.tmpl-orig apache_1.3.12/src/os/unix/Makefile.tmpl --- apache_1.3.12/src/os/unix/Makefile.tmpl-orig Sun Sep 6 23:59:35 1998 +++ apache_1.3.12/src/os/unix/Makefile.tmpl Wed Feb 9 17:34:31 2000 @@ -44,4 +44,5 @@ $(OSDIR)/os.h $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h os.o: os.c $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h os.h + $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ + $(INCDIR)/hsregex.h os.h diff -Naur apache_1.3.12/src/os/unix/os-inline.c-orig apache_1.3.12/src/os/unix/os-inline.c --- apache_1.3.12/src/os/unix/os-inline.c-orig Mon Jul 13 04:32:49 1998 +++ apache_1.3.12/src/os/unix/os-inline.c Wed Feb 9 17:34:31 2000 @@ -29,3 +29,13 @@ { return file[0] == '/'; } + +/* + * changed from macro to inline function to eliminate compiler warnings + * about constant controlling expressions + */ +/*ARGSUSED0*/ +INLINE int ap_os_is_filename_valid(const char *file) +{ + return 1; +} diff -Naur apache_1.3.12/src/os/unix/os.c-orig apache_1.3.12/src/os/unix/os.c --- apache_1.3.12/src/os/unix/os.c-orig Sat Jan 15 08:01:09 2000 +++ apache_1.3.12/src/os/unix/os.c Wed Feb 9 17:34:31 2000 @@ -6,6 +6,11 @@ #include "ap_config.h" #include "os.h" +#if defined(IRIX) && IRIX >= 50 +#include "httpd.h" +#include "http_log.h" +#include +#endif /* some linkers complain unless there's at least one function in each * .o file... and extra prototype is for gcc -Wmissing-prototypes @@ -181,4 +186,25 @@ #else return dlerror(); #endif +} + +/* + * Bind the current process to the given CPU. Return nonzero if + * successful. + */ +int +ap_os_bind_cpu(int cpu) +{ + int bound = 0; + +#if defined(IRIX) && IRIX >= 50 + /* only Irix 5.0 and beyond have sysmp(MP_MUSTRUN) */ + if (sysmp(MP_MUSTRUN, cpu) != -1) + bound = 1; + else + ap_log_error(APLOG_MARK, APLOG_WARNING, NULL, + "cannot bind process %d to cpu %d", getpid(), cpu); +#endif + + return bound; } diff -Naur apache_1.3.12/src/os/unix/os.h-orig apache_1.3.12/src/os/unix/os.h --- apache_1.3.12/src/os/unix/os.h-orig Thu Dec 9 11:21:55 1999 +++ apache_1.3.12/src/os/unix/os.h Wed Feb 9 17:34:31 2000 @@ -77,6 +77,7 @@ #define INLINE extern ap_inline INLINE int ap_os_is_path_absolute(const char *file); +INLINE int ap_os_is_filename_valid(const char *file); #include "os-inline.c" @@ -86,11 +87,11 @@ * as normal */ extern int ap_os_is_path_absolute(const char *file); +extern int ap_os_is_filename_valid(const char *file); #endif /* Other ap_os_ routines not used by this platform */ -#define ap_os_is_filename_valid(f) (1) #define ap_os_kill(pid, sig) kill(pid, sig) /* @@ -146,5 +147,7 @@ void ap_os_dso_unload(void *); void * ap_os_dso_sym(void *, const char *); const char *ap_os_dso_error(void); + +int ap_os_bind_cpu(int); #endif /* !APACHE_OS_H */ diff -Naur apache_1.3.12/src/os/win32/os.h-orig apache_1.3.12/src/os/win32/os.h --- apache_1.3.12/src/os/win32/os.h-orig Mon Sep 13 06:32:41 1999 +++ apache_1.3.12/src/os/win32/os.h Wed Feb 9 17:34:31 2000 @@ -193,5 +193,6 @@ /* Other ap_os_ routines not used by this platform */ #define ap_os_kill(pid, sig) kill(pid, sig) +#define ap_os_bind_cpu(c) (0) #endif /* ! APACHE_OS_H */ diff -Naur apache_1.3.12/src/regex/debug.c-orig apache_1.3.12/src/regex/debug.c --- apache_1.3.12/src/regex/debug.c-orig Tue Jun 29 07:16:45 1999 +++ apache_1.3.12/src/regex/debug.c Wed Feb 9 17:34:31 2000 @@ -16,9 +16,7 @@ == void regprint(regex_t *r, FILE *d); */ void -regprint(r, d) -regex_t *r; -FILE *d; +regprint(regex_t *r, FILE *d) { register struct re_guts *g = r->re_g; register int i; @@ -89,9 +87,7 @@ == static void s_print(register struct re_guts *g, FILE *d); */ static void -s_print(g, d) -register struct re_guts *g; -FILE *d; +s_print(register struct re_guts *g, FILE *d) { register sop *s; register cset *cs; @@ -230,8 +226,7 @@ == static char *regchar(int ch); */ static char * /* -> representation */ -regchar(ch) -int ch; +regchar(int ch) { static char buf[10]; diff -Naur apache_1.3.12/src/regex/engine.c-orig apache_1.3.12/src/regex/engine.c --- apache_1.3.12/src/regex/engine.c-orig Mon Jul 13 04:32:52 1998 +++ apache_1.3.12/src/regex/engine.c Wed Feb 9 17:34:31 2000 @@ -64,12 +64,8 @@ == size_t nmatch, regmatch_t pmatch[], int eflags); */ static int /* 0 success, REG_NOMATCH failure */ -matcher(g, string, nmatch, pmatch, eflags) -register struct re_guts *g; -char *string; -size_t nmatch; -regmatch_t pmatch[]; -int eflags; +matcher(register struct re_guts *g, char *string, size_t nmatch, + regmatch_t pmatch[], int eflags) { register char *endp; register int i; @@ -230,12 +226,8 @@ == char *stop, sopno startst, sopno stopst); */ static char * /* == stop (success) always */ -dissect(m, start, stop, startst, stopst) -register struct match *m; -char *start; -char *stop; -sopno startst; -sopno stopst; +dissect(register struct match *m, char *start, char *stop, sopno startst, + sopno stopst) { register int i; register sopno ss; /* start sop of current subRE */ @@ -249,7 +241,9 @@ register char *ssp; /* start of string matched by subsubRE */ register char *sep; /* end of string matched by subsubRE */ register char *oldssp; /* previous ssp */ +#ifndef NDEBUG register char *dp; +#endif AT("diss", start, stop, startst, stopst); sp = start; @@ -308,7 +302,10 @@ esub = es - 1; /* did innards match? */ if (slow(m, sp, rest, ssub, esub) != NULL) { - dp = dissect(m, sp, rest, ssub, esub); +#ifndef NDEBUG + dp = +#endif + dissect(m, sp, rest, ssub, esub); assert(dp == rest); } else /* no */ assert(sp == rest); @@ -346,7 +343,10 @@ } assert(sep == rest); /* must exhaust substring */ assert(slow(m, ssp, sep, ssub, esub) == rest); - dp = dissect(m, ssp, sep, ssub, esub); +#ifndef NDEBUG + dp = +#endif + dissect(m, ssp, sep, ssub, esub); assert(dp == sep); sp = rest; break; @@ -365,7 +365,7 @@ assert(stp >= sp); /* it did work */ } ssub = ss + 1; - esub = ss + OPND(m->g->strip[ss]) - 1; + esub = (sopno) (ss + OPND(m->g->strip[ss]) - 1); assert(OP(m->g->strip[esub]) == OOR1); for (;;) { /* find first matching branch */ if (slow(m, sp, rest, ssub, esub) == rest) @@ -381,7 +381,10 @@ else assert(OP(m->g->strip[esub]) == O_CH); } - dp = dissect(m, sp, rest, ssub, esub); +#ifndef NDEBUG + dp = +#endif + dissect(m, sp, rest, ssub, esub); assert(dp == rest); sp = rest; break; @@ -393,12 +396,12 @@ assert(nope); break; case OLPAREN: - i = OPND(m->g->strip[ss]); + i = (int) OPND(m->g->strip[ss]); assert(0 < i && i <= m->g->nsub); m->pmatch[i].rm_so = sp - m->offp; break; case ORPAREN: - i = OPND(m->g->strip[ss]); + i = (int) OPND(m->g->strip[ss]); assert(0 < i && i <= m->g->nsub); m->pmatch[i].rm_eo = sp - m->offp; break; @@ -418,13 +421,9 @@ == char *stop, sopno startst, sopno stopst, sopno lev); */ static char * /* == stop (success) or NULL (failure) */ -backref(m, start, stop, startst, stopst, lev) -register struct match *m; -char *start; -char *stop; -sopno startst; -sopno stopst; -sopno lev; /* PLUS nesting level */ +backref(register struct match *m, char *start, char *stop, sopno startst, + sopno stopst, sopno lev) + /* lev: PLUS nesting level */ { register int i; register sopno ss; /* start sop of current subRE */ @@ -524,7 +523,7 @@ s = m->g->strip[ss]; switch (OP(s)) { case OBACK_: /* the vilest depths */ - i = OPND(s); + i = (int) OPND(s); assert(0 < i && i <= m->g->nsub); if (m->pmatch[i].rm_eo == -1) return(NULL); @@ -539,33 +538,29 @@ while (m->g->strip[ss] != SOP(O_BACK, i)) ss++; return(backref(m, sp+len, stop, ss+1, stopst, lev)); - break; case OQUEST_: /* to null or not */ dp = backref(m, sp, stop, ss+1, stopst, lev); if (dp != NULL) return(dp); /* not */ - return(backref(m, sp, stop, ss+OPND(s)+1, stopst, lev)); - break; + return(backref(m, sp, stop, ss + (sopno) OPND(s) + 1, stopst, lev)); case OPLUS_: assert(m->lastpos != NULL); assert(lev+1 <= m->g->nplus); m->lastpos[lev+1] = sp; return(backref(m, sp, stop, ss+1, stopst, lev+1)); - break; case O_PLUS: if (sp == m->lastpos[lev]) /* last pass matched null */ return(backref(m, sp, stop, ss+1, stopst, lev-1)); /* try another pass */ m->lastpos[lev] = sp; - dp = backref(m, sp, stop, ss-OPND(s)+1, stopst, lev); + dp = backref(m, sp, stop, ss - (sopno) OPND(s) + 1, stopst, lev); if (dp == NULL) return(backref(m, sp, stop, ss+1, stopst, lev-1)); else return(dp); - break; case OCH_: /* find the right one, if any */ ssub = ss + 1; - esub = ss + OPND(s) - 1; + esub = ss + (sopno) OPND(s) - 1; assert(OP(m->g->strip[esub]) == OOR1); for (;;) { /* find first matching branch */ dp = backref(m, sp, stop, ssub, esub, lev); @@ -583,9 +578,10 @@ else assert(OP(m->g->strip[esub]) == O_CH); } + /* NOTREACHED */ break; case OLPAREN: /* must undo assignment if rest fails */ - i = OPND(s); + i = (int) OPND(s); assert(0 < i && i <= m->g->nsub); offsave = m->pmatch[i].rm_so; m->pmatch[i].rm_so = sp - m->offp; @@ -594,9 +590,8 @@ return(dp); m->pmatch[i].rm_so = offsave; return(NULL); - break; case ORPAREN: /* must undo assignment if rest fails */ - i = OPND(s); + i = (int) OPND(s); assert(0 < i && i <= m->g->nsub); offsave = m->pmatch[i].rm_eo; m->pmatch[i].rm_eo = sp - m->offp; @@ -605,7 +600,6 @@ return(dp); m->pmatch[i].rm_eo = offsave; return(NULL); - break; default: /* uh oh */ assert(nope); break; @@ -623,12 +617,8 @@ == char *stop, sopno startst, sopno stopst); */ static char * /* where tentative match ended, or NULL */ -fast(m, start, stop, startst, stopst) -register struct match *m; -char *start; -char *stop; -sopno startst; -sopno stopst; +fast(register struct match *m, char *start, char *stop, sopno startst, + sopno stopst) { register states st = m->st; register states fresh = m->fresh; @@ -714,12 +704,8 @@ == char *stop, sopno startst, sopno stopst); */ static char * /* where it ended */ -slow(m, start, stop, startst, stopst) -register struct match *m; -char *start; -char *stop; -sopno startst; -sopno stopst; +slow(register struct match *m, char *start, char *stop, sopno startst, + sopno stopst) { register states st = m->st; register states empty = m->empty; @@ -810,13 +796,13 @@ == #define NNONCHAR (CODEMAX-CHAR_MAX) */ static states -step(g, start, stop, bef, ch, aft) -register struct re_guts *g; -sopno start; /* start state within strip */ -sopno stop; /* state after stop state within strip */ -register states bef; /* states reachable before */ -int ch; /* character or NONCHAR code */ -register states aft; /* states already known reachable after */ +step(register struct re_guts *g, sopno start, sopno stop, register states bef, + int ch, register states aft) + /* start: start state within strip */ + /* stop: state after stop state within strip */ + /* bef: states reachable before */ + /* ch: character or NONCHAR code */ + /* aft: states already known reachable after */ { register cset *cs; register sop s; @@ -871,7 +857,7 @@ break; case O_PLUS: /* both forward and back */ FWD(aft, aft, 1); - i = ISSETBACK(aft, OPND(s)); + i = (int) ISSETBACK(aft, OPND(s)); BACK(aft, aft, OPND(s)); if (!i && ISSETBACK(aft, OPND(s))) { /* oho, must reconsider loop body */ @@ -932,12 +918,7 @@ == #endif */ static void -print(m, caption, st, ch, d) -struct match *m; -char *caption; -states st; -int ch; -FILE *d; +print(struct match *m, char *caption, states st, int ch, FILE *d) { register struct re_guts *g = m->g; register int i; @@ -965,13 +946,8 @@ == #endif */ static void -at(m, title, start, stop, startst, stopst) -struct match *m; -char *title; -char *start; -char *stop; -sopno startst; -sopno stopst; +at(struct match *m, char *title, char *start, char *stop, sopno startst, + sopno stopst) { if (!(m->eflags®_TRACE)) return; @@ -995,8 +971,7 @@ * the non-debug compilation anyway, so it doesn't matter much. */ static char * /* -> representation */ -pchar(ch) -int ch; +pchar(int ch) { static char pbuf[10]; diff -Naur apache_1.3.12/src/regex/main.c-orig apache_1.3.12/src/regex/main.c --- apache_1.3.12/src/regex/main.c-orig Tue Aug 31 21:29:09 1999 +++ apache_1.3.12/src/regex/main.c Wed Feb 9 17:34:31 2000 @@ -29,9 +29,7 @@ /* - main - do the simple case, hand off to regress() for regression */ -int main(argc, argv) -int argc; -char *argv[]; +int main(int argc, char *argv[]) { regex_t re; # define NS 10 @@ -127,8 +125,7 @@ == void regress(FILE *in); */ void -regress(in) -FILE *in; +regress(FILE *in) { char inbuf[1000]; # define MAXF 10 @@ -207,13 +204,8 @@ == void try(char *f0, char *f1, char *f2, char *f3, char *f4, int opts); */ void -try(f0, f1, f2, f3, f4, opts) -char *f0; -char *f1; -char *f2; -char *f3; -char *f4; -int opts; /* may not match f1 */ +try(char *f0, char *f1, char *f2, char *f3, char *f4, int opts) + /* opts: may not match f1 */ { regex_t re; # define NSUBS 10 @@ -318,9 +310,8 @@ == int options(int type, char *s); */ int -options(type, s) -int type; /* 'c' compile, 'e' exec */ -char *s; +options(int type, char *s) + /* type: 'c' compile, 'e' exec */ { register char *p; register int o = (type == 'c') ? copts : eopts; @@ -375,9 +366,7 @@ == int opt(int c, char *s); */ int /* predicate */ -opt(c, s) -int c; -char *s; +opt(int c, char *s) { return(strchr(s, c) != NULL); } @@ -387,8 +376,7 @@ == void fixstr(register char *p); */ void -fixstr(p) -register char *p; +fixstr(register char *p) { if (p == NULL) return; @@ -409,10 +397,7 @@ == char *check(char *str, regmatch_t sub, char *should); */ char * /* NULL or complaint */ -check(str, sub, should) -char *str; -regmatch_t sub; -char *should; +check(char *str, regmatch_t sub, char *should) { register int len; register int shlen; @@ -486,8 +471,7 @@ == static char *eprint(int err); */ static char * -eprint(err) -int err; +eprint(int err) { static char epbuf[100]; size_t len; @@ -502,8 +486,7 @@ == static int efind(char *name); */ static int -efind(name) -char *name; +efind(char *name) { static char efbuf[100]; regex_t re; diff -Naur apache_1.3.12/src/regex/regcomp.c-orig apache_1.3.12/src/regex/regcomp.c --- apache_1.3.12/src/regex/regcomp.c-orig Mon Dec 6 14:17:03 1999 +++ apache_1.3.12/src/regex/regcomp.c Wed Feb 9 17:34:31 2000 @@ -85,10 +85,7 @@ */ ap_private_extern API_EXPORT(int) /* 0 success, otherwise REG_something */ -regcomp(preg, pattern, cflags) -regex_t *preg; -const char *pattern; -int cflags; +regcomp(regex_t *preg, const char *pattern, int cflags) { struct parse pa; register struct re_guts *g; @@ -140,7 +137,7 @@ (NC-1)*sizeof(cat_t)); if (g == NULL) return(REG_ESPACE); - p->ssize = len/(size_t)2*(size_t)3 + (size_t)1; /* ugh */ + p->ssize = (sopno) (len/(size_t)2*(size_t)3 + (size_t)1); /* ugh */ p->strip = (sop *)malloc(p->ssize * sizeof(sop)); p->slen = 0; if (p->strip == NULL) { @@ -212,9 +209,8 @@ == static void p_ere(register struct parse *p, int stop); */ static void -p_ere(p, stop) -register struct parse *p; -int stop; /* character this ERE should end at */ +p_ere(register struct parse *p, int stop) + /* stop: character this ERE should end at */ { register char c; register sopno prevback = 0; @@ -258,8 +254,7 @@ == static void p_ere_exp(register struct parse *p); */ static void -p_ere_exp(p) -register struct parse *p; +p_ere_exp(register struct parse *p) { register char c; register sopno pos; @@ -276,7 +271,7 @@ case '(': REQUIRE(MORE(), REG_EPAREN); p->g->nsub++; - subno = p->g->nsub; + subno = (sopno) p->g->nsub; if (subno < NPAREN) p->pbegin[subno] = HERE(); EMIT(OLPAREN, subno); @@ -407,8 +402,7 @@ == static void p_str(register struct parse *p); */ static void -p_str(p) -register struct parse *p; +p_str(register struct parse *p) { REQUIRE(MORE(), REG_EMPTY); while (MORE()) @@ -428,10 +422,9 @@ * The amount of lookahead needed to avoid this kludge is excessive. */ static void -p_bre(p, end1, end2) -register struct parse *p; -register int end1; /* first terminating character */ -register int end2; /* second terminating character */ +p_bre(register struct parse *p, register int end1, register int end2) + /* end1: first terminating character */ + /* end2: second terminating character */ { register sopno start = HERE(); register int first = 1; /* first subexpression? */ @@ -461,9 +454,8 @@ == static int p_simp_re(register struct parse *p, int starordinary); */ static int /* was the simple RE an unbackslashed $? */ -p_simp_re(p, starordinary) -register struct parse *p; -int starordinary; /* is a leading * an ordinary character? */ +p_simp_re(register struct parse *p, int starordinary) + /* starordinary: is a leading * an ordinary character? */ { register int c; register int count; @@ -496,7 +488,7 @@ break; case BACKSL|'(': p->g->nsub++; - subno = p->g->nsub; + subno = (sopno) p->g->nsub; if (subno < NPAREN) p->pbegin[subno] = HERE(); EMIT(OLPAREN, subno); @@ -579,8 +571,7 @@ == static int p_count(register struct parse *p); */ static int /* the value */ -p_count(p) -register struct parse *p; +p_count(register struct parse *p) { register int count = 0; register int ndigits = 0; @@ -602,8 +593,7 @@ * no set operations are done. */ static void -p_bracket(p) -register struct parse *p; +p_bracket(register struct parse *p) { register cset *cs = allocset(p); register int invert = 0; @@ -676,9 +666,7 @@ == static void p_b_term(register struct parse *p, register cset *cs); */ static void -p_b_term(p, cs) -register struct parse *p; -register cset *cs; +p_b_term(register struct parse *p, register cset *cs) { register char c; register char start, finish; @@ -692,7 +680,6 @@ case '-': SETERROR(REG_ERANGE); return; /* NOTE RETURN */ - break; default: c = '\0'; break; @@ -756,9 +743,7 @@ == static void p_b_cclass(register struct parse *p, register cset *cs); */ static void -p_b_cclass(p, cs) -register struct parse *p; -register cset *cs; +p_b_cclass(register struct parse *p, register cset *cs) { register char *sp = p->next; register struct cclass *cp; @@ -792,9 +777,7 @@ * This implementation is incomplete. xxx */ static void -p_b_eclass(p, cs) -register struct parse *p; -register cset *cs; +p_b_eclass(register struct parse *p, register cset *cs) { register char c; @@ -807,8 +790,7 @@ == static char p_b_symbol(register struct parse *p); */ static char /* value of symbol */ -p_b_symbol(p) -register struct parse *p; +p_b_symbol(register struct parse *p) { register char value; @@ -827,9 +809,8 @@ == static char p_b_coll_elem(register struct parse *p, int endc); */ static char /* value of collating element */ -p_b_coll_elem(p, endc) -register struct parse *p; -int endc; /* name ended by endc,']' */ +p_b_coll_elem(register struct parse *p, int endc) + /* endc: name ended by endc,']' */ { register char *sp = p->next; register struct cname *cp; @@ -841,7 +822,7 @@ SETERROR(REG_EBRACK); return(0); } - len = p->next - sp; + len = (int) (p->next - sp); for (cp = cnames; cp->name != NULL; cp++) if (strncmp(cp->name, sp, len) == 0 && cp->name[len] == '\0') return(cp->code); /* known name */ @@ -856,8 +837,7 @@ == static char othercase(int ch); */ static char /* if no counterpart, return ch */ -othercase(ch) -int ch; +othercase(int ch) { assert(ap_isalpha(ch)); if (ap_isupper(ch)) @@ -875,9 +855,7 @@ * Boy, is this implementation ever a kludge... */ static void -bothcases(p, ch) -register struct parse *p; -int ch; +bothcases(register struct parse *p, int ch) { register char *oldnext = p->next; register char *oldend = p->end; @@ -900,9 +878,7 @@ == static void ordinary(register struct parse *p, register int ch); */ static void -ordinary(p, ch) -register struct parse *p; -register int ch; +ordinary(register struct parse *p, register int ch) { register cat_t *cap = p->g->categories; @@ -922,8 +898,7 @@ * Boy, is this implementation ever a kludge... */ static void -nonnewline(p) -register struct parse *p; +nonnewline(register struct parse *p) { register char *oldnext = p->next; register char *oldend = p->end; @@ -946,11 +921,10 @@ == static void repeat(register struct parse *p, sopno start, int from, int to); */ static void -repeat(p, start, from, to) -register struct parse *p; -sopno start; /* operand from here to end of strip */ -int from; /* repeated from this number */ -int to; /* to this number of times (maybe INFINITY) */ +repeat(register struct parse *p, sopno start, int from, int to) + /* start: operand from here to end of strip */ + /* from: repeated from this number */ + /* to: to this number of times (maybe INFINITY) */ { register sopno finish = HERE(); # define N 2 @@ -1018,9 +992,7 @@ == static int seterr(register struct parse *p, int e); */ static int /* useless but makes type checking happy */ -seterr(p, e) -register struct parse *p; -int e; +seterr(register struct parse *p, int e) { if (p->error == 0) /* keep earliest error condition */ p->error = e; @@ -1034,8 +1006,7 @@ == static cset *allocset(register struct parse *p); */ static cset * -allocset(p) -register struct parse *p; +allocset(register struct parse *p) { register int no = p->g->ncsets++; register size_t nc; @@ -1089,9 +1060,7 @@ == static void freeset(register struct parse *p, register cset *cs); */ static void -freeset(p, cs) -register struct parse *p; -register cset *cs; +freeset(register struct parse *p, register cset *cs) { register int i; register cset *top = &p->g->sets[p->g->ncsets]; @@ -1114,9 +1083,7 @@ * the same value! */ static int /* set number */ -freezeset(p, cs) -register struct parse *p; -register cset *cs; +freezeset(register struct parse *p, register cset *cs) { register uch h = cs->hash; register int i; @@ -1148,9 +1115,7 @@ == static int firstch(register struct parse *p, register cset *cs); */ static int /* character; there is no "none" value */ -firstch(p, cs) -register struct parse *p; -register cset *cs; +firstch(register struct parse *p, register cset *cs) { register int i; register size_t css = (size_t)p->g->csetsize; @@ -1167,9 +1132,7 @@ == static int nch(register struct parse *p, register cset *cs); */ static int -nch(p, cs) -register struct parse *p; -register cset *cs; +nch(register struct parse *p, register cset *cs) { register int i; register size_t css = (size_t)p->g->csetsize; @@ -1187,10 +1150,7 @@ == register char *cp); */ static void -mcadd(p, cs, cp) -register struct parse *p; -register cset *cs; -register char *cp; +mcadd(register struct parse *p, register cset *cs, register char *cp) { register size_t oldend = cs->smultis; @@ -1216,10 +1176,9 @@ * This would have to know the set of possibilities. Implementation * is deferred. */ +/*ARGSUSED*/ static void -mcinvert(p, cs) -register struct parse *p; -register cset *cs; +mcinvert(register struct parse *p, register cset *cs) { assert(cs->multis == NULL); /* xxx */ } @@ -1231,10 +1190,9 @@ * This would have to know the set of possibilities. Implementation * is deferred. */ +/*ARGSUSED*/ static void -mccase(p, cs) -register struct parse *p; -register cset *cs; +mccase(register struct parse *p, register cset *cs) { assert(cs->multis == NULL); /* xxx */ } @@ -1244,9 +1202,7 @@ == static int isinsets(register struct re_guts *g, int c); */ static int /* predicate */ -isinsets(g, c) -register struct re_guts *g; -int c; +isinsets(register struct re_guts *g, int c) { register uch *col; register int i; @@ -1264,10 +1220,7 @@ == static int samesets(register struct re_guts *g, int c1, int c2); */ static int /* predicate */ -samesets(g, c1, c2) -register struct re_guts *g; -int c1; -int c2; +samesets(register struct re_guts *g, int c1, int c2) { register uch *col; register int i; @@ -1286,9 +1239,7 @@ == static void categorize(struct parse *p, register struct re_guts *g); */ static void -categorize(p, g) -struct parse *p; -register struct re_guts *g; +categorize(struct parse *p, register struct re_guts *g) { register cat_t *cats = g->categories; register int c; @@ -1314,10 +1265,9 @@ == static sopno dupl(register struct parse *p, sopno start, sopno finish); */ static sopno /* start of duplicate */ -dupl(p, start, finish) -register struct parse *p; -sopno start; /* from here */ -sopno finish; /* to this less one */ +dupl(register struct parse *p, sopno start, sopno finish) + /* start: from here */ + /* finish: to this less one */ { register sopno ret = HERE(); register sopno len = finish - start; @@ -1342,10 +1292,7 @@ * some changes to the data structures. Maybe later. */ static void -doemit(p, op, opnd) -register struct parse *p; -sop op; -size_t opnd; +doemit(register struct parse *p, sop op, size_t opnd) { /* avoid making error situations worse */ if (p->error != 0) @@ -1360,7 +1307,7 @@ assert(p->slen < p->ssize); /* finally, it's all reduced to the easy case */ - p->strip[p->slen++] = SOP(op, opnd); + p->strip[p->slen++] = SOP(op, (sop) opnd); } /* @@ -1368,11 +1315,7 @@ == static void doinsert(register struct parse *p, sop op, size_t opnd, sopno pos); */ static void -doinsert(p, op, opnd, pos) -register struct parse *p; -sop op; -size_t opnd; -sopno pos; +doinsert(register struct parse *p, sop op, size_t opnd, sopno pos) { register sopno sn; register sop s; @@ -1408,10 +1351,7 @@ == static void dofwd(register struct parse *p, sopno pos, sop value); */ static void -dofwd(p, pos, value) -register struct parse *p; -register sopno pos; -sop value; +dofwd(register struct parse *p, register sopno pos, sop value) { /* avoid making error situations worse */ if (p->error != 0) @@ -1426,9 +1366,7 @@ == static void enlarge(register struct parse *p, sopno size); */ static void -enlarge(p, size) -register struct parse *p; -register sopno size; +enlarge(register struct parse *p, register sopno size) { register sop *sp; @@ -1449,9 +1387,7 @@ == static void stripsnug(register struct parse *p, register struct re_guts *g); */ static void -stripsnug(p, g) -register struct parse *p; -register struct re_guts *g; +stripsnug(register struct parse *p, register struct re_guts *g) { g->nstates = p->slen; g->strip = (sop *)realloc((char *)p->strip, p->slen * sizeof(sop)); @@ -1472,9 +1408,7 @@ * Note that must and mlen got initialized during setup. */ static void -findmust(p, g) -struct parse *p; -register struct re_guts *g; +findmust(struct parse *p, register struct re_guts *g) { register sop *scan; sop *start = NULL; @@ -1553,9 +1487,7 @@ == static sopno pluscount(register struct parse *p, register struct re_guts *g); */ static sopno /* nesting depth */ -pluscount(p, g) -struct parse *p; -register struct re_guts *g; +pluscount(struct parse *p, register struct re_guts *g) { register sop *scan; register sop s; diff -Naur apache_1.3.12/src/regex/regerror.c-orig apache_1.3.12/src/regex/regerror.c --- apache_1.3.12/src/regex/regerror.c-orig Wed Feb 4 10:18:54 1998 +++ apache_1.3.12/src/regex/regerror.c Wed Feb 9 17:34:31 2000 @@ -59,11 +59,7 @@ */ /* ARGSUSED */ API_EXPORT(size_t) -regerror(errcode, preg, errbuf, errbuf_size) -int errcode; -const regex_t *preg; -char *errbuf; -size_t errbuf_size; +regerror(int errcode, const regex_t *preg, char *errbuf, size_t errbuf_size) { register struct rerr *r; register size_t len; @@ -107,9 +103,7 @@ == static char *regatoi(const regex_t *preg, char *localbuf); */ static char * -regatoi(preg, localbuf) -const regex_t *preg; -char *localbuf; +regatoi(const regex_t *preg, char *localbuf) { register struct rerr *r; diff -Naur apache_1.3.12/src/regex/regex2.h-orig apache_1.3.12/src/regex/regex2.h --- apache_1.3.12/src/regex/regex2.h-orig Fri Aug 27 20:07:32 1999 +++ apache_1.3.12/src/regex/regex2.h Wed Feb 9 17:34:31 2000 @@ -31,6 +31,8 @@ */ #define MAGIC1 ((('r'^0200)<<8) | 'e') +#include "ap_types.h" + /* * The internal representation is a *strip*, a sequence of * operators ending with an endmarker. (Some terminology etc. is a @@ -50,8 +52,8 @@ * In state representations, an operator's bit is on to signify a state * immediately *preceding* "execution" of that operator. */ -typedef unsigned long sop; /* strip operator */ -typedef long sopno; +typedef ap_uint32 sop; /* strip operator */ +typedef ap_int32 sopno; #define OPRMASK 0xf8000000 #define OPDMASK 0x07ffffff #define OPSHIFT ((unsigned)27) diff -Naur apache_1.3.12/src/regex/regexec.c-orig apache_1.3.12/src/regex/regexec.c --- apache_1.3.12/src/regex/regexec.c-orig Tue Sep 15 12:47:45 1998 +++ apache_1.3.12/src/regex/regexec.c Wed Feb 9 17:34:31 2000 @@ -21,7 +21,7 @@ #endif /* macros for manipulating states, small version */ -#define states long +#define states ap_int32 #define states1 states /* for later use in regexec() decision */ #define CLEAR(v) ((v) = 0) #define SET0(v, n) ((v) &= ~(1 << (n))) @@ -113,12 +113,8 @@ */ ap_private_extern API_EXPORT(int) /* 0 success, REG_NOMATCH failure */ -regexec(preg, string, nmatch, pmatch, eflags) -const regex_t *preg; -const char *string; -size_t nmatch; -regmatch_t pmatch[]; -int eflags; +regexec(const regex_t *preg, const char *string, size_t nmatch, + regmatch_t pmatch[], int eflags) { register struct re_guts *g = preg->re_g; #ifdef REDEBUG diff -Naur apache_1.3.12/src/regex/regfree.c-orig apache_1.3.12/src/regex/regfree.c --- apache_1.3.12/src/regex/regfree.c-orig Tue Sep 15 12:47:45 1998 +++ apache_1.3.12/src/regex/regfree.c Wed Feb 9 17:34:31 2000 @@ -12,8 +12,7 @@ */ ap_private_extern API_EXPORT(void) -regfree(preg) -regex_t *preg; +regfree(regex_t *preg) { register struct re_guts *g; diff -Naur apache_1.3.12/src/regex/split.c-orig apache_1.3.12/src/regex/split.c --- apache_1.3.12/src/regex/split.c-orig Tue Jun 29 07:16:45 1999 +++ apache_1.3.12/src/regex/split.c Wed Feb 9 17:34:31 2000 @@ -8,11 +8,10 @@ = int split(char *string, char *fields[], int nfields, char *sep