1

I cannot find it in the request_rec* structure? Is there a way by which I can access it in the Apache Module?

Thanks!

user855
  • 19,048
  • 38
  • 98
  • 162

3 Answers3

3

The referer is stored in the request header, so you should get the referer from there:

const char* referer = apr_table_get(request->headers_in, "Referer");
0

You should

#apt-get install apache2-prefork-dev

then

#apxs2 -gn Somename

mod_Somename.c is in your Somename directory. In this .c file contains request_rec* structure. if you want to try full reference of request_rec* is following link

http://ci.apache.org/projects/httpd/trunk/doxygen/httpd_8h.html

Ochirbold Manal
  • 161
  • 1
  • 9
0

you can access request_rec* in input/output filter functions of an Apache 2.x Module:

for input filters:

int do_nothing_input_filter(ap_filter_t *f, apr_bucket_brigade *bb, ap_input_mode_t mode, apr_read_type_e block,
apr_off_t readbytes)
{
    request_rec *r = f->r;
    (...)
}

for output filters:

apr_status_t my_output_filter_func(ap_filter_t* f, apr_bucket_brigade* bb)
{
    request_rec *r = f->r;
    (...)
}

the structure is defined in httpd.h reference of Apache 2.x doxygen documentation

logoff
  • 3,347
  • 5
  • 41
  • 58