httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Poeml <po...@suse.de>
Subject Re: external redirect
Date Fri, 23 Jan 2009 09:38:49 GMT
On Fri, Jan 23, 2009 at 10:07:38AM +0100, fkater@googlemail.com wrote:
> 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

It should work just like that. In which line does the crash precisely
happen?

If the innocent looking lines trigger this, I would expect that
something is hosed already when they are reached, something like
corruption of the request object by something else which is going on
"above".

Can you reproduce it easily, i.e. with starting the server and issueing
a single request?

Peter
-- 
Contact: admin@opensuse.org (a.k.a. ftpadmin@suse.com)
         #opensuse-mirrors on freenode.net
Info: http://en.opensuse.org/Mirror_Infrastructure
 
SUSE LINUX Products GmbH
Research & Development

Mime
View raw message