Return-Path: Delivered-To: apmail-httpd-modules-dev-archive@locus.apache.org Received: (qmail 52918 invoked from network); 14 Jan 2008 16:44:45 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 14 Jan 2008 16:44:45 -0000 Received: (qmail 42516 invoked by uid 500); 14 Jan 2008 16:44:34 -0000 Delivered-To: apmail-httpd-modules-dev-archive@httpd.apache.org Received: (qmail 42481 invoked by uid 500); 14 Jan 2008 16:44:33 -0000 Mailing-List: contact modules-dev-help@httpd.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: modules-dev@httpd.apache.org Delivered-To: mailing list modules-dev@httpd.apache.org Received: (qmail 42446 invoked by uid 99); 14 Jan 2008 16:44:33 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 Jan 2008 08:44:33 -0800 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,NORMAL_HTTP_TO_IP,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of kakibend@gmail.com designates 209.85.128.184 as permitted sender) Received: from [209.85.128.184] (HELO fk-out-0910.google.com) (209.85.128.184) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 Jan 2008 16:44:08 +0000 Received: by fk-out-0910.google.com with SMTP id 26so1395689fkx.8 for ; Mon, 14 Jan 2008 08:44:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; bh=dFyKjLvvZzZtizDrVfDannxE/ec8DtEP6aDpFQaDoGo=; b=OHeDYT96gx2YL75BNxtgyPqks71p8CHR7ihtIjB8qJNi2n2jVikHTMhYIDSshBeejxcr/uFs7OZdXNeLuB5ifuEepzr7UyR73nITd9TwlU8BrJ0bp0VY2JAj0cq4bG91hQfABmSusJWPjiuoMe399xbGzrohFWB1O7O+k76yycc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=P4qK8FFcOmDpG8R9BjfQzY5hOuBfdwtn8UxcCZJ2jIo8L9u4DoDTTjG0lyHnoqMUo0YyuLnRx+TgaXuxh5t4e44Ch5I8YkaNbSMoWLMjQNqDa9hSw4+vzJBmx2r1KCpFnsgYaPbIXt4AKCwJ5dUE90nZs92HRGqQw94fgFGR6yk= Received: by 10.78.145.14 with SMTP id s14mr7589467hud.58.1200329052307; Mon, 14 Jan 2008 08:44:12 -0800 (PST) Received: by 10.78.161.13 with HTTP; Mon, 14 Jan 2008 08:44:12 -0800 (PST) Message-ID: <9dc7421e0801140844q51edf903h68780521bdc85c47@mail.gmail.com> Date: Mon, 14 Jan 2008 17:44:12 +0100 From: "karim Bendadda" To: modules-dev@httpd.apache.org Subject: Re: [Apache Module] Request External Redirection In-Reply-To: <478B8483.7010507@joe-lewis.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_9914_32204764.1200329052309" References: <9dc7421e0801131158g361df65dpf026b5b05ff915bb@mail.gmail.com> <478B7277.4040909@joe-lewis.com> <9dc7421e0801140650q25f20749p450feaafe529e433@mail.gmail.com> <20080114150037.GE23798@suse.de> <9dc7421e0801140730s4aa042a0kc68741bda4050b18@mail.gmail.com> <478B8483.7010507@joe-lewis.com> X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_9914_32204764.1200329052309 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline 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??: Redirect /my_module http://10.112.3.20/test 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 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 > "Divide the fire, and you will sooner put it out." - Publius Syrus > -- Karim ------=_Part_9914_32204764.1200329052309--