Hi all, I have a problem with HTTP head requests and mod_perl. I have been looking at the docs, searching google newsgroup archive but I couldn't find anything thus you are my very last hope ;-)
In order to show what the problem is, I have set up two simple identical 'Hello World' type CGI scripts on my machine. One is running under Apache::Registry, the other is running as a plain old CGI. Here is what I get: not_mod_perl test (plain CGI, everything works fine) ================= [root@frogette /]# lynx --dump http://not_mod_perl Hello World! [root@frogette /]# lynx --dump -head http://not_mod_perl HTTP/1.1 200 OK Date: Fri, 23 Nov 2001 11:22:37 GMT Server: Apache/1.3.19 (Unix) mod_perl/1.25 Connection: close Content-Type: text/plain mod_perl_test (mod_perl, headers are fubar) ============= [root@frogette /]# lynx --dump http://mod_perl Hello World! [root@frogette /]# lynx --dump --head http://mod_perl HTTP/1.1 200 OK Date: Fri, 23 Nov 2001 11:24:50 GMT Server: Apache/1.3.19 (Unix) mod_perl/1.25 Connection: close Content-Type: text/plain Hello World! PROBLEM HERE A head request should * NOT * return the body of the document Obviously this is very wierd! You can find more details on the config in the attached file. Any ideas on what's going on? Cheers, -- == \______ ===================================================== /\____/\ IT'S TIME FOR A DIFFERENT KIND OF WEB / /\__/\ \ _/_/_/\/\_\_ Jean-Michel Hiver - Software Director \ \ \/*/ / [EMAIL PROTECTED] +44 (0)114 221 4968 \ \/__\/ \/____\ VISIT HTTP://WWW.MKDOC.COM == / ===========================================================
Added these two lines in /etc/hosts =================================== 127.0.0.1 mod_perl 127.0.0.1 not_mod_perl This is the test script, test.cgi ================================= #!/usr/bin/perl print "Content-Type: text/plain\r\n\r\n"; print "Hello World!"; This is /opt/mod_perl/httpd.conf. It is included in my apache httpd.conf ======================================================================== (mod_perl enabled test.cgi) <VirtualHost 127.0.0.1> ServerName mod_perl ServerAdmin root@mod_perl CustomLog /opt/mod_perl/www_combined_log combined ErrorLog /opt/mod_perl/www_error_log Alias / /opt/mod_perl/test.cgi <Directory /opt/mod_perl> SetHandler perl-script PerlHandler Apache::Registry PerlSendHeader On # directives for CGI. These should work everywhere # do not uncomment that bit of text Options ExecCGI AddHandler cgi-script .cgi order allow,deny allow from all AllowOverride none </Directory> </VirtualHost> This is /opt/not_mod_perl/httpd.conf. It is included in my apache httpd.conf ============================================================================ (mod_perl disabled test.cgi) <VirtualHost 127.0.0.1> ServerName not_mod_perl ServerAdmin root@not_mod_perl CustomLog /opt/not_mod_perl/www_combined_log combined ErrorLog /opt/not_mod_perl/www_error_log Alias / /opt/not_mod_perl/test.cgi <Directory /opt/not_mod_perl> # SetHandler perl-script # PerlHandler Apache::Registry # PerlSendHeader On # directives for CGI. These should work everywhere # do not uncomment that bit of text Options ExecCGI AddHandler cgi-script .cgi order allow,deny allow from all AllowOverride none </Directory> </VirtualHost> Added this in /usr/local/apache/conf/httpd.conf Include /opt/mod_perl/httpd.conf Include /opt/not_mod_perl/httpd.conf Restarted apache not_mod_perl test ================= [root@frogette /]# lynx --dump http://not_mod_perl Hello World! [root@frogette /]# lynx --dump -head http://not_mod_perl HTTP/1.1 200 OK Date: Fri, 23 Nov 2001 11:22:37 GMT Server: Apache/1.3.19 (Unix) mod_perl/1.25 Connection: close Content-Type: text/plain mod_perl_test ============= [root@frogette /]# lynx --dump http://mod_perl Hello World! [root@frogette /]# lynx --dump --head http://mod_perl HTTP/1.1 200 OK Date: Fri, 23 Nov 2001 11:24:50 GMT Server: Apache/1.3.19 (Unix) mod_perl/1.25 Connection: close Content-Type: text/plain Hello World! PROBLEM HERE A head request should * NOT * return the body of the document