coar 98/05/08 21:36:40
Modified: src/main http_main.c Log: Untangle the last patch.. ap_add_version_component() needs to *prepend* the strings it's fed, not append them. This is because the last thing that calls it before the string is locked is ap_set_version() (as in set-like-cement), which adds the SERVER_BASEVERSION, the platform (conditionally), and the SERVER_SUBVERSION (if defined) at a known location - the front of the string. This has the drawback that module contributions will be listed in reverse order from their 'importance' (which is, in turn, in reverse order from their appearance in the Configuration file ;-). However, only modules with major effects should be contributing to the string anyway, so we can consider them equal. Can't we? The alternative is to either allow ap_set_version() to directly modify the string rather than going through ap_add...(), or else to add another routine that appends rather than prepends. I don't like either of these because of the issues with semantics synchronisation and code duplication. The last patch confused things, though, so I'm just returning the behaviour to the original design - if someone wants to take extra steps to have module contributions listed in the same order as they're called, have a party. This should fix Rasmus' problem with the components being out of order, although it doesn't touch his issue with the init callback duplicating the SERVER_SUBVERSION effort. Revision Changes Path 1.342 +6 -6 apache-1.3/src/main/http_main.c Index: http_main.c =================================================================== RCS file: /export/home/cvs/apache-1.3/src/main/http_main.c,v retrieving revision 1.341 retrieving revision 1.342 diff -u -r1.341 -r1.342 --- http_main.c 1998/05/09 03:25:43 1.341 +++ http_main.c 1998/05/09 04:36:38 1.342 @@ -371,15 +371,15 @@ */ if (server_version == NULL) { ap_register_cleanup(pconf, NULL, (void (*)(void *))reset_version, - (void (*)(void *))ap_null_cleanup); + ap_null_cleanup); server_version = ap_pstrdup(pconf, component); } else { /* * Prepend the given component identifier to the existing string */ - server_version = ap_pstrcat(pconf, server_version, " ", component, - NULL); + server_version = ap_pstrcat(pconf, component, " ", server_version, + NULL); } } } @@ -390,15 +390,15 @@ */ static void ap_set_version() { +#ifdef SERVER_SUBVERSION + ap_add_version_component(SERVER_SUBVERSION); +#endif if (ap_note_platform) { ap_add_version_component(SERVER_BASEVERSION " (" PLATFORM ")"); } else { ap_add_version_component(SERVER_BASEVERSION); } -#ifdef SERVER_SUBVERSION - ap_add_version_component(SERVER_SUBVERSION); -#endif version_locked++; }