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
/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 */
};

Reply via email to