Re: [users@httpd] how to create new request and how to send bak the response

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Gauri,

Try to read http://www.apachetutor.org/dev/request to understant how to work with modules.
You can build you own module following the down steps:
First, you must have a handler source module.  Your my_test.c would  look something like this:  #include <httpd.h> #include <apr_file_info.h>  static int MyTest (request_rec *r); static void RegisterHooks(apr_pool_t *p);  module AP_MODULE_DECLARE_DATA my_test =
 {     STANDARD20_MODULE_STUFF,     NULL,                       /* Create per-directory config */     NULL,                       /* Merge per-directory config */     NULL,                       /* Create per-server config */     NULL,                       /* Merge per-server config */     NULL,                       /* Command apr_table_t */     RegisterHooks               /* Register our hooks */ };  static void RegisterHooks (     apr_pool_t          *p ) {     ap_hook_handler(MyTest, NULL, NULL, APR_HOOK_MIDDLE); }  static int MyTest (request_rec *r) {     int                 APRStatus = OK;      switch (r->finfo.filetype)     {         case APR_NOFILE:             return(HTTP_NOT_FOUND);          case APR_REG:             break;          default:             return(DECLINED);     }      /* Your module's stuff */      return(APRStatus); }  Next, compile you're my_test.c with apxs, an Apache command that will  ensure that
 the module is compiled correctly.  This will produce a shared  library that Apache can load.  Use commands like this:  apxs -c -o my_test.so my_test.c mv .libs/my_test.so my_test.so  Next, change the Apache configuration to have the following two lines:  LoadModule my_test my_test.so SetHandler my_test 
 Finally, restart Apache.  The really hard stuff will be in the place of "Your module's stuff".   There you'll need to create a bucket brigade to receive the contents
of the
request, and a new bucket brigade to send the modified
response back.
This example assumes that you're writing a request handler, which will receive a request and send a response. However, you're probably interested in writing a filter which will be used to modify the request
which will
ultimately be feed to a request handler further on in the request brigade. I don't have a lot of experience with filters, so I'll stop here.
At
the very least, you'll need to change
APR_HOOK_MIDDLE to something else.
Hope this helps,

Tiago Semprebom

"William A. Rowe, Jr." <wrowe@xxxxxxxxxxxxx> escreveu:
A good place for discussing how to write modules is the module developer
mailing list, apache-modules@xxxxxxxxxxxx (apache-modules-subscribe@xxxxxxxxxxxx
to subscribe).

Plenty of module devs on that list who help lend a hand up on how-to.

Bill

gauri walwadkar wrote:
> Hi all,
> I am very new in using Apache C-API.
> I want to call one module and then give internal call to another
> module(which returns a XML file ). How can I do that using C-API functions?
> Whether |ap_get_client_block|
> reads
> request body or response body?
> how to catch the response in internal calls? (How to get the xml file in
> first module).
>
> Thanks
> -Gauri
>
>
> ------------------------------------------------------------------------
> Yahoo! India Answers: Share what you know. Learn something new Click
> here
>
> Catch all the FIFA World Cup 2006 action on Yahoo! India Click here
>
>


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
" from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



Abra sua conta no Yahoo! Mail - 1GB de espa� alertas de e-mail no celular e anti-spam realmente eficaz.
[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux