httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Juhani Connolly" <Juh...@ninja.co.jp>
Subject Re: external redirect
Date Fri, 23 Jan 2009 09:24:14 GMT
I had a similar problem answered here not long ago though it wasn't causing 
a segfault.

Try using r->err_headers_out instead of r->headers_out

As you're returning an error, I believe these are the values that will be 
used for headers.

If that doesn't fix it, try running through a debugger or check the core 
dump for the exact cause of the segfault for further hints.

----- Original Message ----- 
From: <fkater@googlemail.com>
To: <modules-dev@httpd.apache.org>
Sent: Friday, January 23, 2009 6:07 PM
Subject: external redirect


> Hi,
>
> I'd like to do an external redirect.
>
> When I return HTTP_MOVED_TEMPORARILY from my request
> handler, the client browser gets the standard "FOUND"
> message which is ok so far.
>
> However, when I also try to set the new "Location" this
> always causes a segmentation fault:
>
> char* uri=apr_pstrdup(r->pool,"http://localhost/abcdef");
> apr_table_setn(r->headers_out,"Location",uri);
>
> return HTTP_MOVED_TEMPORARILY;
>
> I also tried to do this from the access-checker hook (for
> testing), however it segfaults immediately:
>
>
> static int done_once=false;
>
> static int
> _hook_access_checker(request_rec* r){
>
>  if(done_once)
>    return DECLINED;
>  else{
>    done_onc=true;
>
>    /* ok (no segfault) but of course no redirection: */
>    //return HTTP_MOVED_TEMPORARILY;
>
>    /* seg fault: */
>    char* uri=apr_pstrdup(r->pool,"http://localhost/abcdef");
>    apr_table_setn(r->headers_out,"Location",uri);
>
>    return HTTP_MOVED_TEMPORARILY;
>  }
> }
>
> Thank You for any further hints...
> Felix
>
>
>
> 


Mime
View raw message