You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Piotr Suwala <on...@vp.pl> on 2013/01/13 12:44:02 UTC

[users@httpd] writing modules - missing sources?

Hello.

I've got question for you concerned with writing modules for apache:
How can I start doing it? Where can I find any helpful info for this, tutorials about configuring enviroment?

And here are my first tries:

These are my first tries but when I compile them by apxs or gcc I get this error:

/usr/lib64/apr-1/build/libtool --silent --mode=compile gcc -prefer-pic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -pthread -I/usr/include/httpd  -I/usr/include/apr-1   -I/usr/include/apr-1   -c -o mod.lo mod.c && touch mod.slo
mod.c: In function 'handler':
mod.c:15:1: warning: no return statement in function returning non-void [-Wreturn-type]
mod.c: In function 'x_register_hooks':
mod.c:20:7: error: dereferencing pointer to incomplete type
mod.c:20:21: error: dereferencing pointer to incomplete type
apxs:Error: Command failed with rc=65536
.


which goes from this code

#include "httpd/httpd.h" 
#include "httpd/http_config.h" 
#include "httpd/http_core.h" 
#include "httpd/http_log.h" 
#include "httpd/http_main.h" 
#include "httpd/http_protocol.h" 
#include "httpd/http_request.h" 
#include "httpd/util_script.h" 
#include "httpd/http_connection.h" 
 

static int handler(request_rec *r) 
{ 
    
}

static void x_register_hooks(apr_pool_t* tt) 
{ 
    ap_hook_handler(handler, NULL, NULL, APR_HOOK_FIRST );
    tt->in_header=tt->in_header;//this is that line 20!
    
}

module AP_MODULE_DECLARE_DATA hello_module = 
{       STANDARD20_MODULE_STUFF, 
        NULL, /* per-directory config creator */ 
        NULL, /* directory config merger */ 
        NULL, /* server config creator */ 
        NULL, /* server config merger */ 
        NULL, /* command table */ 
        x_register_hooks, /* other request processing hooks */                                                                                                          
}; 



Any ideas how can I fix this?
Maybe I have wrong sources, can somebody supply me with adequate link?

What's interesting is that I can't find definition of apr_pool_t anywhere in sources, just typedef apr_pool_t apr_pool_t;

Looking forward to responses.

Sincerely, Peter.

PS: I know that sources from httpd devel are in wrong directory on first, but I copied them to the httpd sources folder. 
I'm writing on fedora.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] writing modules - missing sources?

Posted by Eric Covener <co...@gmail.com>.
> mod.c:20:7: error: dereferencing pointer to incomplete type
> mod.c:20:21: error: dereferencing pointer to incomplete type
> apxs:Error: Command failed with rc=65536
> static void x_register_hooks(apr_pool_t* tt)
>     tt->in_header=tt->in_header;//this is that line 20!
>

The compiler seems right. The fields in an apr_pool_t are not part of
the API (and even if they were "in_header" isn't one of them)

You should start with an example module or a simple module from the
httpd source tree.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] writing modules - missing sources?

Posted by Piotr Suwala <on...@vp.pl>.
Thank u for reply guys! 

On Sun, 2013-01-13 at 10:03 -0500, Yehuda Katz wrote:
> On Sun, Jan 13, 2013 at 6:44 AM, Piotr Suwala <on...@vp.pl> wrote:
>         I've got question for you concerned with writing modules for
>         apache:
>         How can I start doing it? Where can I find any helpful info
>         for this, tutorials about configuring enviroment?
> 
> 
> I do not have the answer to your specific question, but for
> information about creating modules in general, I recommend 
> The Apache Modules Book: Application Development with Apache by Nick
> Kew (ISBN 978-0132409674). (Nick can be frequently found on this
> list.)
> 
> 
> - Y



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] writing modules - missing sources?

Posted by Yehuda Katz <ye...@ymkatz.net>.
On Sun, Jan 13, 2013 at 6:44 AM, Piotr Suwala <on...@vp.pl> wrote:

> I've got question for you concerned with writing modules for apache:
> How can I start doing it? Where can I find any helpful info for this,
> tutorials about configuring enviroment?
>

I do not have the answer to your specific question, but for information
about creating modules in general, I recommend
The Apache Modules Book: Application Development with Apache by Nick Kew
(ISBN 978-0132409674). (Nick can be frequently found on this list.)

- Y

Re: [users@httpd] writing modules - missing sources?

Posted by Daniel Gruno <ru...@cord.dk>.
On 01/13/2013 12:44 PM, Piotr Suwala wrote:
> Hello.
> 
> I've got question for you concerned with writing modules for apache:
> How can I start doing it? Where can I find any helpful info for this, tutorials about configuring enviroment?
> 
We have a brief guide on writing modules for httpd 2.4 at
http://httpd.apache.org/docs/trunk/developer/modguide.html

As said in another post, you might want to check out Nick's book also.

With regards,
Daniel.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org