How can i include the source file that i made in the Apache
server comiplation process, while the module is still built as a
DSO by using apxs
You would have to declare the structure in a header file, which
you #include in both your module source code and in the Apache
source file where you reference it. Then, when you configure
httpd, you can tell it where your header file lives by passing an
environment variable, like:
CFLAGS="-I/path/to/your/module/source" ./configure ...
Thanks a lot to your kindly reply. The structure is declared in the
header file, however, it is initialized in the C source file(.c)
in the module part during the process of create_server_config. If
i just include the header file, will it work?
Please let me describe what i want to do in a bit more detail.
Actually i try to implement a different layer to handle http
request&response. In the module part, in the header file i will
declare and in the c source file i will initialize a socket
structure that is different from the normal tcp socket structure.
(ap_listen_rec *ap_listeners). This new socket structure will be
used in the prefork.c & pollset.c during the polling procedure.
That is why i have to include the source file in the comiplation
procedure. What should be the best way to handle this situation?
After the polling process, if the tcp socket is selected, then the
normal procedure handling the http request will be followed.
(ap_run_create_connection,ap_process_connection). If another type
of socket that is implemented by me is selected then one module in
my module will be called. The data will be read from this socket
and parsed to the normal http request. Then I will try to call the
(ap_rn_pre_connection,ap_run_process_connection) hook again. Before
sending back the resources, i will try to patch them back to the
data structure that is suitable for my layer's communication and
send it back. I am now just in the step implementing the new
polling procedure. Would you please give me some comments that will
be helpful for me to realize the goal(any comments will be
beneficial both in the polling process and the whole feature)?
It sounds almost like you might want to write your own MPM, and
incorporate your code and data structure into that instead of
calling back to another module.
Actually i am not planning writing my own MPM, because i still need the tcp
socket to handle the http request coming by normal way. I just modify part
of code in prefork.c & pollset.c to modify the way in polling process. I
haven't seen any reason to write a totally new MPM. Or you think that it is
necessary?
<..>
I just wonder if i successfully realize this feature. Is it
possible to include the modification to the new release of Apache
http server.
We welcome contributions to Apache, and have a page of guidelines
for contributors:
http://httpd.apache.org/dev/patches.html
However, I would like to add some remarks that are my personal
opinion, but I think reflect the attitude of the project
contributors:
* We can only consider contributions in the form of source code. We
can encourage ideas, but cannot make a decision based on anything
but code patches
* For us to accept a patch, we will consider whether it serves a
general
need, and whether it will be used by Apache users other than
yourself
* We will also look at the design and implementation of the patch,
and
how cleanly it applies to Apache (hint: making APR dependent on
httpd would not be a good idea, see below)
* Apache 2.2.x is a stable/maintenance branch, and we are not
putting
any new features into it. New features and improvements go into
the
development trunk at:
http://svn.apache.org/repos/asf/httpd/httpd/trunk
* Finally, if the patch is large, or implements a significant new
idea,
we need to be certain that it can be maintained. This means that
we
need to fully understand what it does and how it works, or be
sure
that the contributor is an active member of the development
community. Anyone can become part of the development community by
participating in the dev@httpd.apache.org mailinglist, submitting
patches to fix bugs, testing releases and generally participating
in the discussion. To judge whether someone is an active
contributor,
we look back at their past submissions and contributions
I will try to dedicate more time to apache developing. Hope the
implementation can be finished asap.
Regarding the header problem you describe in your other message, it
looks like you included your module header file in an APR source
file, and your build failed when compiling part of APR. This
happened because the APR build couldn't find the httpd headers that
your header file includes... when you look back at the build output
you posted you'll see that there is no reference to include
directories under httpd. The -I./include applies to srclib/apr/
include, because that is where that build happens. You would
probably better include those httpd headers from your C source file
than from your header file.
Also, APR, the Apache Portable Runtime, is a library that is called
(extensively) by the Apache source, but it is completely separate
from httpd itself, and only bundled with httpd releases for
convenience. APR knows nothing about the applications (like httpd)
that use it, and this must remain so because of the code design.
Thanks a lot for your comment. It is just the problem that i have. I also
found i can not use AP_DECLARE_HOOK or AP_IMPLEMENT_RUN_FIRST, this kind of
hook stuff in module. I have to make couple of new hooks. Now i put the
declaration AP_DECLARE_HOOK in http_connection.h together with similar
create_connection, process_connection hook. And put AP_IMPLEMENT_RUN_FIRST
in the place where i use it.(e.g. prefork.c). At leaset now the compilation
process passed. I have to check whether it actally works.
Again, thanks a lot for your hint. They are really helpful!
br
frankie
_________________________________________________________________
与联机的朋友进行交流,请使用 MSN Messenger: http://messenger.msn.com/cn