httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sorin Manolache" <sor...@gmail.com>
Subject Re: internal redirect
Date Sun, 14 Dec 2008 21:03:14 GMT
On Sun, Dec 14, 2008 at 17:59, Sam Carleton <scarleton@miltonstreet.com> wrote:
> On Sun, Dec 14, 2008 at 6:37 AM, Sorin Manolache <sorinm@gmail.com> wrote:
>
>> I think the 500 was caused by an infinite loop:
>
>> if (!ap_is_initial_req(r))
>>  return DECLINED;
>> const char *note = apr_table_get(r->notes, "my_note");
>> if (note != 0 && strcmp(note, "should_redirect"))
>>  ap_internal_redirect(h, "/invalidClient.html");
>
> I am with you and I see the loop in my code.  I am doing things a
> little different, I am setting the note to the redirect uri:
>
>    if (!ap_is_initial_req(r))
>        return DECLINED;
>
>    const char * redirection = apr_table_get(r->notes, "promenade_redirect");
>
>    if( redirection)   {
>        ap_internal_redirect( redirection, r);
>        return OK;
>    }
>    return DECLINED;
>
> The check at the beginning is short circuiting the handler correctly,
> but I am still getting a status code of 500.  Any thought?

Well, no thought. What I do when I'm clueless is compiling an apache
server with debug symbols (CFLAGS="-g -O0 -fno-inline"), configure it,
and start it in debug mode (apache2 -f my_conf.conf -X) in a debugger.
Then I set a breakpoint on ap_invoke_handler or on other functions in
the request processing call-stack, send a HTTP request and run the
server step-by-step. It's labour-intensive until you have set up all
your environment, but you can reuse it and it helps development and
diagnosis significantly.

S

Mime
View raw message