I have a test webserver with a directory test for example -
Im using the .htaccess file and setting "DirectoryIndex om.cgi". om.cgi is a perl script which just returns
a 404 Not found;
#!/usr/bin/perl
#Read request headers
$user_agent = $ENV{"HTTP_USER_AGENT"};
$accept = $ENV{"HTTP_ACCEPT"};
$accept_language = $ENV{"HTTP_ACCEPT_LANGUAGE"};
$content_disposition = $ENV{"HTTP_CONTENT_DISPOSITION"};
$content_type = $ENV{"HTTP_CONTENT_TYPE"};
$content_length = $ENV{"HTTP_CONTENT_LENGTH"};
$referer = $ENV{"HTTP_REFERER"};
%cookie = $ENV{"HTTP_COOKIE"};
$method = $ENV{"REQUEST_METHOD"};
#Check user agent is sent
if ($user_agent)
{
print "Status: 404 Not Found\n";
print "Content-type: text/html\n\n";
print "<html><body> No user agent in request</body></html>\n";
}
So when i make a request to I should get back a 404 and No user agent in request but the cgi script doesn't seem to be working, the code of the cgi script is being displayed on the page. Anyone any ideas
Im using the .htaccess file and setting "DirectoryIndex om.cgi". om.cgi is a perl script which just returns
a 404 Not found;
#!/usr/bin/perl
#Read request headers
$user_agent = $ENV{"HTTP_USER_AGENT"};
$accept = $ENV{"HTTP_ACCEPT"};
$accept_language = $ENV{"HTTP_ACCEPT_LANGUAGE"};
$content_disposition = $ENV{"HTTP_CONTENT_DISPOSITION"};
$content_type = $ENV{"HTTP_CONTENT_TYPE"};
$content_length = $ENV{"HTTP_CONTENT_LENGTH"};
$referer = $ENV{"HTTP_REFERER"};
%cookie = $ENV{"HTTP_COOKIE"};
$method = $ENV{"REQUEST_METHOD"};
#Check user agent is sent
if ($user_agent)
{
print "Status: 404 Not Found\n";
print "Content-type: text/html\n\n";
print "<html><body> No user agent in request</body></html>\n";
}
So when i make a request to I should get back a 404 and No user agent in request but the cgi script doesn't seem to be working, the code of the cgi script is being displayed on the page. Anyone any ideas