cvs commit: apache-1.3/src/main http_protocol.c
fielding99/07/30 17:37:27 Modified:src CHANGES src/main http_protocol.c Log: Fix SIGSEGV on some systems because the Vary fixup included a call to table_do with a variable argument list that was not NULL terminated. Other optimizations will follow. Revision ChangesPath 1.1405+13 -1 apache-1.3/src/CHANGES Index: CHANGES === RCS file: /home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.1404 retrieving revision 1.1405 diff -u -r1.1404 -r1.1405 --- CHANGES 1999/07/29 22:58:09 1.1404 +++ CHANGES 1999/07/31 00:37:22 1.1405 @@ -1,6 +1,18 @@ Changes with Apache 1.3.8 -Changes with Apache 1.3.7 + *) Change for EBCDIC platforms (TPF and BS2000) to correctly deal + with ASCII/EBCDIC conversions in ident query. + [David McCreedy [EMAIL PROTECTED]] + + *) Get rid of redefinition warning on MAC_OS_X_SERVER platform. + Change Power Macintosh to Power* so if uname prints Power Book + we're still happy on Rhapsody platforms. [Wilfredo Sanchez] + + *) Fix SIGSEGV on some systems because the Vary fix below included + a call to table_do with a variable argument list that was not + NULL terminated. [Roy Fielding] + +Changes with Apache 1.3.7 [not released] *) The Vary response header field is now sanitised right before the header is sent back to the client. Multiple Vary fields 1.274 +1 -1 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.273 retrieving revision 1.274 diff -u -r1.273 -r1.274 --- http_protocol.c 1999/07/29 22:22:04 1.273 +++ http_protocol.c 1999/07/31 00:37:25 1.274 @@ -1491,7 +1491,7 @@ return; } ap_table_do((int (*)(void *, const char *, const char *))merge_vary_fields, - (void *) r, r-headers_out, Vary); + (void *) r, r-headers_out, Vary, NULL); vary = ap_table_get(r-notes, Vary-list); /* XXX: we could make things a lot better, by having r-vary,
cvs commit: apache-1.3/src/main http_protocol.c
fielding99/07/30 20:30:19 Modified:src CHANGES src/main http_protocol.c Log: Replace the Vary fixup code with a single-pass, single-copy implementation that only adds the cost of a single ap_make_array when there is no Vary field. Revision ChangesPath 1.1406+1 -1 apache-1.3/src/CHANGES Index: CHANGES === RCS file: /home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.1405 retrieving revision 1.1406 diff -u -r1.1405 -r1.1406 --- CHANGES 1999/07/31 00:37:22 1.1405 +++ CHANGES 1999/07/31 03:30:16 1.1406 @@ -10,7 +10,7 @@ *) Fix SIGSEGV on some systems because the Vary fix below included a call to table_do with a variable argument list that was not - NULL terminated. [Roy Fielding] + NULL terminated. Replaced with better implementation. [Roy Fielding] Changes with Apache 1.3.7 [not released] 1.275 +56 -85apache-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.274 retrieving revision 1.275 diff -u -r1.274 -r1.275 --- http_protocol.c 1999/07/31 00:37:25 1.274 +++ http_protocol.c 1999/07/31 03:30:18 1.275 @@ -1446,27 +1446,55 @@ strstr(ua, MSIE 3))); } -/* - * qsort comparison routine for fixup_vary(). +/* This routine is called by ap_table_do and merges all instances of + * the passed field values into a single array that will be further + * processed by some later routine. Originally intended to help split + * and recombine multiple Vary fields, though it is generic to any field + * consisting of comma/space-separated tokens. */ -static int compare_vary(const void *va, const void *vb) +static int uniq_field_values(void *d, const char *key, const char *val) { -return strcasecmp(*(const char **)va, *(const char **)vb); -} +array_header *values; +char *start; +char *e; +char **strpp; +int i; -/* - * ap_table_get() only picks up the first occurrence of a key, - * which means that if there's a Vary in r-headers_out and another - * in r-err_headers_out, one might get ignored. This routine - * is called by ap_table_do and merges all instances of Vary into - * a temporary list in r-notes. - */ -static int merge_vary_fields(void *d, const char *key, const char *val) -{ -request_rec *r; +values = (array_header *)d; + +e = ap_pstrdup(values-pool, val); -r = (request_rec *)d; -ap_table_merge(r-notes, Vary-list, val); +do { +/* Find a non-empty fieldname */ + +while (*e == ',' || ap_isspace(*e)) { +++e; +} +if (*e == '\0') { +break; +} +start = e; +while (*e != '\0' *e != ',' !ap_isspace(*e)) { +++e; +} +if (*e != '\0') { +*e++ = '\0'; +} + +/* Now add it to values if it isn't already represented. + * Could be replaced by a ap_array_strcasecmp() if we had one. + */ +for (i = 0, strpp = (char **) values-elts; i values-nelts; + ++i, ++strpp) { +if (*strpp strcasecmp(*strpp, start) == 0) { +break; +} +} +if (i == values-nelts) { /* if not found */ + *(char **)ap_push_array(values) = start; +} +} while (*e != '\0'); + return 1; } @@ -1477,80 +1505,23 @@ */ static void fixup_vary(request_rec *r) { -const char *vary; -array_header *arr; -char *start; -char *e; -char **ecur; -char **eend; -char **ekeep; +array_header *varies; -/* Don't do any unnecessary manipulations.. - */ -if (ap_table_get(r-headers_out, Vary) == NULL) { - return; -} -ap_table_do((int (*)(void *, const char *, const char *))merge_vary_fields, - (void *) r, r-headers_out, Vary, NULL); -vary = ap_table_get(r-notes, Vary-list); - -/* XXX: we could make things a lot better, by having r-vary, - * which is an array of char * -- which modules append to as they - * find things which the request varies on. This is probably - * better than a table, because a table would require O(n^2) - * string comparisons... another option would be to use a table - * but indicate that folks should use ap_table_add... - * at any rate, if we had such an array, we would just set - * arr = r-vary here (or arr = ap_table_elts(r-vary)). - */ -arr = ap_make_array(r-pool, 5, sizeof(char *)); +varies = ap_make_array(r-pool, 5,
cvs commit: apache-1.3 STATUS
martin 99/07/31 02:25:42 Modified:.STATUS Log: Small update concerning not-released 1.3.7 Revision ChangesPath 1.731 +3 -4 apache-1.3/STATUS Index: STATUS === RCS file: /export/home/cvs/apache-1.3/STATUS,v retrieving revision 1.730 retrieving revision 1.731 diff -u -r1.730 -r1.731 --- STATUS1999/07/29 22:21:49 1.730 +++ STATUS1999/07/31 09:25:40 1.731 @@ -1,12 +1,11 @@ 1.3 STATUS: - Last modified at [$Date: 1999/07/29 22:21:49 $] + Last modified at [$Date: 1999/07/31 09:25:40 $] Release: -1.3.7-dev: current. Ken volunteers to be release manager. -Proposed dates: roll on Thu, 29 July 1999, test, and release -on Mon, 2 August 1999. +1.3.8-dev: current. +1.3.7: Not released. 1.3.6. Tagged and rolled on Mar. 22. Released and announced on 24th. 1.3.5: Not released. 1.3.4: Tagged and rolled on Jan. 9. Released on 11th, announced on 12th.
cvs commit: apache-2.0/mpm/src/main http_config.c http_connection.c http_protocol.c http_request.c
ben 99/07/31 02:31:28 Modified:mpm/src/include ap_hooks.h mpm/src/main http_config.c http_connection.c http_protocol.c http_request.c Log: Break out the hook implementations into three kinds, thus avoiding null macro arguments. Gates made me do it! Revision ChangesPath 1.10 +55 -18apache-2.0/mpm/src/include/ap_hooks.h Index: ap_hooks.h === RCS file: /export/home/cvs/apache-2.0/mpm/src/include/ap_hooks.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- ap_hooks.h1999/07/27 21:16:36 1.9 +++ ap_hooks.h1999/07/31 09:31:17 1.10 @@ -21,7 +21,7 @@ #define HOOK_LINK(name) \ array_header *link_##name; -#define IMPLEMENT_HOOK_BASE(ret,rv_decl,sv,rv,name,args,args2,run_all,term1,term2,rv_final) \ +#define IMPLEMENT_HOOK_BASE(name) \ void ap_hook_##name(HOOK_##name *pf,const char * const *aszPre, \ const char * const *aszSucc,int nOrder) \ { \ @@ -39,37 +39,74 @@ pHook-szName=g_szCurrentHookName; \ if(g_bDebugHooks) \ ap_show_hook(#name,aszPre,aszSucc); \ -} \ -ret ap_run_##name args \ +} + +/* RUN_ALL runs to the first one to return other than ok or decline + RUN_FIRST runs to the first one to return other than decline + VOID runs all +*/ + +#define IMPLEMENT_HOOK_VOID(name,args_decl,args_use) \ +IMPLEMENT_HOOK_BASE(name) \ +void ap_run_##name args_decl \ +{ \ +LINK_##name *pHook; \ +int n; \ +\ +if(!_hooks.link_##name) \ + return; \ +\ +pHook=(LINK_##name *)_hooks.link_##name-elts; \ +for(n=0 ; n _hooks.link_##name-nelts ; ++n) \ + pHook[n].pFunc args_use; \ +} + +/* FIXME: note that this returns ok when nothing is run. I suspect it should + really return decline, but that breaks Apache currently - Ben +*/ +#define IMPLEMENT_HOOK_RUN_ALL(ret,name,args_decl,args_use,ok,decline) \ +IMPLEMENT_HOOK_BASE(name) \ +ret ap_run_##name args_decl \ { \ LINK_##name *pHook; \ int n; \ -rv_decl \ +ret rv; \ \ if(!_hooks.link_##name) \ - return rv_final; \ + return ok; \ \ pHook=(LINK_##name *)_hooks.link_##name-elts; \ for(n=0 ; n _hooks.link_##name-nelts ; ++n) \ { \ - sv pHook[n].pFunc args2; \ + rv=pHook[n].pFunc args_use; \ \ - if(term1 (!run_all || term2)) \ + if(rv != ok rv != decline) \ return rv; \ } \ -return rv_final; \ +return ok; \ } -/* RUN_ALL runs to the first one to return other than ok or decline - RUN_FIRST runs to the first one to return other than ok -*/ -#define RUN_ALL 1 -#define RUN_FIRST0 - -#define IMPLEMENT_HOOK(ret,name,args,args2,run_all,ok,decline) \ - IMPLEMENT_HOOK_BASE(ret,ret r_;,r_=,r_,name,args,args2,run_all,r_ != decline,r_ != ok,run_all ? ok : decline) -#define IMPLEMENT_VOID_HOOK(name,args,args2) \ - IMPLEMENT_HOOK_BASE(voidname,args,args2,RUN_ALL,1,0,) +#define IMPLEMENT_HOOK_RUN_FIRST(ret,name,args_decl,args_use,decline) \ +IMPLEMENT_HOOK_BASE(name) \ +ret ap_run_##name args_decl \ +{ \ +LINK_##name *pHook; \ +int n; \ +ret rv; \ +\ +if(!_hooks.link_##name) \ + return decline; \ +\ +pHook=(LINK_##name *)_hooks.link_##name-elts; \ +for(n=0 ; n _hooks.link_##name-nelts ; ++n) \ + { \ + rv=pHook[n].pFunc args_use; \ +\ + if(rv != decline) \ + return rv; \ + } \ +return decline; \ +} /* Hook orderings */ #define HOOK_REALLY_FIRST(-10) 1.16 +2 -2 apache-2.0/mpm/src/main/http_config.c Index: http_config.c === RCS file: /export/home/cvs/apache-2.0/mpm/src/main/http_config.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- http_config.c 1999/07/27 21:16:38 1.15 +++ http_config.c 1999/07/31 09:31:20 1.16 @@ -86,8 +86,8 @@ HOOK_LINK(pre_config) ) -IMPLEMENT_HOOK(int,header_parser,(request_rec *r),(r),RUN_ALL,OK,DECLINED) -IMPLEMENT_VOID_HOOK(pre_config,(pool *pconf,pool *plog,pool *ptemp), +IMPLEMENT_HOOK_RUN_ALL(int,header_parser,(request_rec *r),(r),OK,DECLINED) +IMPLEMENT_HOOK_VOID(pre_config,(pool *pconf,pool *plog,pool *ptemp), (pconf,plog,ptemp)) DEF_Explain 1.14 +2 -2 apache-2.0/mpm/src/main/http_connection.c Index: http_connection.c === RCS file: /export/home/cvs/apache-2.0/mpm/src/main/http_connection.c,v retrieving revision 1.13 retrieving revision 1.14