Return-Path: Delivered-To: apmail-httpd-cvs-archive@www.apache.org Received: (qmail 4905 invoked from network); 10 Nov 2005 15:34:26 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 10 Nov 2005 15:34:26 -0000 Received: (qmail 66750 invoked by uid 500); 10 Nov 2005 15:20:56 -0000 Delivered-To: apmail-httpd-cvs-archive@httpd.apache.org Received: (qmail 64373 invoked by uid 500); 10 Nov 2005 15:20:43 -0000 Mailing-List: contact cvs-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list cvs@httpd.apache.org Received: (qmail 63304 invoked by uid 99); 10 Nov 2005 15:20:20 -0000 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Thu, 10 Nov 2005 07:20:16 -0800 Received: (qmail 91874 invoked by uid 65534); 10 Nov 2005 15:19:55 -0000 Message-ID: <20051110151955.91861.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r332306 [14/14] - in /httpd/httpd/trunk: modules/aaa/ modules/arch/netware/ modules/arch/win32/ modules/cache/ modules/dav/fs/ modules/dav/lock/ modules/dav/main/ modules/debug/ modules/echo/ modules/experimental/ modules/filters/ modules/g... Date: Thu, 10 Nov 2005 15:13:26 -0000 To: cvs@httpd.apache.org From: jim@apache.org X-Mailer: svnmailer-1.0.5 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Modified: httpd/httpd/trunk/test/test_limits.c URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/test/test_limits.c?rev=332306&r1=332305&r2=332306&view=diff ============================================================================== --- httpd/httpd/trunk/test/test_limits.c (original) +++ httpd/httpd/trunk/test/test_limits.c Thu Nov 10 07:11:44 2005 @@ -8,17 +8,17 @@ * * FreeBSD 2.2.x, FreeBSD 3.0, IRIX 5.3, IRIX 6.2: * gcc -o test_limits test_limits.c - * + * * Solaris 2.5.1: * gcc -o test_limits test_limits.c -lsocket -lnsl - * + * * * Message-ID: <861zqspvtw.fsf@niobe.ewox.org> * Date: Fri, 7 Aug 1998 19:04:27 +0200 * Sender: Bugtraq List * From: Dag-Erling Coidan =?ISO-8859-1?Q?Sm=F8rgrav?= * Subject: YA Apache DoS attack - * + * * Copyright (c) 1998 Dag-Erling Codan Smrgrav * All rights reserved. * Modified: httpd/httpd/trunk/test/test_parser.c URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/test/test_parser.c?rev=332306&r1=332305&r2=332306&view=diff ============================================================================== --- httpd/httpd/trunk/test/test_parser.c (original) +++ httpd/httpd/trunk/test/test_parser.c Thu Nov 10 07:11:44 2005 @@ -23,7 +23,7 @@ -DSOLARIS2=250 -Wall -DALLOC_DEBUG -DPOOL_DEBUG \ ../main/alloc.o ../main/buff.o ../main/util.o \ ../ap/libap.a -lsocket -lnsl test_parser.c - * + * * Roy Fielding, 1999 */ #include @@ -70,6 +70,6 @@ while ((newstr = ap_get_list_item(p, &field)) != NULL) printf(" <%s> ..\n", newstr); } - + exit(0); } Modified: httpd/httpd/trunk/test/time-sem.c URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/test/time-sem.c?rev=332306&r1=332305&r2=332306&view=diff ============================================================================== --- httpd/httpd/trunk/test/time-sem.c (original) +++ httpd/httpd/trunk/test/time-sem.c Thu Nov 10 07:11:44 2005 @@ -111,7 +111,7 @@ void accept_mutex_on(void) { int ret; - + while ((ret = fcntl(fcntl_fd, F_SETLKW, &lock_it)) < 0 && errno == EINTR) continue; @@ -172,7 +172,7 @@ void accept_mutex_on(void) { int ret; - + while ((ret = flock(flock_fd, LOCK_EX)) < 0 && errno == EINTR) continue; Modified: httpd/httpd/trunk/test/zb.c URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/test/zb.c?rev=332306&r1=332305&r2=332306&view=diff ============================================================================== --- httpd/httpd/trunk/test/zb.c (original) +++ httpd/httpd/trunk/test/zb.c Thu Nov 10 07:11:44 2005 @@ -7,21 +7,21 @@ This program may be used and copied freely providing this copyright notice is not removed. -This software is provided "as is" and any express or implied waranties, +This software is provided "as is" and any express or implied waranties, including but not limited to, the implied warranties of merchantability and -fitness for a particular purpose are disclaimed. In no event shall -Zeus Technology Ltd. be liable for any direct, indirect, incidental, special, -exemplary, or consequential damaged (including, but not limited to, +fitness for a particular purpose are disclaimed. In no event shall +Zeus Technology Ltd. be liable for any direct, indirect, incidental, special, +exemplary, or consequential damaged (including, but not limited to, procurement of substitute good or services; loss of use, data, or profits; or business interruption) however caused and on theory of liability. Whether -in contract, strict liability or tort (including negligence or otherwise) +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. Written by Adam Twiss (adam@zeus.co.uk). March 1996 Thanks to the following people for their input: - Mike Belshe (mbelshe@netscape.com) + Mike Belshe (mbelshe@netscape.com) Michael Campanella (campanella@stevms.enet.dec.com) */ @@ -33,12 +33,12 @@ need to compile with "-lnsl -lsocket" options. If you have any difficulties compiling then let me know. -On SunOS 4.x.x you may need to compile with -DSUNOS4 to add the following +On SunOS 4.x.x you may need to compile with -DSUNOS4 to add the following two lines of code which appear not to exist in my SunOS headers */ #ifdef SUNOS4 -extern char *optarg; -extern int optind, opterr, optopt; +extern char *optarg; +extern int optind, opterr, optopt; #endif /* -------------------------------------------------------------------- */ @@ -46,7 +46,7 @@ /* affects include files on Solaris */ #define BSD_COMP -#include +#include #include #include #include @@ -54,7 +54,7 @@ #include #include #include -#include +#include #include #include #include @@ -62,7 +62,7 @@ /* ------------------- DEFINITIONS -------------------------- */ /* maximum number of requests on a time limited test */ -#define MAX_REQUESTS 50000 +#define MAX_REQUESTS 50000 /* good old state machine */ #define STATE_UNCONNECTED 0 @@ -71,7 +71,7 @@ #define CBUFFSIZE 512 -struct connection +struct connection { int fd; int state; @@ -82,10 +82,10 @@ int cbx; /* offset in cbuffer */ int keepalive; /* non-zero if a keep-alive request */ int gotheader; /* non-zero if we have the entire header in cbuff */ - struct timeval start, connect, done; + struct timeval start, connect, done; }; -struct data +struct data { int read; /* number of bytes read */ int ctime; /* time in ms to connect */ @@ -135,7 +135,7 @@ /* simple little function to perror and exit */ -static void err(char *s) +static void err(char *s) { perror(s); exit(errno); @@ -143,13 +143,13 @@ /* --------------------------------------------------------- */ -/* write out request to a connection - assumes we can write +/* write out request to a connection - assumes we can write (small) request out in one go into our new socket buffer */ void write_request(struct connection *c) { gettimeofday(&c->connect,0); - write(c->fd,request, reqlen); + write(c->fd,request, reqlen); c->state = STATE_READ; FD_SET(c->fd, &readbits); FD_CLR(c->fd, &writebits); @@ -159,7 +159,7 @@ /* make an fd non blocking */ -void nonblock(int fd) +void nonblock(int fd) { int i=1; ioctl(fd, FIONBIO, &i); @@ -187,15 +187,15 @@ void output_results() { int timetaken; - + gettimeofday(&endtime,0); timetaken = timedif(endtime, start); - + printf("\n---\n"); printf("Server: %s\n", server_name); - printf("Document Length: %d\n", doclen); + printf("Document Length: %d\n", doclen); printf("Concurency Level: %d\n", concurrency); - printf("Time taken for tests: %d.%03d seconds\n", + printf("Time taken for tests: %d.%03d seconds\n", timetaken/1000, timetaken%1000); printf("Complete requests: %d\n", done); printf("Failed requests: %d\n", bad); @@ -204,11 +204,11 @@ if(keepalive) printf("Keep-Alive requests: %d\n", doneka); printf("Bytes transferred: %d\n", totalread); printf("HTML transferred: %d\n", totalbread); - + /* avoid divide by zero */ if(timetaken) { printf("Requests per seconds: %.2f\n", 1000*(float)(done)/timetaken); - printf("Transfer rate: %.2f kb/s\n", + printf("Transfer rate: %.2f kb/s\n", (float)(totalread)/timetaken); } @@ -247,7 +247,7 @@ c->read = 0; c->bread = 0; c->keepalive = 0; - c->cbx = 0; + c->cbx = 0; c->gotheader = 0; c->fd = socket(AF_INET, SOCK_STREAM, 0); @@ -268,11 +268,11 @@ if(bad++>10) { printf("\nTest aborted after 10 failures\n\n"); exit(1); - } + } start_connect(c); - } + } } - + /* connected first time */ write_request(c); } @@ -286,16 +286,16 @@ if(c->read == 0 && c->keepalive) { /* server has legitiamately shut down an idle keep alive request */ good--; /* connection never happend */ - } + } else { if(good==1) { /* first time here */ doclen = c->bread; - } else if (c->bread!=doclen) { - bad++; - err_length++; + } else if (c->bread!=doclen) { + bad++; + err_length++; } - + /* save out time */ if(done < requests) { struct data s; @@ -312,7 +312,7 @@ FD_CLR(c->fd, &writebits); /* connect again */ - start_connect(c); + start_connect(c); return; } @@ -323,19 +323,19 @@ void read_connection(struct connection *c) { int r; - + r=read(c->fd,buffer,sizeof(buffer)); if(r==0 || (r<0 && errno!=EAGAIN)) { good++; close_connection(c); return; - } - + } + if(r<0 && errno==EAGAIN) return; c->read += r; totalread += r; - + if(!c->gotheader) { char *s; int l=4; @@ -345,13 +345,13 @@ c->cbx += tocopy; space -= tocopy; c->cbuff[c->cbx] = 0; /* terminate for benefit of strstr */ s = strstr(c->cbuff, "\r\n\r\n"); - /* this next line is so that we talk to NCSA 1.5 which blatantly breaks + /* this next line is so that we talk to NCSA 1.5 which blatantly breaks the http specifaction */ if(!s) { s = strstr(c->cbuff,"\n\n"); l=2; } if(!s) { /* read rest next time */ - if(space) + if(space) return; else { /* header is in invalid or too big - close connection */ @@ -359,10 +359,10 @@ if(bad++>10) { printf("\nTest aborted after 10 failures\n\n"); exit(1); - } + } FD_CLR(c->fd, &writebits); start_connect(c); - } + } } else { /* have full header */ @@ -374,16 +374,16 @@ if(p) { p+=8; while(*p>32) *q++ = *p++; } *q = 0; } - + c->gotheader = 1; *s = 0; /* terminate at end of header */ - if(keepalive && - (strstr(c->cbuff, "Keep-Alive") + if(keepalive && + (strstr(c->cbuff, "Keep-Alive") || strstr(c->cbuff, "keep-alive"))) /* for benefit of MSIIS */ { char *cl; cl = strstr(c->cbuff, "Content-Length:"); - /* for cacky servers like NCSA which break the spec and send a + /* for cacky servers like NCSA which break the spec and send a lower case 'l' */ if(!cl) cl = strstr(c->cbuff, "Content-length:"); if(cl) { @@ -394,7 +394,7 @@ c->bread += c->cbx - (s+l-c->cbuff) + r-tocopy; totalbread += c->bread; } - } + } else { /* outside header, everything we have read is entity body */ c->bread += r; @@ -428,12 +428,12 @@ /* run the tests */ -int test() +int test() { struct timeval timeout, now; fd_set sel_read, sel_except, sel_write; int i; - + { /* get server information */ struct hostent *he; @@ -446,7 +446,7 @@ con = malloc(concurrency*sizeof(struct connection)); memset(con,0,concurrency*sizeof(struct connection)); - + stats = malloc(requests * sizeof(struct data)); FD_ZERO(&readbits); @@ -454,9 +454,9 @@ /* setup request */ sprintf(request,"GET %s HTTP/1.0\r\nUser-Agent: ZeusBench/1.0\r\n" - "%sHost: %s\r\nAccept: */*\r\n\r\n", file, + "%sHost: %s\r\nAccept: */*\r\n\r\n", file, keepalive?"Connection: Keep-Alive\r\n":"", machine ); - + reqlen = strlen(request); /* ok - lets start */ @@ -491,7 +491,7 @@ for(i=0; i0) { switch(c) { case 'd': break; - case 'n': + case 'n': requests = atoi(optarg); if(!requests) { printf("Invalid number of requests\n"); @@ -555,7 +555,7 @@ usage(argv[0]); break; } - } + } test(); return 0; }