You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Graham Leggett <mi...@sharp.fm> on 2013/12/12 14:28:28 UTC

r->handler being overwritten with mime type

Hi all,

I have just tripped over a case where mod_auth_form has been configured to do inline login. What is supposed to happen is that on successful parsing of the POST of the login form, we do an internal redirect to turn the request back into a GET (or whatever method the original form wanted to achieve):

1043	        if (sent_method && strcmp(r->method, sent_method)) {
(gdb) print sent_method
$5 = 0x1011107b8 "GET"
(gdb) next
1044	            r->handler = FORM_REDIRECT_HANDLER;

Later on we reach the form redirect handler, but at this point r->handler has been blown away and now contains a mime type:

Breakpoint 2, authenticate_form_redirect_handler (r=0x10110a508) at mod_auth_form.c:1262
1262	    request_rec *rr = NULL;
(gdb) next
1263	    const char *sent_method = NULL, *sent_mimetype = NULL;
(gdb) 
1265	    if (strcmp(r->handler, FORM_REDIRECT_HANDLER)) {
(gdb) 
1266	        return DECLINED;
(gdb) print r->handler
$6 = 0x1010c5588 "text/html"

Does anyone know offhand where I should be looking for something that sets a mime type? It seems that something is setting the handler without checking first to see if the handler has been set already, and this breaks form login.

Regards,
Graham
--


Re: r->handler being overwritten with mime type

Posted by Micha Lenk <mi...@lenk.info>.
Hi Graham,

Am 12.12.2013 14:28, schrieb Graham Leggett:
> Does anyone know offhand where I should be looking for something that
> sets a mime type? It seems that something is setting the handler
> without checking first to see if the handler has been set already,
> and this breaks form login.

You could try to chase that down with GDB:
- set a breakpoint in line 1044
- run until the breakpoint triggers
- add a watchpoint on &r->handler
- run until the watchpoint triggers and see where it is...

Hope that helps...

Cheers,
Micha

Re: r->handler being overwritten with mime type

Posted by Eric Covener <co...@gmail.com>.
Maybe it's broken in two stages, r->handler lost then mimetype copied
to handler?

The second stage could be ap_invoke_handler at the very last second
before the handler is called.