Subject: HEAD requests in Apache 2.0 - msg#00192
List: apache.mod-perl
Here is something new in Apache 2.0 that's worth your attention.
Apache 2.0 automatically discards the response body for HEAD requests,
so there is no more need to add logic to handle HEAD request unless you
want to save the processing cycles. This was done in order to ensure
that the response headers for GET/POST/... and HEAD will be the same.
Here is a quote from http_protocol.c:ap_http_header_filter
/* [...] The idea is that
* we don't want to send out 0 Content-Lengths if it is a head request.
* This happens when modules try to outsmart the server, and return
* if they see a HEAD request. Apache 1.3 handlers were supposed to
* just return in that situation, and the core handled the HEAD. In
* 2.0, if a handler returns, then the core sends an EOS bucket down
* the filter stack, and the content-length filter computes a C-L of
* zero and that gets put in the headers, and we end up sending a
* zero C-L to the client. We can't just remove the C-L filter,
* because well behaved 2.0 handlers will send their data down the
stack,
* and we will compute a real C-L for the head request. RBB
*/
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --->
http://perl.apache.org
mailto:stas@xxxxxxxxxx http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
Was this page helpful?
Thread at a glance:
Previous Message by Date:
click to view message preview
Re: mod_perl & mod_jk
MATHIHALLI,MADHUSUDAN (HP-Cupertino,ex1) wrote:
Hi,
I'm trying to use mod_perl (1.99-07) with mod_jk (1.2) and Apache
(2.0.43). (and cannot move to 1.99-08 immediately)
When I try starting apache with both mod_perl & mod_jk enabled, I'm seeing
the following error :
$ sudo bin/apachectl start
Syntax error on line 8 of /opt/apache2/conf/mod_jk.conf:
Invalid command 'JkWorkersFile', perhaps mis-spelled or defined by a module
not included in the server configuration
Any ideas what might be happening ?..
You say that it's working fine with 1.99_08, but I don't think anything
significant has been changed in the configuration parsing between _07
and _08. Have you tried stepping through with gdb?
It should be pretty easy to do if you use this script:
http://perl.apache.org/docs/2.0/devel/debug/code/.debug-modperl-register
as discussed here:
http://perl.apache.org/docs/2.0/devel/debug/c.html#Precooked_gdb_Startup_Scripts
You want to break at ap_find_command_in_modules, where the directive is
searched for. It simply goes though the list of registered modules and
asks each module whether it knows this command:
for (modp = *mod; modp; modp = modp->next) {
if (modp->cmds && (cmdp = ap_find_command(cmd_name, modp->cmds))) {
*mod = modp;
return cmdp;
}
}
If you see that mod_jk is not in that list, you have to go back earlier
and see why it failed to get mod_jk into the list. Somewhere around
ap_add_module.
p.s. I use ddd over gdb, which makes the debugging a much easier task.
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@xxxxxxxxxx http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
Next Message by Date:
click to view message preview
Configuring Apache witch Perl
Hi
I try adding name virtual host from LDAP. here is code:
...
foreach $entry ($mesg->all_entries) {
my %config;
$config{ 'servername' } = $entry->get_value('servername');
$config{ 'documentroot' } = $entry->get_value('documentroot');
push @mytab,\%config;
}
$VirtualHost{'www.nethosting.pl'} = \@mytab;
...
I have some problem while apachectl configtest:
package Apache::ReadConfig;
#hashes:
%VirtualHost = (
'www.nethosting.pl' => [
{
'servername' => '...',
'documentroot' => '...'
},
];
]
);
#arrays:
#scalars:
1;
__END__
Syntax OK
Insecure dependency in eval while running with -T switch.
Callback called exit.
What's wrong?
Marek Turczyniak
Previous Message by Thread:
click to view message preview
mod_perl & mod_jk
Hi,
I'm trying to use mod_perl (1.99-07) with mod_jk (1.2) and Apache
(2.0.43). (and cannot move to 1.99-08 immediately)
When I try starting apache with both mod_perl & mod_jk enabled, I'm seeing
the following error :
$ sudo bin/apachectl start
Syntax error on line 8 of /opt/apache2/conf/mod_jk.conf:
Invalid command 'JkWorkersFile', perhaps mis-spelled or defined by a module
not included in the server configuration
Any ideas what might be happening ?..
Thanks
-Madhu
Next Message by Thread:
click to view message preview
Configuring Apache witch Perl
Hi
I try adding name virtual host from LDAP. here is code:
...
foreach $entry ($mesg->all_entries) {
my %config;
$config{ 'servername' } = $entry->get_value('servername');
$config{ 'documentroot' } = $entry->get_value('documentroot');
push @mytab,\%config;
}
$VirtualHost{'www.nethosting.pl'} = \@mytab;
...
I have some problem while apachectl configtest:
package Apache::ReadConfig;
#hashes:
%VirtualHost = (
'www.nethosting.pl' => [
{
'servername' => '...',
'documentroot' => '...'
},
];
]
);
#arrays:
#scalars:
1;
__END__
Syntax OK
Insecure dependency in eval while running with -T switch.
Callback called exit.
What's wrong?
Marek Turczyniak