Return-Path: Delivered-To: apmail-httpd-modules-dev-archive@locus.apache.org Received: (qmail 81594 invoked from network); 17 Jan 2008 10:26:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 17 Jan 2008 10:26:24 -0000 Received: (qmail 7336 invoked by uid 500); 17 Jan 2008 10:26:13 -0000 Delivered-To: apmail-httpd-modules-dev-archive@httpd.apache.org Received: (qmail 7312 invoked by uid 500); 17 Jan 2008 10:26:13 -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 7303 invoked by uid 99); 17 Jan 2008 10:26:12 -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 02:26:12 -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.187 as permitted sender) Received: from [209.85.128.187] (HELO fk-out-0910.google.com) (209.85.128.187) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 Jan 2008 10:25:46 +0000 Received: by fk-out-0910.google.com with SMTP id 26so361241fkx.8 for ; Thu, 17 Jan 2008 02:25:50 -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:cc:in-reply-to:mime-version:content-type:references; bh=DfSsll8MT6PzR5pjzjsaBnFo7esj1HLuG/bgUIHblEU=; b=dgQjorZ2AajiNy3EWytOIrAyiwouvHoOgqkqfZJA5QjyfenkT4bDJFT5719UXVz/F6dD6c9T7AbSjPbmdpIybWNlkOLwzoMroRHMyxNGUYuGxXlLRKurVgxbF9vRugxCuzkjh7jAY+gnIIt6Q9uAwkvbqQKFvomEsgpOLnm0Svg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=VIj1/8dTjVrj2Mab7zyRDMzSj7cxa9fJTonSaITRF7oVJm8TLrJB3fE+kM5bYxj6UPteCGEaeJnX0YevbJs83momPdtHyvhnHmuY58w+Z+l86gQwfaAs+OsGqFR6cdtre/J1mt3brV/+zQz7WmLkaf8Uo/u8wXB6nJkdPf6ULek= Received: by 10.78.140.17 with SMTP id n17mr2326920hud.47.1200565550392; Thu, 17 Jan 2008 02:25:50 -0800 (PST) Received: by 10.78.161.13 with HTTP; Thu, 17 Jan 2008 02:25:50 -0800 (PST) Message-ID: <9dc7421e0801170225i2a96603bn7915293196fc4534@mail.gmail.com> Date: Thu, 17 Jan 2008 11:25:50 +0100 From: "karim Bendadda" To: modules-dev@httpd.apache.org Subject: Re: [Module Dev] Sending http request Cc: nick@webthing.com In-Reply-To: <9dc7421e0801161434m37fc988cp7889dc5234395853@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_22569_20014441.1200565550386" References: <1404e5910801160642g2ec6c452td648c72ae2017bf0@mail.gmail.com> <9dc7421e0801161409sb7eb7bdl827669e32a886ab8@mail.gmail.com> <1200522197l.26295l.3l@raydesk1.bettercgi.com> <9dc7421e0801161434m37fc988cp7889dc5234395853@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_22569_20014441.1200565550386 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline 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?? On Jan 16, 2008 11:34 PM, karim Bendadda wrote: > Thank you for your answer! I have the book but I didn't read in its > entirety... :-) I will try this! > > > On Jan 16, 2008 11:23 PM, Ray Morris wrote: > > > If the URL is on the same site, you can > > use a subrequest. Below is an example of > > doing a subrequest. ap_run_sub_req only needs > > to be run if you need the body of the response. > > The headers can be accessed after calling > > ap_sub_req_lookup_uri. Authentication is > > skipped for subrequests by default, so if you > > need to run autentication call ap_get_basic_auth_pw > > as below. The copying of the authentication > > and host headers probably isn't needed, but > > was something I put in before discovering the > > need to call ap_get_basic_auth_pw. I'm no > > expert - I only know what I read in Nick's > > fabulous Apache modules book. :) > > > > subr = ap_sub_req_lookup_uri(r->uri, r, NULL); > > apr_table_set( subr->headers_in, "Authorization", > > apr_table_get(r->headers_in, "Authorization") ); > > apr_table_set( subr->headers_in, "Host", apr_table_get(r->headers_in, > > "Host") ); > > ap_get_basic_auth_pw(subr, &sent_pw); > > ap_log_rerror( APLOG_MARK, APLOG_ERR, 0, r, "sub request status: %i", > > subr->status ); > > ap_run_sub_req(subr); > > > > -- > > Ray B. Morris > > support@bettercgi.com > > > > Strongbox - The next generation in site security: > > http://www.bettercgi.com/strongbox/ > > > > Throttlebox - Intelligent Bandwidth Control > > http://www.bettercgi.com/throttlebox/ > > > > Strongbox / Throttlebox affiliate program: > > http://www.bettercgi.com/affiliates/user/register.php > > > > > > > > > > On 01/16/2008 04:09:52 PM, karim Bendadda wrote: > > > Thank you for replying. I will see your link and reply to the mailing > > > list..perhaps this will help . > > > > > > On Jan 16, 2008 3:42 PM, Eric Covener wrote: > > > > > > > On Jan 16, 2008 9:36 AM, karim Bendadda wrote: > > > > > Hi Everybody, > > > > > > > > > > Have you any idea of an apr function wish *sends an HTTP > > > request to > > > > an > > > > > url*? I have a request request_rec and I need to send it to an > > > http url > > > > : > > > > > http:\\url.com. I'd like something like : > > > > *send_request(request_rec,url); * > > > > > > > > > > P.S: On my last mail (Request External Redirection) I asked you > > > to > > > help > > > > me > > > > > for a redirection but I think that I need to send a new request! > > > Sorry > > > > for > > > > > the inconvenience > > > > > > > > > > > > > nothing that simple probably, but mod_serf in trunk might be of > > > interest: > > > > > > > > > > > > > > > > > http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_serf.c?view=co > > > > > > > > > > > > > > > > -- > > > > Eric Covener > > > > covener@gmail.com > > > > > > > > > > > > > > > > -- > > > Karim > > > > > > > > > > -- > Karim -- Karim ------=_Part_22569_20014441.1200565550386--