You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by sf...@apache.org on 2010/11/06 12:11:17 UTC

svn commit: r1032002 - in /httpd/httpd/trunk: CHANGES STATUS modules/http/config.m4 modules/http/config2.m4 server/main.c

Author: sf
Date: Sat Nov  6 11:11:17 2010
New Revision: 1032002

URL: http://svn.apache.org/viewvc?rev=1032002&view=rev
Log:
Fix hook sorting for the pre_config hook.
Move modules/http/config2.m4 back to modules/http/config.m4, since this was
only done as work-around in r88887 for the broken hook-sorting.

Added:
    httpd/httpd/trunk/modules/http/config.m4
      - copied unchanged from r1031997, httpd/httpd/trunk/modules/http/config2.m4
Removed:
    httpd/httpd/trunk/modules/http/config2.m4
Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/STATUS
    httpd/httpd/trunk/server/main.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1032002&r1=1032001&r2=1032002&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Sat Nov  6 11:11:17 2010
@@ -6,6 +6,9 @@ Changes with Apache 2.3.9
      Fix a denial of service attack against mod_reqtimeout.
      [Stefan Fritsch]
 
+  *) core: Do the hook sorting earlier so that the hooks are properly sorted
+     for the pre_config hook and during parsing the config. [Stefan Fritsch] 
+
   *) core: In the absence of any AllowOverride directives, the default is now
      "None" instead of "All".  PR49823 [Eric Covener]
 

Modified: httpd/httpd/trunk/STATUS
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/STATUS?rev=1032002&r1=1032001&r2=1032002&view=diff
==============================================================================
--- httpd/httpd/trunk/STATUS (original)
+++ httpd/httpd/trunk/STATUS Sat Nov  6 11:11:17 2010
@@ -153,19 +153,6 @@ RELEASE NON-SHOWSTOPPERS BUT WOULD BE RE
     wrowe suggests: it would be nice to see "MUST" v.s. "SHOULD" v.s. "MAY"
                     out of this list, without reviewing them individually.
 
-  * There is a bug in how we sort some hooks, at least the pre-config
-    hook.  The first time we call the hooks, they are in the correct 
-    order, but the second time, we don't sort them correctly.  Currently,
-    the modules/http/config.m4 file has been renamed to 
-    modules/http/config2.m4 to work around this problem, it should moved
-    back when this is fixed.
-
-      OtherBill offers that this is a SERIOUS problem.  We do not sort
-      correctly by the ordering arguments passed to the register hook
-      functions.  This was proven when I reordered the open_logs hook
-      to attempt to open the error logs prior to the access logs.  Possibly
-      the entire sorting code needs to be refactored.
-
   * pipes deadlock on all platforms with limited pipe buffers (e.g. both
     Linux and Win32, as opposed to only Win32 on 1.3).  The right solution
     is either GStein's proposal for a "CGI Brigade", or OtherBill's proposal

Modified: httpd/httpd/trunk/server/main.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/main.c?rev=1032002&r1=1032001&r2=1032002&view=diff
==============================================================================
--- httpd/httpd/trunk/server/main.c (original)
+++ httpd/httpd/trunk/server/main.c Sat Nov  6 11:11:17 2010
@@ -617,6 +617,7 @@ int main(int argc, const char * const ar
     if (!ap_server_conf) {
         destroy_and_exit_process(process, 1);
     }
+    apr_hook_sort_all();
 
     if (ap_run_pre_config(pconf, plog, ptemp) != OK) {
         ap_log_error(APLOG_MARK, APLOG_STARTUP |APLOG_ERR, 0,
@@ -629,7 +630,6 @@ int main(int argc, const char * const ar
     if (rv == OK) {
         ap_fixup_virtual_hosts(pconf, ap_server_conf);
         ap_fini_vhost_config(pconf, ap_server_conf);
-        apr_hook_sort_all();
 
         if (ap_run_check_config(pconf, plog, ptemp, ap_server_conf) != OK) {
             ap_log_error(APLOG_MARK, APLOG_STARTUP |APLOG_ERR, 0,
@@ -699,6 +699,7 @@ int main(int argc, const char * const ar
         if (!ap_server_conf) {
             destroy_and_exit_process(process, 1);
         }
+        apr_hook_sort_all();
 
         if (ap_run_pre_config(pconf, plog, ptemp) != OK) {
             ap_log_error(APLOG_MARK, APLOG_STARTUP |APLOG_ERR,
@@ -712,7 +713,6 @@ int main(int argc, const char * const ar
         }
         ap_fixup_virtual_hosts(pconf, ap_server_conf);
         ap_fini_vhost_config(pconf, ap_server_conf);
-        apr_hook_sort_all();
 
         if (ap_run_check_config(pconf, plog, ptemp, ap_server_conf) != OK) {
             ap_log_error(APLOG_MARK, APLOG_STARTUP |APLOG_ERR, 0,



Re: svn commit: r1032002 - in /httpd/httpd/trunk: CHANGES STATUS modules/http/config.m4 modules/http/config2.m4 server/main.c

Posted by Stefan Fritsch <sf...@sfritsch.de>.
On Fri, 10 Jun 2011, Jeff Trawick wrote:
>> Fix hook sorting for the pre_config hook.
>> Move modules/http/config2.m4 back to modules/http/config.m4, since this was
>> only done as work-around in r88887 for the broken hook-sorting.

> In consideration of backporting:
>
> Calling apr_hook_sort_all() earlier affects only the pre-config hook
> and seems unlikely to break a fragile third-party module.
>
> The config*m4 rename potentially affects any hook that http_core
> implements, but it just moves it around within the list of static
> modules, and fragile third-party code isn't often built statically.
>
> I don't expect either part of this to be disruptive to 2.2.x but the
> main.c is the only necessary part of the fix, and doing only that
> results in  a little less risk of breaking fragile third-party code.
>
> Thoughts/corrections?

+1 to backporting, and I also agree that the config*m4 rename is not 
necessary and should be left out.

Re: svn commit: r1032002 - in /httpd/httpd/trunk: CHANGES STATUS modules/http/config.m4 modules/http/config2.m4 server/main.c

Posted by Jeff Trawick <tr...@gmail.com>.
On Sat, Nov 6, 2010 at 7:11 AM,  <sf...@apache.org> wrote:
> Author: sf
> Date: Sat Nov  6 11:11:17 2010
> New Revision: 1032002
>
> URL: http://svn.apache.org/viewvc?rev=1032002&view=rev
> Log:
> Fix hook sorting for the pre_config hook.
> Move modules/http/config2.m4 back to modules/http/config.m4, since this was
> only done as work-around in r88887 for the broken hook-sorting.

I'm very lucky that I remembered this trunk fix when encountering the
same limitation in 2.2.x today!

In consideration of backporting:

Calling apr_hook_sort_all() earlier affects only the pre-config hook
and seems unlikely to break a fragile third-party module.

The config*m4 rename potentially affects any hook that http_core
implements, but it just moves it around within the list of static
modules, and fragile third-party code isn't often built statically.

I don't expect either part of this to be disruptive to 2.2.x but the
main.c is the only necessary part of the fix, and doing only that
results in  a little less risk of breaking fragile third-party code.

Thoughts/corrections?