Return-Path: Delivered-To: apmail-httpd-modules-dev-archive@minotaur.apache.org Received: (qmail 77437 invoked from network); 6 May 2010 22:22:37 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 6 May 2010 22:22:37 -0000 Received: (qmail 93949 invoked by uid 500); 6 May 2010 22:22:37 -0000 Delivered-To: apmail-httpd-modules-dev-archive@httpd.apache.org Received: (qmail 93918 invoked by uid 500); 6 May 2010 22:22:37 -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 93909 invoked by uid 99); 6 May 2010 22:22:37 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 May 2010 22:22:37 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=FREEMAIL_FROM,HTML_MESSAGE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of teknosoul@gmail.com designates 209.85.161.45 as permitted sender) Received: from [209.85.161.45] (HELO mail-fx0-f45.google.com) (209.85.161.45) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 May 2010 22:22:31 +0000 Received: by fxm12 with SMTP id 12so319946fxm.18 for ; Thu, 06 May 2010 15:22:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type; bh=yubE2Lp4xHCtc4rayhf/Fimwa+tIjR0/WlWk/d787Pc=; b=ePGcCJ4imkX/4B0QY2X3hkS0w1nYvr4feLd7V4o6GYWC0ZkN79zs7K6IWBLI+hv3Ol 4fLcUL1uquvsVmDylxgktDIxeYmDpwu2gMLGmk8oGIOB77TuanvkvO+R8J6PCLR4PiKt hEgQSL6sqwuGjiRt+Q25Nz42YlM+/7zJ4dBec= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=I8Nlt6LzjwPpr/dGlKc1gPMqk5NT47zD9gp8xq3Ki5zfASBOut1s8WqlR0gd5j6Blf HO0T8/2tWv817NoLiacUUcEHnvPhVkiJeFRx+91G4w2y+Sp2rgCXWnlawQyHv29BVUq1 8R3FKAkAXGvr8djRFIrmyqcQ3y01Izdt/K/SU= MIME-Version: 1.0 Received: by 10.239.131.4 with SMTP id 4mr617125hbl.189.1273184530469; Thu, 06 May 2010 15:22:10 -0700 (PDT) Received: by 10.239.148.196 with HTTP; Thu, 6 May 2010 15:22:10 -0700 (PDT) In-Reply-To: References: <0DD6935185ABCB4BB0CCA4F0283CA77D86D40F@exbe3.intra.dlr.de> <61F77DBB-AB1D-4AF1-B5FF-30BD643D59CE@joe-lewis.com> Date: Thu, 6 May 2010 18:22:10 -0400 Message-ID: Subject: Re: Doing a subrequest with ap_run_sub_req From: Some Guy To: modules-dev@httpd.apache.org Content-Type: multipart/alternative; boundary=001485f44fc0ac14cb0485f45ffe X-Virus-Checked: Checked by ClamAV on apache.org --001485f44fc0ac14cb0485f45ffe Content-Type: text/plain; charset=ISO-8859-1 What we want to do is create the subrequest (or maybe just a request) without any previous request_rec* object. At least that is what I figured markus meant when he said "build a request completely free". From the APIs, this does not seem possible, and using libCurl may be the better solution. On Thu, May 6, 2010 at 12:40 PM, Joe Lewis wrote: > On May 6, 2010, at 8:40 AM, Some Guy wrote: > > > I wanted to do something similar, but the Apache 2 APIs require a > > request_rec* in the lookup_uri method. Tracing the code in request.c, it > > uses the passed in request_rec* in make_sub_request. > > > > The example Joe provided won't compile, and the request_rec can't be NULL > > otherwise the code will segfault. Any other ways to do this? > > There are many ways - you can use libCURL to make the request, or you can > revisit the two code examples I gave you. One was from my memory, then > realizing I had forgotten a lot of it, I scraped some code from a functional > module. Did you notice both examples? The bottom one was just to point you > in the right direction. I have simplified the other one that I had scraped > from a functional module, and stuffed it into a fresh module generated by > "apxs -g -n subrequest", and it compiled quite nicely. The diff : > > 47a48,55 > > request_rec *subr; > > int return_code; > > subr = ap_sub_req_lookup_uri("/index.html",r,NULL); > > if ((subr != NULL) && (subr->status == HTTP_OK)) { > > return_code = ap_run_sub_req(subr); > > ap_destroy_sub_req(subr); > > } > > > > > I am presuming you copied and pasted my over simplified example at the > bottom of my response rather than using the top code section. > > > > > > > > On Tue, Apr 20, 2010 at 4:35 PM, Joe Lewis wrote: > > > >> ((template_context *)f->ctx)->include_r = > >> ap_sub_req_lookup_uri(uri,f->r,((template_context > >> *)f->ctx)->include_filter); > >> apr_table_setn(((template_context > >> *)f->ctx)->include_r->notes,TEMPLATE_OVERRIDE_PARSER,"-"); > >> if ((((template_context *)f->ctx)->include_r != NULL) && > >> (((template_context *)f->ctx)->include_r->status == HTTP_OK)) { > >> #ifdef DEBUG > >> ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, f->r, "mod_template: > >> mod_template_include() - calling ap_run_sub_req()"); > >> > >> On Apr 20, 2010, at 2:20 PM, > >> wrote: > >> > >>> > >>> Hi. Can I build a request completely free and send it with > >>> ap_run_sub_req? I could not find any good documentation or examples. > >>> > >>> Thanks > >>> Markus > --001485f44fc0ac14cb0485f45ffe--