Return-Path: Delivered-To: apmail-httpd-test-cvs-archive@www.apache.org Received: (qmail 54402 invoked from network); 6 Sep 2003 04:27:45 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 6 Sep 2003 04:27:45 -0000 Received: (qmail 55539 invoked by uid 500); 6 Sep 2003 04:27:24 -0000 Delivered-To: apmail-httpd-test-cvs-archive@httpd.apache.org Received: (qmail 55468 invoked by uid 500); 6 Sep 2003 04:27:23 -0000 Mailing-List: contact test-cvs-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: test-dev@httpd.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list test-cvs@httpd.apache.org Received: (qmail 55447 invoked from network); 6 Sep 2003 04:27:23 -0000 Received: from unknown (HELO minotaur.apache.org) (209.237.227.194) by daedalus.apache.org with SMTP; 6 Sep 2003 04:27:23 -0000 Received: (qmail 54329 invoked by uid 1327); 6 Sep 2003 04:27:38 -0000 Date: 6 Sep 2003 04:27:38 -0000 Message-ID: <20030906042738.54328.qmail@minotaur.apache.org> From: jerenkrantz@apache.org To: httpd-test-cvs@apache.org Subject: cvs commit: httpd-test/flood CHANGES flood_net.c flood_net.h flood_net_ssl.c flood_net_ssl.h flood_socket_generic.c flood_socket_keepalive.c X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N jerenkrantz 2003/09/05 21:27:38 Modified: flood CHANGES flood_net.c flood_net.h flood_net_ssl.c flood_net_ssl.h flood_socket_generic.c flood_socket_keepalive.c Log: Fix two minor bugs: * Change open_socket prototype to return errors. * Fix HEAD responses with Content-Length specified being handled incorrectly. Revision Changes Path 1.49 +5 -0 httpd-test/flood/CHANGES Index: CHANGES =================================================================== RCS file: /home/cvs/httpd-test/flood/CHANGES,v retrieving revision 1.48 retrieving revision 1.49 diff -u -u -r1.48 -r1.49 --- CHANGES 1 Jul 2003 20:16:56 -0000 1.48 +++ CHANGES 6 Sep 2003 04:27:37 -0000 1.49 @@ -1,5 +1,10 @@ Changes since 1.0: +* Change open_socket prototype to return errors. [Justin Erenkrantz] + +* Fix HEAD responses with Content-Length specified being handled incorrectly. + [Justin Erenkrantz] + * Flood manual (DocBook based). [Jacek Prucia] * Added element. When present, it's contents are copied in front 1.12 +15 -2 httpd-test/flood/flood_net.c Index: flood_net.c =================================================================== RCS file: /home/cvs/httpd-test/flood/flood_net.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -u -r1.11 -r1.12 --- flood_net.c 3 Feb 2003 17:10:56 -0000 1.11 +++ flood_net.c 6 Sep 2003 04:27:37 -0000 1.12 @@ -59,7 +59,8 @@ #include "flood_net.h" /* Open the TCP connection to the server */ -flood_socket_t* open_socket(apr_pool_t *pool, request_t *r) +flood_socket_t* open_socket(apr_pool_t *pool, request_t *r, + apr_status_t *status) { apr_status_t rv = 0; apr_sockaddr_t *destsa; @@ -70,11 +71,17 @@ if ((rv = apr_sockaddr_info_get(&destsa, r->parsed_uri->hostname, APR_INET, r->parsed_uri->port, 0, pool)) != APR_SUCCESS) { + if (status) { + *status = rv; + } return NULL; } if ((rv = apr_socket_create(&fs->socket, APR_INET, SOCK_STREAM, pool)) != APR_SUCCESS) { + if (status) { + *status = rv; + } return NULL; } @@ -82,6 +89,9 @@ if (APR_STATUS_IS_EINPROGRESS(rv)) { /* FIXME: Handle better */ close_socket(fs); + if (status) { + *status = rv; + } return NULL; } else if (APR_STATUS_IS_EAGAIN(rv)) @@ -92,12 +102,15 @@ * XXX: Then APR'IZE THIS ALREADY */ apr_sleep(4 * 60 * APR_USEC_PER_SEC); - return open_socket(pool, r); + return open_socket(pool, r, status); } else { /* FIXME: Handle */ close_socket(fs); + if (status) { + *status = rv; + } return NULL; } } 1.9 +2 -1 httpd-test/flood/flood_net.h Index: flood_net.h =================================================================== RCS file: /home/cvs/httpd-test/flood/flood_net.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -u -r1.8 -r1.9 --- flood_net.h 3 Feb 2003 17:10:56 -0000 1.8 +++ flood_net.h 6 Sep 2003 04:27:37 -0000 1.9 @@ -68,7 +68,8 @@ apr_pollfd_t read_pollset; } flood_socket_t; -flood_socket_t* open_socket(apr_pool_t *pool, request_t *r); +flood_socket_t* open_socket(apr_pool_t *pool, request_t *r, + apr_status_t *status); void close_socket(flood_socket_t *s); apr_status_t write_socket(flood_socket_t *s, request_t *r); apr_status_t read_socket(flood_socket_t *s, char *buf, int *buflen); 1.22 +5 -3 httpd-test/flood/flood_net_ssl.c Index: flood_net_ssl.c =================================================================== RCS file: /home/cvs/httpd-test/flood/flood_net_ssl.c,v retrieving revision 1.21 retrieving revision 1.22 diff -u -u -r1.21 -r1.22 --- flood_net_ssl.c 3 Feb 2003 17:10:56 -0000 1.21 +++ flood_net_ssl.c 6 Sep 2003 04:27:37 -0000 1.22 @@ -212,7 +212,8 @@ void ssl_read_socket_handshake(ssl_socket_t *s); -ssl_socket_t* ssl_open_socket(apr_pool_t *pool, request_t *r) +ssl_socket_t* ssl_open_socket(apr_pool_t *pool, request_t *r, + apr_status_t *status) { apr_os_sock_t ossock; int e, sslError; @@ -220,7 +221,7 @@ ssl_socket_t *ssl_socket = apr_pcalloc(pool, sizeof(ssl_socket_t)); /* Open our TCP-based connection */ - ssl_socket->socket = open_socket(pool, r); + ssl_socket->socket = open_socket(pool, r, status); if (!ssl_socket->socket) return NULL; @@ -362,7 +363,8 @@ return APR_ENOTIMPL; } -ssl_socket_t* ssl_open_socket(apr_pool_t *pool, request_t *r) +ssl_socket_t* ssl_open_socket(apr_pool_t *pool, request_t *r, + apr_status_t *status) { return NULL; } 1.5 +2 -1 httpd-test/flood/flood_net_ssl.h Index: flood_net_ssl.h =================================================================== RCS file: /home/cvs/httpd-test/flood/flood_net_ssl.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -u -r1.4 -r1.5 --- flood_net_ssl.h 3 Feb 2003 17:10:56 -0000 1.4 +++ flood_net_ssl.h 6 Sep 2003 04:27:37 -0000 1.5 @@ -63,7 +63,8 @@ typedef struct ssl_socket_t ssl_socket_t; apr_status_t ssl_init_socket(apr_pool_t *pool); -ssl_socket_t* ssl_open_socket(apr_pool_t *pool, request_t *r); +ssl_socket_t* ssl_open_socket(apr_pool_t *pool, request_t *r, + apr_status_t *status); void ssl_close_socket(ssl_socket_t *s); apr_status_t ssl_write_socket(ssl_socket_t *s, request_t *r); apr_status_t ssl_read_socket(ssl_socket_t *s, char *buf, int *buflen); 1.11 +5 -3 httpd-test/flood/flood_socket_generic.c Index: flood_socket_generic.c =================================================================== RCS file: /home/cvs/httpd-test/flood/flood_socket_generic.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -u -r1.10 -r1.11 --- flood_socket_generic.c 12 Feb 2003 22:50:59 -0000 1.10 +++ flood_socket_generic.c 6 Sep 2003 04:27:37 -0000 1.11 @@ -90,7 +90,9 @@ */ apr_status_t generic_begin_conn(socket_t *sock, request_t *req, apr_pool_t *pool) { + apr_status_t rv; generic_socket_t *gsock = (generic_socket_t *)sock; + if (strcasecmp(req->parsed_uri->scheme, "https") == 0) { /* If we don't have SSL, error out. */ #if FLOOD_HAS_OPENSSL @@ -106,12 +108,12 @@ /* The return types are not identical, so it can't be a ternary * operation. */ if (gsock->ssl) - gsock->s = ssl_open_socket(pool, req); + gsock->s = ssl_open_socket(pool, req, &rv); else - gsock->s = open_socket(pool, req); + gsock->s = open_socket(pool, req, &rv); if (gsock->s == NULL) - return APR_EGENERAL; + return rv; req->keepalive = 0; /* FIXME: Maybe move this into flood_socket_t */ return APR_SUCCESS; 1.18 +14 -4 httpd-test/flood/flood_socket_keepalive.c Index: flood_socket_keepalive.c =================================================================== RCS file: /home/cvs/httpd-test/flood/flood_socket_keepalive.c,v retrieving revision 1.17 retrieving revision 1.18 diff -u -u -r1.17 -r1.18 --- flood_socket_keepalive.c 3 Feb 2003 17:10:56 -0000 1.17 +++ flood_socket_keepalive.c 6 Sep 2003 04:27:37 -0000 1.18 @@ -82,6 +82,7 @@ int reopen_socket; /* A boolean */ int wantresponse; /* A boolean */ int ssl; /* A boolean */ + method_e method; /* The method of the request. */ } keepalive_socket_t; /** @@ -119,6 +120,7 @@ } } if (ksock->reopen_socket || ksock->s == NULL) { + apr_status_t rv; if (strcasecmp(req->parsed_uri->scheme, "https") == 0) { /* If we don't have SSL, error out. */ #if FLOOD_HAS_OPENSSL @@ -134,12 +136,12 @@ /* The return types are not identical, so it can't be a ternary * operation. */ if (ksock->ssl) - ksock->s = ssl_open_socket(pool, req); + ksock->s = ssl_open_socket(pool, req, &rv); else - ksock->s = open_socket(pool, req); + ksock->s = open_socket(pool, req, &rv); if (ksock->s == NULL) - return APR_EGENERAL; + return rv; ksock->reopen_socket = 0; /* we just opened it */ } @@ -154,6 +156,7 @@ { keepalive_socket_t *ksock = (keepalive_socket_t *)sock; ksock->wantresponse = req->wantresponse; + ksock->method = req->method; return ksock->ssl ? ssl_write_socket(ksock->s, req) : write_socket(ksock->s, req); } @@ -422,7 +425,14 @@ else { new_resp->keepalive = 1; } - + + /* If we have a HEAD request, we shouldn't be receiving a body. */ + if (ksock->method == HEAD) { + *resp = new_resp; + + return APR_SUCCESS; + } + header = apr_table_get(new_resp->headers, "Transfer-Encoding"); if (header && !strcasecmp(header, "Chunked")) {