You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by marco <ma...@gmail.com> on 2011/05/16 16:49:18 UTC
[users@httpd] Apache modify source code
Hi all,
I want to ask you if someone have tried to modify apache source code.
Can I modify code after installation or I need to recompile all apache
source files?
P.S: In particular I want to modify http_request.c file (and I want to
insert into it a routine called from ap_process_request() function).
Thanks
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Apache modify source code
Posted by Mark Montague <ma...@catseye.org>.
On May 16, 2011 12:30 , marco <ma...@gmail.com> wrote:
> As you told me, I have read how to use mod_perl. For my goal, as I
> expalin you in the previous mail, I can use mod perl to create an
> handler that will be executed corresponding to any phase of httpRequest.
>
> For example, the */PerlPostRequestHandler /*is executed after the
> apache server receives the http request and it did its parsing. So, in
> this way, when this handler is invoked I can do in it all the things I
> want. But I ask you if this handler is executed in parallel or it is
> executed in a sequential mode?
> Do you think am I on the right?Have you never work with these handler?
I have never done this. Hooks and handlers are executed sequentially,
though: each request is handled by a single thread, and only one thing
is happening for a single request at any given point in time. For your
other mod_perl related questions, please ask on the mod_perl users'
mailing list.
As Eric pointed out, the main advantage of mod_perl is if you're already
very comfortable with Perl or very uncomfortable with C.
--
Mark Montague
mark@catseye.org
Re: [users@httpd] Apache modify source code
Posted by marco <ma...@gmail.com>.
Il 16/05/2011 17.25, Mark Montague ha scritto:
>
> Please don't reply privately (off-list); it deprives other people
> (both now and in the future) from the benefits of the discussion.
>
>
> On May 16, 2011 11:05 , marco <ma...@gmail.com> wrote:
>> I have a LAMP architecure and I want that when an http request must
>> be served, then the apache server (before the request is served) send
>> a signal to a different process (that doesn't belong to apache, for
>> example a process called X). Only after the X process run, Apache can
>> serve the request.
>> So the temporal sequence are:
>> ----->httprequest---->Apache--->Xprocess--->Apache
>>
>> I have seen that http_request.c file manage this situation; for this
>> I want to modify this file.
>>
>> Can you believe that this problem can be solved without modify
>> http_request.c file?
>
> Yes: I believe you could write a module to do this. (I'd have to do
> research to be able to say exactly how, though). The advantage to
> doing this in a module, instead of modifying httpd itself, is lower
> maintenance costs when future versions of Apache HTTP Server are
> released, quicker upgrades, and less confusion of other people (system
> administrators, webmasters) who have to work with your site or
> server. For more information, seek help on the Apache HTTP Server
> third-party module development mailing list.
>
> If you'd like to do this without having to write a full Apache module
> in C, take a look at mod_perl:
> http://perl.apache.org/docs/2.0/user/handlers/intro.html This will
> allow you to tie into the Apache request processing loop from a Perl
> script, rather than from a compiled module. For more information,
> seek help on the mod_perl users' mailing list.
>
> But, are you sure that you need to signal a different process, and
> that what process X does is not something that can be done through
> Apache, or via another mechanism or architecture?
>
> --
> Mark Montague
> mark@catseye.org
>
As you told me, I have read how to use mod_perl. For my goal, as I
expalin you in the previous mail, I can use mod perl to create an
handler that will be executed corresponding to any phase of httpRequest.
For example, the */PerlPostRequestHandler /*is executed after the apache
server receives the http request and it did its parsing. So, in this
way, when this handler is invoked I can do in it all the things I want.
But I ask you if this handler is executed in parallel or it is executed
in a sequential mode?
Do you think am I on the right?Have you never work with these handler?
Thanks
Re: [users@httpd] Apache modify source code
Posted by marco <ma...@gmail.com>.
Il 16/05/2011 17.25, Mark Montague ha scritto:
>
> Please don't reply privately (off-list); it deprives other people
> (both now and in the future) from the benefits of the discussion.
Sorry but I have not done on purpose!
>
>
> On May 16, 2011 11:05 , marco <ma...@gmail.com> wrote:
>> I have a LAMP architecure and I want that when an http request must
>> be served, then the apache server (before the request is served) send
>> a signal to a different process (that doesn't belong to apache, for
>> example a process called X). Only after the X process run, Apache can
>> serve the request.
>> So the temporal sequence are:
>> ----->httprequest---->Apache--->Xprocess--->Apache
>>
>> I have seen that http_request.c file manage this situation; for this
>> I want to modify this file.
>>
>> Can you believe that this problem can be solved without modify
>> http_request.c file?
>
> Yes: I believe you could write a module to do this. (I'd have to do
> research to be able to say exactly how, though). The advantage to
> doing this in a module, instead of modifying httpd itself, is lower
> maintenance costs when future versions of Apache HTTP Server are
> released, quicker upgrades, and less confusion of other people (system
> administrators, webmasters) who have to work with your site or
> server. For more information, seek help on the Apache HTTP Server
> third-party module development mailing list.
>
> If you'd like to do this without having to write a full Apache module
> in C, take a look at mod_perl:
> http://perl.apache.org/docs/2.0/user/handlers/intro.html This will
> allow you to tie into the Apache request processing loop from a Perl
> script, rather than from a compiled module. For more information,
> seek help on the mod_perl users' mailing list.
>
> But, are you sure that you need to signal a different process, and
> that what process X does is not something that can be done through
> Apache, or via another mechanism or architecture?
>
Yes, X is a different process.
Thanks a lot for your answers. Now I see your link!
Bye
> --
> Mark Montague
> mark@catseye.org
>
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Apache modify source code
Posted by Nick Kew <ni...@webthing.com>.
On 16 May 2011, at 16:25, Mark Montague wrote:
> Yes: I believe you could write a module to do this. (I'd have to do research to be able to say exactly how, though). The advantage to doing this in a module, instead of modifying httpd itself, is lower maintenance costs when future versions of Apache HTTP Server are released, quicker upgrades, and less confusion of other people (system administrators, webmasters) who have to work with your site or server. For more information, seek help on the Apache HTTP Server third-party module development mailing list.
Yep, makes sense.
> If you'd like to do this without having to write a full Apache module in C, take a look at mod_perl:
That only really makes sense if you're already using mod_perl.
Or possibly if you're a dab hand with Perl but uncomfortable with C.
--
Nick Kew
Available for work, contract or permanent
http://www.webthing.com/~nick/cv.html
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Apache modify source code
Posted by Mark Montague <ma...@catseye.org>.
Please don't reply privately (off-list); it deprives other people (both
now and in the future) from the benefits of the discussion.
On May 16, 2011 11:05 , marco <ma...@gmail.com> wrote:
> I have a LAMP architecure and I want that when an http request must be
> served, then the apache server (before the request is served) send a
> signal to a different process (that doesn't belong to apache, for
> example a process called X). Only after the X process run, Apache can
> serve the request.
> So the temporal sequence are:
> ----->httprequest---->Apache--->Xprocess--->Apache
>
> I have seen that http_request.c file manage this situation; for this I
> want to modify this file.
>
> Can you believe that this problem can be solved without modify
> http_request.c file?
Yes: I believe you could write a module to do this. (I'd have to do
research to be able to say exactly how, though). The advantage to doing
this in a module, instead of modifying httpd itself, is lower
maintenance costs when future versions of Apache HTTP Server are
released, quicker upgrades, and less confusion of other people (system
administrators, webmasters) who have to work with your site or server.
For more information, seek help on the Apache HTTP Server third-party
module development mailing list.
If you'd like to do this without having to write a full Apache module in
C, take a look at mod_perl:
http://perl.apache.org/docs/2.0/user/handlers/intro.html This will
allow you to tie into the Apache request processing loop from a Perl
script, rather than from a compiled module. For more information, seek
help on the mod_perl users' mailing list.
But, are you sure that you need to signal a different process, and that
what process X does is not something that can be done through Apache, or
via another mechanism or architecture?
--
Mark Montague
mark@catseye.org
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Apache modify source code
Posted by Mark Montague <ma...@catseye.org>.
On May 16, 2011 10:49 , marco <ma...@gmail.com> wrote:
> I want to ask you if someone have tried to modify apache source code.
Yes.
> Can I modify code after installation or I need to recompile all apache
> source files?
Apache HTTP Server is written in C. This means that you need to
recompile anything that is affected by your modification. If you modify
the Apache core (httpd), you will need to recompile that binary. If you
modify an included module, you will need to recompile that module. If
you modify a third party module, then only that third party module will
need to be recompiled. Your software build system ("make" if you are
using a Unix-like system) will track dependencies and recompile only the
affected source files; you will then need to install the new binaries.
> P.S: In particular I want to modify http_request.c file (and I want to
> insert into it a routine called from ap_process_request() function).
Are you sure you need to do this, and that what you need to do can't be
done via a module such as mod_rewrite, mod_headers, mod_include, or
mod_perl? (note that mod_perl has access to the internal Apache request
processing hooks).
--
Mark Montague
mark@catseye.org
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org