Return-Path: Delivered-To: apmail-httpd-modules-dev-archive@minotaur.apache.org Received: (qmail 51039 invoked from network); 16 Feb 2010 10:45:44 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 16 Feb 2010 10:45:44 -0000 Received: (qmail 31934 invoked by uid 500); 16 Feb 2010 10:45:44 -0000 Delivered-To: apmail-httpd-modules-dev-archive@httpd.apache.org Received: (qmail 31894 invoked by uid 500); 16 Feb 2010 10:45:44 -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 31884 invoked by uid 99); 16 Feb 2010 10:45:44 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Feb 2010 10:45:44 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of frederic.laurendeau@gmail.com designates 72.14.220.156 as permitted sender) Received: from [72.14.220.156] (HELO fg-out-1718.google.com) (72.14.220.156) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Feb 2010 10:45:38 +0000 Received: by fg-out-1718.google.com with SMTP id e12so795110fga.12 for ; Tue, 16 Feb 2010 02:45:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=IVjifuocAptwalynVr1OA4Eq+UxuJ+R8gSmuya7fD/g=; b=rktS4E+xJ0RB6ZEW3JZtbU9e1XJ+nINXfokd+q6if95WE6zj0hwKMbcvdGoBu1IrMj 1Bjs/Tw00RCaVzvfHei92/Wz6kpg5gOuVnnazmgMgsbsNRhoqOUrkkL3k+/Eim8VlI/s 9UjTDYcuElOSCDNuzABZz+onArOvLBZ6V35fs= 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=hedh1o8h0VINPgSXMI8GlavmKIcN2HuwGpXSGunRG9WXf35pjzoFKwa1XSdfNAfm5V /sBnu6Z+tKLKqHbeV/fiBIKg3q+V2HE8p0feL6Mn+GLY7a76Ld9qHkMLnNN96Y0OMyl0 cSQVZHiBZ2IKIpZ7WSQESEUo/Uc393Y0VFqsg= MIME-Version: 1.0 Received: by 10.103.81.37 with SMTP id i37mr4725282mul.39.1266317117440; Tue, 16 Feb 2010 02:45:17 -0800 (PST) In-Reply-To: <20170a031002160235i339d5323o66ea29b4b380812b@mail.gmail.com> References: <2770c8dd1002160224n6b564a10ld0c591c5023f1ae4@mail.gmail.com> <20170a031002160235i339d5323o66ea29b4b380812b@mail.gmail.com> Date: Tue, 16 Feb 2010 11:45:17 +0100 Message-ID: <2770c8dd1002160245t3f7b1f16k101272068ea74469@mail.gmail.com> Subject: Re: Using aprec in a handler to retrieve request body From: =?ISO-8859-1?Q?Fr=E9d=E9ric_Laurendeau?= To: modules-dev@httpd.apache.org Content-Type: multipart/alternative; boundary=0016e65b5b62f54534047fb56d9e --0016e65b5b62f54534047fb56d9e Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Thanks for your help ! I tried it but it doesn't work, I get the following errors. /usr/local/apache2//build/libtool --silent --mode=3Dcompile gcc -prefer-pic -DAP_HAVE_DESIGNATED_INITIALIZER -DLINUX=3D2 -D_REENTRANT -D_GNU_SOURCE -g -O2 -pthread -I/usr/local/apache2//include -I/usr/local/apache2//include -I/usr/local/apache2//include -c -o mod_maquette.lo mod_maquette.c && touch mod_maquette.slo mod_maquette.c: In function `maquette_handler': mod_maquette.c:21: warning: initialization makes pointer from integer without a cast /usr/local/apache2//build/libtool --silent --mode=3Dlink gcc -o mod_maquette.la -lapreq2 -rpath /usr/local/apache2//modules -module -avoid-version mod_maquette.lo /usr/bin/ld: cannot find -lapreq2 collect2: ld returned 1 exit status apxs:Error: Command failed with rc=3D65536 . /usr/local/apache2//build/instdso.sh SH_LIBTOOL=3D'/usr/local/apache2//build/libtool' mod_maquette.la/usr/local/apache2//modules /usr/local/apache2//build/libtool --mode=3Dinstall cp mod_maquette.la/usr/local/apache2//modules/ cp .libs/mod_maquette.so /usr/local/apache2//modules/mod_maquette.so cp: cannot stat `.libs/mod_maquette.so': No such file or directory apxs:Error: Command failed with rc=3D65536 2010/2/16 Sorin Manolache > 2010/2/16 Fr=E9d=E9ric Laurendeau : > > Hi, > > > > I am trying to write a module which will get the request body, process = it > > and write generated content in the response. > > I have seen that some of you used aprec to get the request body but I > just > > cannot manage to build my module with it. I'm using apxs to build my > module > > and after the build, there is an error when trying to start apache2 wit= h > my > > module: "Cannot load mod_maquette.so into server: undefined symbol: > > apreq_params_as_string" > > > > I put at the bottom of the mail my source code and my build script, may= be > I > > forgot to include some headers in the source or some libraries in the > build > > command line ? > > > > I don't really understand how all of this works but aprec seems very > > powerfull and I'd like to find some tutorials or examples on how to bui= ld > > modules with it. > > > > Thanks for your help. > > > > Frederic > > > > Build script : > > /usr/local/apache2/bin/apxs -c mod_maquette.c > > Try > > /usr/local/apache2/bin/apxs -c -l apreq2 mod_maquette.c > > > /usr/local/apache2/bin/apxs -i -a -n maquette mod_maquette.la > > > > > > Source code mod_maquette.c: > > #include > > #include > > #include > > #include "httpd.h" > > #include "http_connection.h" > > #include "http_config.h" > > #include "http_core.h" > > #include "http_log.h" > > #include "http_protocol.h" > > #include "ap_config.h" > > #include "http_request.h" > > #include "apr.h" > > #include "apr_strings.h" > > #include "apr_lib.h" > > #include "apreq2/apreq_module.h" > > #include "apreq2/apreq_param.h" > > > > static int maquette_handler(request_rec *r) > > { > > const apr_table_t* args; > > apreq_handle_t* h =3D apreq_handle_apache2(r); > > apreq_body(h, &args); > > const char *params =3D apreq_params_as_string(r->pool, args, NULL, > > APREQ_JOIN_QUOTE); > > > > fprintf(stderr, "=3D=3D=3D=3D=3DTEST=3D=3D=3D=3D=3D\n%s\n=3D=3D=3D=3D= =3D=3DTEST=3D=3D=3D=3D=3D\n", params ); > > ap_rprintf(r, "Request data read : %s\n", params); > > fflush(stderr); > > return DONE; > > } > > > > static void register_hooks(apr_pool_t *p) > > { > > ap_hook_handler(maquette_handler, NULL, NULL, APR_HOOK_MIDDLE); > > } > > > > module AP_MODULE_DECLARE_DATA maquette_module =3D > > { > > STANDARD20_MODULE_STUFF, > > NULL, /* dir config creater */ > > NULL, /* dir merger --- default is to override */ > > NULL, /* server config */ > > NULL, /* merge server configs */ > > NULL, /* command apr_table_t */ > > register_hooks, /* register hooks */ > > }; > > > > > > -- > A: Because it reverses the logical flow of conversation. > Q: Why is top-posting frowned upon? > A: Top-posting. > Q: What is the most annoying thing in e-mail? > --0016e65b5b62f54534047fb56d9e--