cvs commit: apache-1.3/src/main http_protocol.c
fielding99/07/19 03:16:04 Modified:src CHANGES src/main http_protocol.c Log: Fix handling of case when a client has sent "Expect: 100-continue" and we are going to respond with an error, but get stuck waiting to discard the body in the pointless hope of preserving the connection. This remains less than satisfactory, since what we really should be doing is sending the response immediately and discarding the request body as some form of post-response cleanup. Something to consider. PR: 4499, 3806 Submitted by: Roy Fielding, Joe Orton <[EMAIL PROTECTED]> Revision ChangesPath 1.1397+5 -0 apache-1.3/src/CHANGES Index: CHANGES === RCS file: /home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.1396 retrieving revision 1.1397 diff -u -r1.1396 -r1.1397 --- CHANGES 1999/07/10 18:27:26 1.1396 +++ CHANGES 1999/07/19 10:15:53 1.1397 @@ -1,5 +1,10 @@ Changes with Apache 1.3.7 + *) Fix handling of case when a client has sent "Expect: 100-continue" + and we are going to respond with an error, but get stuck waiting to + discard the body in the pointless hope of preserving the connection. + [Roy Fielding, Joe Orton <[EMAIL PROTECTED]>] PR#4499, PR#3806 + *) Fix 'configure' to work correctly with SysV-based versions of 'tr' (consistent with Configure's use as well). [Jim Jagielski] 1.272 +9 -5 apache-1.3/src/main/http_protocol.c Index: http_protocol.c === RCS file: /home/cvs/apache-1.3/src/main/http_protocol.c,v retrieving revision 1.271 retrieving revision 1.272 diff -u -r1.271 -r1.272 --- http_protocol.c 1999/07/03 07:59:49 1.271 +++ http_protocol.c 1999/07/19 10:15:58 1.272 @@ -1881,14 +1881,18 @@ if ((rv = ap_setup_client_block(r, REQUEST_CHUNKED_PASS))) return rv; -/* If we are discarding the request body, then we must already know - * the final status code, therefore disable the sending of 100 continue. +/* In order to avoid sending 100 Continue when we already know the + * final response status, and yet not kill the connection if there is + * no request body to be read, we need to duplicate the test from + * ap_should_client_block() here negated rather than call it directly. */ -r->expecting_100 = 0; - -if (ap_should_client_block(r)) { +if ((r->read_length == 0) && (r->read_chunked || (r->remaining > 0))) { char dumpbuf[HUGE_STRING_LEN]; +if (r->expecting_100) { +r->connection->keepalive = -1; +return OK; +} ap_hard_timeout("reading request body", r); while ((rv = ap_get_client_block(r, dumpbuf, HUGE_STRING_LEN)) > 0) continue;
cvs commit: apache-1.3/src/main util.c util_script.c
bjh 99/07/19 02:48:28 Modified:src/include httpd.h src/main util.c util_script.c Log: OS/2: Fix spawning of CGI scripts to use appropriate type of command line escapes for OS/2's cmd.exe. Revision ChangesPath 1.285 +1 -0 apache-1.3/src/include/httpd.h Index: httpd.h === RCS file: /home/cvs/apache-1.3/src/include/httpd.h,v retrieving revision 1.284 retrieving revision 1.285 diff -u -r1.284 -r1.285 --- httpd.h 1999/06/30 08:12:48 1.284 +++ httpd.h 1999/07/19 09:48:24 1.285 @@ -992,6 +992,7 @@ API_EXPORT(char *) ap_uuencode(pool *p, char *string); #ifdef OS2 void os2pathname(char *path); +char *ap_double_quotes(pool *p, char *str); #endif API_EXPORT(int)ap_regexec(const regex_t *preg, const char *string, 1.166 +26 -0 apache-1.3/src/main/util.c Index: util.c === RCS file: /home/cvs/apache-1.3/src/main/util.c,v retrieving revision 1.165 retrieving revision 1.166 diff -u -r1.165 -r1.166 --- util.c1999/06/17 22:58:16 1.165 +++ util.c1999/07/19 09:48:26 1.166 @@ -2140,6 +2140,32 @@ strcpy(path, newpath); }; + +/* quotes in the string are doubled up. + * Used to escape quotes in args passed to OS/2's cmd.exe + */ +char *ap_double_quotes(pool *p, char *str) +{ +int num_quotes = 0; +int len = 0; +char *quote_doubled_str, *dest; + +while (str[len]) { +num_quotes += str[len++] == '\"'; +} + +quote_doubled_str = ap_palloc(p, len + num_quotes + 1); +dest = quote_doubled_str; + +while (*str) { +if (*str == '\"') +*(dest++) = '\"'; +*(dest++) = *(str++); +} + +*dest = 0; +return quote_doubled_str; +} #endif 1.143 +112 -35 apache-1.3/src/main/util_script.c Index: util_script.c === RCS file: /home/cvs/apache-1.3/src/main/util_script.c,v retrieving revision 1.142 retrieving revision 1.143 diff -u -r1.142 -r1.143 --- util_script.c 1999/06/28 22:38:26 1.142 +++ util_script.c 1999/07/19 09:48:27 1.143 @@ -67,6 +67,11 @@ #include "util_script.h" #include "util_date.h" /* For parseHTTPdate() */ +#ifdef OS2 +#define INCL_DOS +#include +#endif + /* * Various utility functions which are common to a whole lot of * script-type extensions mechanisms, and might as well be gathered @@ -750,54 +755,126 @@ #ifdef OS2 { /* Additions by Alec Kloss, to allow exec'ing of scripts under OS/2 */ - int is_script; + int is_script = 0; char interpreter[2048]; /* hope it's enough for the interpreter path */ + char error_object[260]; FILE *program; - +char *cmdline = r->filename, *cmdline_pos; +int cmdlen; + char *args = "", *args_end; + ULONG rc; +RESULTCODES rescodes; +int env_len, e; +char *env_block, *env_block_pos; + + if (r->args && r->args[0] && !strchr(r->args, '=')) + args = r->args; + program = fopen(r->filename, "rt"); + if (!program) { ap_log_rerror(APLOG_MARK, APLOG_ERR, r, "fopen(%s) failed", r->filename); return (pid); } + fgets(interpreter, sizeof(interpreter), program); fclose(program); + if (!strncmp(interpreter, "#!", 2)) { is_script = 1; - interpreter[strlen(interpreter) - 1] = '\0'; - } - else { - is_script = 0; - } - - if ((!r->args) || (!r->args[0]) || strchr(r->args, '=')) { - /* More additions by Alec Kloss for OS/2 */ - if (is_script) { - /* here's the stuff to run the interpreter */ - pid = spawnle(P_NOWAIT, interpreter + 2, interpreter + 2, r->filename, NULL, env); - } - else if (strstr(strupr(r->filename), ".CMD") > 0) { - /* Special case to allow use of REXX commands as scripts. */ - os2pathname(r->filename); - pid = spawnle(P_NOWAIT, SHELL_PATH, SHELL_PATH, "/C", r->filename, NULL, env); - } - else { - pid = spawnle(P_NOWAIT, r->filename, argv0, NULL, env); - } - } - else { - if (strstr(strupr(r->filename), ".CMD") > 0) { - /* Special case to allow use of REXX commands as scripts. */ - os2pathname(r->filename); - pid = spawnve(P_NOWAIT, SHELL_PATH, create_argv_cmd(r->pool, argv0, r->args, - r->filename), env); -
cvs commit: apache-2.0/mpm/src/modules/mpm/spmt_os2 spmt_os2.c
bjh 99/07/19 00:32:23 Modified:mpm/src/modules/mpm/spmt_os2 spmt_os2.c Log: Releasing a semaphore you don't own isn't a fatal error. Also update with latest hook. Revision ChangesPath 1.5 +2 -2 apache-2.0/mpm/src/modules/mpm/spmt_os2/spmt_os2.c Index: spmt_os2.c === RCS file: /home/cvs/apache-2.0/mpm/src/modules/mpm/spmt_os2/spmt_os2.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- spmt_os2.c1999/07/16 05:30:35 1.4 +++ spmt_os2.c1999/07/19 07:32:20 1.5 @@ -72,6 +72,7 @@ #include "iol_socket.h" #define INCL_DOS +#define INCL_DOSERRORS #include #include @@ -1759,7 +1760,7 @@ { ULONG rc; rc = DosReleaseMutexSem(mtx->mutex_handle); -ap_assert(rc == 0); +ap_assert(rc == 0 || rc == ERROR_NOT_OWNER); } API_EXPORT(void) ap_thread_mutex_destroy(ap_thread_mutex *mtx) @@ -1806,6 +1807,5 @@ NULL,/* check access */ NULL,/* type_checker */ NULL,/* pre-run fixups */ -NULL,/* logger */ NULL /* register hooks */ };
cvs commit: apache-1.3/src/support ab.c
martin 99/07/19 00:20:08 Modified:src/support ab.c Log: Avoid core dumps when no responses were received Revision ChangesPath 1.26 +32 -28apache-1.3/src/support/ab.c Index: ab.c === RCS file: /export/home/cvs/apache-1.3/src/support/ab.c,v retrieving revision 1.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- ab.c 1999/05/04 10:24:17 1.25 +++ ab.c 1999/07/19 07:19:43 1.26 @@ -97,7 +97,7 @@ * only an issue for loopback usage */ -#define VERSION "1.3" +#define VERSION "1.3a" /* */ @@ -413,13 +413,15 @@ totalcon += s.ctime; total += s.time; } - printf("\nConnnection Times (ms)\n"); - printf(" min avg max\n"); - printf("Connect:%5d %5d %5d\n", mincon, totalcon / requests, maxcon); - printf("Processing: %5d %5d %5d\n", -mintot - mincon, (total / requests) - (totalcon / requests), -maxtot - maxcon); - printf("Total: %5d %5d %5d\n", mintot, total / requests, maxtot); + if (requests > 0) { /* avoid division by zero (if 0 requests) */ + printf("\nConnnection Times (ms)\n"); + printf(" min avg max\n"); + printf("Connect:%5d %5d %5d\n", mincon, totalcon / requests, maxcon); + printf("Processing: %5d %5d %5d\n", +mintot - mincon, (total / requests) - (totalcon / requests), +maxtot - maxcon); + printf("Total: %5d %5d %5d\n", mintot, total / requests, maxtot); + } } } @@ -521,26 +523,28 @@ total += s.time; } - printf("Connnection Times (ms)\n", -trstring, tdstring); - printf(" min avg max\n", -trstring, tdstring, tdstring, tdstring, tdstring); - printf("Connect:" -"%5d" -"%5d" -"%5d\n", -trstring, tdstring, tdstring, mincon, tdstring, totalcon / requests, tdstring, maxcon); - printf("Processing:" -"%5d" -"%5d" -"%5d\n", -trstring, tdstring, tdstring, mintot - mincon, tdstring, -(total / requests) - (totalcon / requests), tdstring, maxtot - maxcon); - printf("Total:" -"%5d" -"%5d" -"%5d\n", -trstring, tdstring, tdstring, mintot, tdstring, total / requests, tdstring, maxtot); + if (requests > 0) { /* avoid division by zero (if 0 requests) */ + printf("Connnection Times (ms)\n", +trstring, tdstring); + printf(" min avg max\n", +trstring, tdstring, tdstring, tdstring, tdstring); + printf("Connect:" +"%5d" +"%5d" +"%5d\n", +trstring, tdstring, tdstring, mincon, tdstring, totalcon / requests, tdstring, maxcon); + printf("Processing:" +"%5d" +"%5d" +"%5d\n", +trstring, tdstring, tdstring, mintot - mincon, tdstring, +(total / requests) - (totalcon / requests), tdstring, maxtot - maxcon); + printf("Total:" +"%5d" +"%5d" +"%5d\n", +trstring, tdstring, tdstring, mintot, tdstring, total / requests, tdstring, maxtot); + } printf("\n"); } }
cvs commit: apache-2.0/mpm/src/ap ap_hooks.c
martin 99/07/18 23:50:11 Modified:mpm/src/ap ap_hooks.c Log: Use C comments instead of C++ comments Revision ChangesPath 1.3 +3 -3 apache-2.0/mpm/src/ap/ap_hooks.c Index: ap_hooks.c === RCS file: /home/cvs/apache-2.0/mpm/src/ap/ap_hooks.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ap_hooks.c1999/07/11 16:54:00 1.2 +++ ap_hooks.c1999/07/19 06:50:10 1.3 @@ -94,7 +94,7 @@ for(n=0 ; ; ++n) { if(n == nItems) - assert(0); // we have a loop... + assert(0); /* // we have a loop... */ if(!pData[n].pNext && !pData[n].nPredecessors) break; } @@ -103,7 +103,7 @@ else pHead=&pData[n]; pTail=&pData[n]; - pTail->pNext=pTail; // fudge it so it looks linked + pTail->pNext=pTail; /* // fudge it so it looks linked */ for(i=0 ; i < nItems ; ++i) for(k=0 ; pData[i].ppPredecessors[k] ; ++k) if(pData[i].ppPredecessors[k] == &pData[n]) @@ -112,7 +112,7 @@ break; } } -pTail->pNext=NULL; // unfudge the tail +pTail->pNext=NULL; /* // unfudge the tail */ return pHead; }
cvs commit: apache-2.0/mpm/src/modules/mpm/mpmt_pthread mpm_default.h
manoj 99/07/18 22:17:50 Modified:mpm/src/include httpd.h mpm/src/modules/mpm/mpmt_pthread mpm_default.h Log: Another MPM-specific define to move into the pthread MPM. Revision ChangesPath 1.8 +0 -4 apache-2.0/mpm/src/include/httpd.h Index: httpd.h === RCS file: /home/cvs/apache-2.0/mpm/src/include/httpd.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -u -r1.7 -r1.8 --- httpd.h 1999/07/16 05:30:25 1.7 +++ httpd.h 1999/07/19 05:17:49 1.8 @@ -322,10 +322,6 @@ #define DEFAULT_MAX_REQUESTS_PER_CHILD 1 #endif -#ifndef DEFAULT_THREADS_PER_CHILD -#define DEFAULT_THREADS_PER_CHILD 50 -#endif - #ifndef DEFAULT_EXCESS_REQUESTS_PER_CHILD #define DEFAULT_EXCESS_REQUESTS_PER_CHILD 0 #endif 1.2 +4 -0 apache-2.0/mpm/src/modules/mpm/mpmt_pthread/mpm_default.h Index: mpm_default.h === RCS file: /home/cvs/apache-2.0/mpm/src/modules/mpm/mpmt_pthread/mpm_default.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -u -r1.1 -r1.2 --- mpm_default.h 1999/07/16 05:30:29 1.1 +++ mpm_default.h 1999/07/19 05:17:49 1.2 @@ -105,4 +105,8 @@ #define HARD_THREAD_LIMIT 64 #endif +#ifndef DEFAULT_THREADS_PER_CHILD +#define DEFAULT_THREADS_PER_CHILD 50 +#endif + #endif /* AP_MPM_DEFAULT_H */
cvs commit: apache-apr/pthreads/src/main acceptlock.c http_main.c
manoj 99/07/18 20:51:56 Modified:pthreads/src/include scoreboard.h pthreads/src/main acceptlock.c http_main.c Log: pthread.h is a system include; use <> instead of "" in the #include to let "make depend" understand it correctly. Revision ChangesPath 1.9 +1 -1 apache-apr/pthreads/src/include/scoreboard.h Index: scoreboard.h === RCS file: /home/cvs/apache-apr/pthreads/src/include/scoreboard.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -u -r1.8 -r1.9 --- scoreboard.h 1999/06/10 06:25:56 1.8 +++ scoreboard.h 1999/07/19 03:51:54 1.9 @@ -57,7 +57,7 @@ #ifndef APACHE_SCOREBOARD_H #define APACHE_SCOREBOARD_H -#include "pthread.h" +#include #ifdef __cplusplus extern "C" { #endif 1.13 +1 -1 apache-apr/pthreads/src/main/acceptlock.c Index: acceptlock.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/acceptlock.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -u -r1.12 -r1.13 --- acceptlock.c 1999/07/19 00:59:32 1.12 +++ acceptlock.c 1999/07/19 03:51:55 1.13 @@ -77,7 +77,7 @@ #include #endif -#include "pthread.h" +#include /* Number of cross-process locks we're managing */ static int lock_count; 1.95 +1 -1 apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.94 retrieving revision 1.95 diff -u -d -u -r1.94 -r1.95 --- http_main.c 1999/07/19 02:02:02 1.94 +++ http_main.c 1999/07/19 03:51:55 1.95 @@ -98,7 +98,7 @@ #include #include -#include "pthread.h" +#include /*#include initialization if any #include threadabstractionlayer; #include networkiolayer
cvs commit: apache-apr/pthreads/src/main http_main.c
manoj 99/07/18 19:02:02 Modified:pthreads/src/main http_main.c Log: We want to deal with SIGTERM properly until we've set up the sigwait thread, so put back the standard signal handler. This will also be useful once support for unthreaded mode is put back in. Revision ChangesPath 1.94 +0 -2 apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.93 retrieving revision 1.94 diff -u -d -u -r1.93 -r1.94 --- http_main.c 1999/07/16 19:45:48 1.93 +++ http_main.c 1999/07/19 02:02:02 1.94 @@ -1967,9 +1967,7 @@ RAISE_SIGSTOP(MAKE_CHILD); MONCONTROL(1); - /* XXX - For an unthreaded server, a signal handler will be necessary signal(SIGTERM, just_die); - */ child_main(slot); return 0;
cvs commit: apache-apr/pthreads/src/main acceptlock.c http_accept.c http_config.c http_protocol.c
manoj 99/07/18 17:59:37 Modified:pthreads/src/main acceptlock.c http_accept.c http_config.c http_protocol.c Log: Some cleanup of signal handling. There were some stray bits of code that weren't cleaned up in the switchover to the pipe of death. Revision ChangesPath 1.12 +0 -2 apache-apr/pthreads/src/main/acceptlock.c Index: acceptlock.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/acceptlock.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -u -r1.11 -r1.12 --- acceptlock.c 1999/06/23 19:13:00 1.11 +++ acceptlock.c 1999/07/19 00:59:32 1.12 @@ -308,9 +308,7 @@ } #ifdef NEED_TO_BLOCK_SIGNALS_AROUND_PTHREAD_CALLS sigfillset(&accept_block_mask); -sigdelset(&accept_block_mask, SIGHUP); sigdelset(&accept_block_mask, SIGTERM); -sigdelset(&accept_block_mask, SIGWINCH); #endif ap_register_cleanup(p, NULL, accept_mutex_cleanup, ap_null_cleanup); } 1.21 +1 -1 apache-apr/pthreads/src/main/http_accept.c Index: http_accept.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_accept.c,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -u -r1.20 -r1.21 --- http_accept.c 1999/06/30 19:01:06 1.20 +++ http_accept.c 1999/07/19 00:59:33 1.21 @@ -66,7 +66,7 @@ #include #include -/* Indicates that all acceptor threads are dead after SIGWINCH and the worker +/* Indicates that all acceptor threads are dead and the worker * threads can now exit */ static int workers_may_exit = 0; static int requests_this_child; 1.14 +0 -7 apache-apr/pthreads/src/main/http_config.c Index: http_config.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_config.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -u -r1.13 -r1.14 --- http_config.c 1999/06/10 06:26:07 1.13 +++ http_config.c 1999/07/19 00:59:33 1.14 @@ -1524,13 +1524,6 @@ { module *m; -#ifdef SIGHUP -signal(SIGHUP, SIG_IGN); -#endif -#ifdef SIGWINCH -signal(SIGWINCH, SIG_IGN); -#endif - for (m = top_module; m; m = m->next) if (m->child_exit) (*m->child_exit) (s, p); 1.19 +0 -11 apache-apr/pthreads/src/main/http_protocol.c Index: http_protocol.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_protocol.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -u -r1.18 -r1.19 --- http_protocol.c 1999/06/10 06:26:09 1.18 +++ http_protocol.c 1999/07/19 00:59:33 1.19 @@ -810,17 +810,6 @@ } /* we've probably got something to do, ignore graceful restart requests */ -/* XXX - sigwait doesn't work if the signal has been SIG_IGNed (under - * linux 2.0 w/ glibc 2.0, anyway), and this step isn't necessary when - * we're running a sigwait thread anyway. If/when unthreaded mode is - * put back in, we should make sure to ignore this signal iff a sigwait - * thread isn't used. - mvsk - -#ifdef SIGWINCH -signal(SIGWINCH, SIG_IGN); -#endif -*/ - ap_bsetflag(conn->client, B_SAFEREAD, 0); r->request_time = time(NULL);