httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Frédéric Laurendeau <frederic.laurend...@gmail.com>
Subject Re: Using aprec in a handler to retrieve request body
Date Tue, 16 Feb 2010 10:45:17 GMT
Thanks for your help !
I tried it but it doesn't work, I get the following errors.

/usr/local/apache2//build/libtool --silent --mode=compile gcc -prefer-pic
 -DAP_HAVE_DESIGNATED_INITIALIZER -DLINUX=2 -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=link 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=65536
.
/usr/local/apache2//build/instdso.sh
SH_LIBTOOL='/usr/local/apache2//build/libtool'
mod_maquette.la/usr/local/apache2//modules
/usr/local/apache2//build/libtool --mode=install 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=65536

2010/2/16 Sorin Manolache <sorinm@gmail.com>

> 2010/2/16 Frédéric Laurendeau <frederic.laurendeau@gmail.com>:
> > 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 with
> 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, maybe
> 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 build
> > 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 <stdlib.h>
> > #include <math.h>
> > #include <string.h>
> > #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 = apreq_handle_apache2(r);
> > apreq_body(h, &args);
> > const char *params = apreq_params_as_string(r->pool, args, NULL,
> > APREQ_JOIN_QUOTE);
> >
> > fprintf(stderr, "=====TEST=====\n%s\n======TEST=====\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 =
> > {
> >    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?
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message