Return-Path: Delivered-To: apmail-httpd-modules-dev-archive@locus.apache.org Received: (qmail 75198 invoked from network); 17 Jan 2008 18:31:18 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 17 Jan 2008 18:31:18 -0000 Received: (qmail 99333 invoked by uid 500); 17 Jan 2008 18:31:08 -0000 Delivered-To: apmail-httpd-modules-dev-archive@httpd.apache.org Received: (qmail 99309 invoked by uid 500); 17 Jan 2008 18:31:08 -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 99300 invoked by uid 99); 17 Jan 2008 18:31:07 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 Jan 2008 10:31:07 -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 64.233.182.188 as permitted sender) Received: from [64.233.182.188] (HELO nf-out-0910.google.com) (64.233.182.188) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 Jan 2008 18:30:41 +0000 Received: by nf-out-0910.google.com with SMTP id c10so66340nfd.24 for ; Thu, 17 Jan 2008 10:30:46 -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=uJYaBP11WJHd8SnGx6PPCsjZN9e5vNibp4QWJqLDwxA=; b=Z333hcxEo55vD46rLD7wXFOc1wkb0z8At7TiY/pHsHWki9wtC7zvLnSThJ1PkV9RmIrI7fAcQXlwJ6u/mlVIMuIrFVEvYDo+CilWSE5EvjfQhpTeP2Vnyet1f30a32++611ksncTuyXX7n5/+sUd+lxtU1D6ELQ/QUBlLA96UR8= 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=OL3Iwj8YzSvcl9aKEprn7IpDWcESZVxSLKviS3cg6SFGyprHG4AGsCCLoADR6YfeciABCc+CbdkhY/BIPuJg/zHZ0ry9Bhwp6Nz/QPD2RCKVWAKqCanRFSImlFH5rQXefT2okpZ8Vze/r1S/8lL7wbSAdzhl0xY5ZyhHIx5Em10= Received: by 10.78.159.7 with SMTP id h7mr3325137hue.8.1200594645588; Thu, 17 Jan 2008 10:30:45 -0800 (PST) Received: by 10.78.161.13 with HTTP; Thu, 17 Jan 2008 10:30:45 -0800 (PST) Message-ID: <9dc7421e0801171030j36998123ncea13fbac6b1ced8@mail.gmail.com> Date: Thu, 17 Jan 2008 19:30:45 +0100 From: "karim Bendadda" To: modules-dev@httpd.apache.org Subject: Re: [Module Dev] Sending http request In-Reply-To: <478F6DE6.7050206@joe-lewis.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_1736_32754344.1200594645581" References: <1404e5910801160642g2ec6c452td648c72ae2017bf0@mail.gmail.com> <9dc7421e0801161409sb7eb7bdl827669e32a886ab8@mail.gmail.com> <1200522197l.26295l.3l@raydesk1.bettercgi.com> <9dc7421e0801161434m37fc988cp7889dc5234395853@mail.gmail.com> <9dc7421e0801170225i2a96603bn7915293196fc4534@mail.gmail.com> <478F6DE6.7050206@joe-lewis.com> X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_1736_32754344.1200594645581 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline First I'd like to thank you very much Joe for help... I have a "begineer" question: *3) allow apache to handle the rest of the request*. Is that mean return 1???? because when I tried this I had an error...and when I tried return OK I had nothing... that's my code: *static int my_module_handler (request_rec *r) { char *url = apr_pstrdup(r->pool,"http:\\10.12.23.5\irj\test"); r->filename = apr_pstrcat(r->pool, "proxy:", url, NULL); return 1; } static void **my_module**_hooks(apr_pool_t *pool){ ap_hook_handler(**my_module**_handler, NULL, NULL, APR_HOOK_FIRST); } module AP_MODULE_DECLARE_DATA **my_module**_module = { STANDARD20_MODULE_STUFF, NULL, NULL, auth_chorus_config, NULL, **my_module**_cmds, **my_module**_hooks };* Thanks On Jan 17, 2008 4:01 PM, Joe Lewis < joe@joe-lewis.com> wrote: > karim Bendadda wrote: > > Hi All; > > > > I tried this > > > > *request_rec *subr = ap_sub_req_lookup_uri(url, r, NULL); > > apr_table_set( subr->headers_out, "Location", url ); > > ap_log_rerror( APLOG_MARK, APLOG_ERR, 0,r, "sub request status: > > %i",subr->status ); > > ap_run_sub_req(subr);* > > > > I have the following error: > > > > *[Thu Jan 17 07:11:25 2008] [error] [client 10.75.197.168 ] File does > not > > exist: /usr/local/apache2/htdocs/my_module* > > > > I think because the external server is not on the same site..I read the > > paragraph 6.3 Diverting a Request: The internal redirect ...I think > there is > > no external redirect for http requests... > > Any suggestion please?? > > > > That error and assumption are correct. As Ray stated, the > ap_sub_req_lookup_uri only works if the URI is on the local server's > apache. (It is a URI vs. URL concept - the URI does not include the > http://servername piece of the URL.) > > Instead, try a simple : > > r->filename = apr_pstrcat(r->pool, "proxy:", url, NULL); > return 1; > > (this example was stolen from mod_rewrite, which was the only core > module that I was aware of that included a "send to proxy" command). > Just set the URL to what the client would have been grabbing if it was > redirected to the right page. For example, if the client is trying to > get the page http://corvette.sharktooth.org/status.html , the resulting > line would be : > > url = apr_pstrdup(r->pool,"http://corvette.sharktooth.org/status.html"); > r->filename = apr_pstrcat(r->pool, "proxy:", url, NULL); > return 1; > > (this could also be shortened - what the three lines do are 1) get/set > the URL, which should be set in your case already, 2) preface the URL > with "proxy:", which is an indicator to proxy the request elsewhere, and > 3) allow apache to handle the rest of the request). > > Try it and let us know if that works for you. > > Joe > -- > Joseph Lewis > "Divide the fire, and you will sooner put it out." - Publius Syrus > -- Karim ------=_Part_1736_32754344.1200594645581--