I think he meant on your include line :
#include "apr_buckets.h"
#include "util_filter.h
stat
On 01/16/2012 09:37 AM, Pranesh Vadhirajan wrote:
I believe it's a header that is included in the Apache build, so I would
think it doesn't have that issue.
Thanks,
Pranesh
-----Original Message-----
From: Arturo 'Buanzo' Busleiman [mailto:bua...@buanzo.com.ar]
Sent: Monday, January 16, 2012 11:18 AM
To: modules-dev@httpd.apache.org
Subject: Re: Input Filters -- not seeing anything
Is util_filter.h lacking a closing " in the #include ?
On 1/16/12, Pranesh Vadhirajan<vadhira...@teralogics.com> wrote:
Hello,
I'm very new to developing Input Filters with Apache. I have written an
input filter to read the request body content and print it to my error
log.
I have two print statements in my filtering function (one to let me know
that my filter code has been called and the other to print the request
content). Yet, I'm not seeing anything happening (nothing is getting
printed to my log). I have tried different things but I'm not able to
make
anything work, so I've attached the code below hoping to get some insight
on
why my filter doesn't seem to work. I am building the module using apxs
and
I have a LoadModule directive in the httpd.conf file to load my module.
I'm
new to the filter API and I'm totally out of ideas at this point as to why
this is not working.
#include "httpd.h"
#include "http_core.h"
#include "http_protocol.h"
#include "http_config.h"
#include "http_protocol.h"
#include "http_main.h"
#include "http_log.h"
#include "http_request.h"
#include "util_script.h"
#include "http_connection.h"
#include<stdlib.h>
#include<time.h>
#include<sys/time.h>
#include<sys/types.h>
#include<regex.h>
#include<stdio.h>
#include "uvds_metrics_sessions.h"
#include "apr.h"
#include "apr_lib.h"
#include "apr_general.h"
#include "apr_strings.h"
#include "ap_config.h"
#include "apr_buckets.h"
#include "util_filter.h
static apr_status_t req_body_filter_in(ap_filter_t *f, apr_bucket_brigade
*b, ap_input_mode_t mode, apr_size_t *readbytes)
{
const char *str;
int length;
apr_bucket *e;
fprintf(stderr,"reached this point\n");
ap_get_brigade(f->next, b, mode, APR_BLOCK_READ,1);
e = APR_BRIGADE_FIRST(b);
if (e->type == NULL) {
return APR_SUCCESS;
}
apr_bucket_read(e,&str, (apr_size_t*)&length, APR_NONBLOCK_READ);
fprintf(stderr,"req body: %s\n",str);
return APR_SUCCESS;
}
static void my_register_hooks (apr_pool_t *p) {
ap_hook_insert_filter(req_body_filter_in, NULL , NULL ,
APR_HOOK_MIDDLE) ;
//ap_register_input_filter("get_request_body" , req_body_filter_in
,
NULL , AP_FTYPE_RESOURCE) ;
}
module AP_MODULE_DECLARE_DATA my_module =
{
STANDARD20_MODULE_STUFF,
NULL, /* Per-Directory
Configuration */
NULL, /* Directory
Config
Merger */
NULL, /* Per-Server
Configuration */
NULL, /* Server Config
Merger */
NULL, /* Command Table
(Directives) */
my_register_hooks /*
Registering
Hooks */
};