httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <traw...@gmail.com>
Subject Re: mod_fcgid POST broken if FcgiAuthorizer is run
Date Fri, 09 Oct 2009 19:30:23 GMT
On Fri, Oct 9, 2009 at 1:26 PM, Barry Scott <barry.scott@onelan.co.uk> wrote:
> Jeff Trawick wrote:
>>
>> On Fri, Oct 9, 2009 at 12:04 PM, Barry Scott <barry.scott@onelan.co.uk>
>> wrote:
>>
>>>
>>> This has been filed as issue
>>> https://issues.apache.org/bugzilla/show_bug.cgi?id=47973
>>>
>> See patch attached to the PR.  Thanks!
>>
>>
>
> No joy I get internal server error.
>
> But the patch below works for my case.
...

> Index: modules/fcgid/fcgid_bridge.c
> ===================================================================
> --- modules/fcgid/fcgid_bridge.c    (revision 823573)
> +++ modules/fcgid/fcgid_bridge.c    (working copy)
> @@ -470,6 +470,8 @@
>        return HTTP_INTERNAL_SERVER_ERROR;
>    }
>
> +    if (role == FCGI_RESPONDER) {
> +
>    /* Stdin header and body */
>    /* XXX HACK: I have to read all the request into memory before sending it
>       to fastcgi application server, this prevents slow clients from
> @@ -624,6 +626,7 @@
>        apr_brigade_destroy(input_brigade);
>    }
>    while (!seen_eos);
> +    } /* end handling request body for responders */
>
>    /* Append an empty body stdin header */
>    stdin_request_header = apr_bucket_alloc(sizeof(FCGI_Header),
>
>

Variation number three:

As with your patch, it remembers to add the eos bucket to the brigade
of data sent to the app.  As with my earlier patch, it doesn't send
the trailing FCGI_STDIN record.

In the spec (http://www.fastcgi.com/devkit/doc/fcgi-spec.html#S6.3),
there's no mention of FCGI_STDIN for an FCGI_AUTHORIZER.  I
double-checked that mod_fcgid.c strips any CONTENT_LENGTH when calling
the authorizer, which the spec does call for.

I won't be shocked if it still fails for you; in that case I think we
need to try to understand exactly why the trailing FCGI_STDIN record
is needed.

(FWIW, my authorizer is Perl using the FCGI module.  The protocol
implementation on the app side could explain the difference in our
observations.)

--- modules/fcgid/fcgid_bridge.c.orig	2009-10-09 12:09:12.032405619 -0400
+++ modules/fcgid/fcgid_bridge.c	2009-10-09 15:12:25.838920760 -0400
@@ -470,6 +470,8 @@
         return HTTP_INTERNAL_SERVER_ERROR;
     }

+    if (role == FCGI_RESPONDER) {
+
     /* Stdin header and body */
     /* XXX HACK: I have to read all the request into memory before sending it
        to fastcgi application server, this prevents slow clients from
@@ -640,6 +642,8 @@
     }
     APR_BRIGADE_INSERT_TAIL(output_brigade, bucket_header);

+    } /* end handling request body for responders */
+
     /* The eos bucket now */
     bucket_eos = apr_bucket_eos_create(r->connection->bucket_alloc);
     APR_BRIGADE_INSERT_TAIL(output_brigade, bucket_eos);


-- 
Born in Roswell... married an alien...

Mime
View raw message