httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "karim Bendadda" <kakib...@gmail.com>
Subject Re: [Apache Module] Request External Redirection
Date Mon, 14 Jan 2008 16:44:12 GMT
Sorry but I'm a beginer on developping Apache modules...Thank you for your
patience...

I dont't understand this:

> /* set a "Location:" header and 302 redirect. */

Does'it mean to make this??:

<Location /my_module>
Redirect /my_module http://10.112.3.20/test
</Location>


Then I tried this:

static int my_module_handler (request_rec *r){

   /* assemble the url by appending the filename to a baseurl */

   uri = apr_pstrcat(r->pool, "http://10.112.3.20/test", "my_module",
NULL);/*????*/

    apr_table_setn(r->headers_out, "my_module", uri);

     return HTTP_MOVED_TEMPORARILY;
}


Am I wrrong?? Is that means my request is redirected to
http://10.112.3.20/test??



On 1/14/08, Joe Lewis <joe@joe-lewis.com> wrote:
>
> karim Bendadda wrote:
> > Thank you for your help!
> >
> > How can I call the Redirect directive into the module??, In fact in the
> > module I have a function that make an LDAP connection I want to do
> something
> > like that:
> >
> > request_rec* my_request; //The request with new information
> >
> > if(my_function(user_is_defined_in_ldap)==true)
> >
> > Redirect my_request new_Url
> >
> > else
> >
> > Do_nothing
> >
>
>
> Do_nothing should be "return DECLINED" in the handler.  Redirect
> my_request new_URL should be almost verbatim the code that the Doc
> (Peter Poeml) included.  Let me just snip down through to his example to
> make it a little more obvious.
>
>
> >> In your handler, you would do something like this to implement the
> latter:
> >>
> >>     /* set a "Location:" header and 302 redirect. */
> >>
> >>     /* assemble the url by appending the filename to a baseurl */
> >>     uri = apr_pstrcat(r->pool, baseurl, filename, NULL);
> >>
> >>     apr_table_setn(r->headers_out, "Location", uri);
> >>
> >>     return HTTP_MOVED_TEMPORARILY;
>
>
> And there is the "how to".  Recall, though, that this kind of thing
> shouldn't be in an input filter, but a handler.  (It may, in theory, be
> workable in a filter, but a filter is supposed to alter input not handle
> requests, and a handler is supposed to give the response of the 302 or
> data or decline to handle it.)
>
> Joe
> --
> Joseph Lewis <http://sharktooth.org/>
> "Divide the fire, and you will sooner put it out." - Publius Syrus
>



-- 
Karim

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message