Apache 1.3 Default 300-307 Server Responses

I had run a testscript (see below) that is a bit whacky but working to gather server responses somehow automatically to get a servers default answers. It is written in PHP and needs curl to be available and a server which supports .htaccess and mod_rewrite (e.g. apache).

For historical reasons I wanted to give it a run on a apache 1.3 (stripped server info in the configuration) and save the output for further reference:

Apache 1.3 Default Server Responses 300-307

=============================================================================
300:
-----------------------------------------------------------------------------
HTTP/1.1 300 Multiple Choices
Date: Thu, 24 Jun 2010 13:59:42 GMT
Server: Apache
Location: http://example.com/
Transfer-Encoding: chunked
Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>300 Multiple Choices</TITLE>
</HEAD><BODY>
<H1>Multiple Choices</H1>
</BODY></HTML>
=============================================================================
301:
-----------------------------------------------------------------------------
HTTP/1.1 301 Moved Permanently
Date: Thu, 24 Jun 2010 13:59:42 GMT
Server: Apache
Location: http://example.com/
Transfer-Encoding: chunked
Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>301 Moved Permanently</TITLE>
</HEAD><BODY>
<H1>Moved Permanently</H1>
The document has moved <A HREF="http://example.com/">here</A>.<P>
</BODY></HTML>
=============================================================================
302:
-----------------------------------------------------------------------------
HTTP/1.1 302 Found
Date: Thu, 24 Jun 2010 13:59:42 GMT
Server: Apache
Location: http://example.com/
Transfer-Encoding: chunked
Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>302 Found</TITLE>
</HEAD><BODY>
<H1>Found</H1>
The document has moved <A HREF="http://example.com/">here</A>.<P>
</BODY></HTML>
=============================================================================
303:
-----------------------------------------------------------------------------
HTTP/1.1 303 See Other
Date: Thu, 24 Jun 2010 13:59:42 GMT
Server: Apache
Location: http://example.com/
Transfer-Encoding: chunked
Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>303 See Other</TITLE>
</HEAD><BODY>
<H1>See Other</H1>
The answer to your request is located <A HREF="http://example.com/">here</A>.<P>
</BODY></HTML>
=============================================================================
304:
-----------------------------------------------------------------------------
HTTP/1.1 304 Not Modified
Date: Thu, 24 Jun 2010 13:59:42 GMT
Server: Apache

=============================================================================
305:
-----------------------------------------------------------------------------
HTTP/1.1 305 Use Proxy
Date: Thu, 24 Jun 2010 13:59:42 GMT
Server: Apache
Location: http://example.com/
Transfer-Encoding: chunked
Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>305 Use Proxy</TITLE>
</HEAD><BODY>
<H1>Use Proxy</H1>
This resource is only accessible through the proxy
http://example.com/<BR>
You will need to configure your client to use that proxy.<P>
</BODY></HTML>
=============================================================================
306:
-----------------------------------------------------------------------------
HTTP/1.1 306 unused
Date: Thu, 24 Jun 2010 13:59:42 GMT
Server: Apache
Location: http://example.com/
Transfer-Encoding: chunked
Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>306 unused</TITLE>
</HEAD><BODY>
<H1>unused</H1>
The server encountered an internal error or
misconfiguration and was unable to complete
your request.<P>
Please contact the server administrator,
 w3bmast3r@dummy-host.example.com and inform them of the time the error occurred,
and anything you might have done that may have
caused the error.<P>
More information about this error may be available
in the server error log.<P>
</BODY></HTML>
=============================================================================
307:
-----------------------------------------------------------------------------
HTTP/1.1 307 Temporary Redirect
Date: Thu, 24 Jun 2010 13:59:42 GMT
Server: Apache
Location: http://example.com/
Transfer-Encoding: chunked
Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>307 Temporary Redirect</TITLE>
</HEAD><BODY>
<H1>Temporary Redirect</H1>
The document has moved <A HREF="http://example.com/">here</A>.<P>
</BODY></HTML>

Testscript: generate.php

Warning: This is a testing script that should be used for testing purposes only. It’s not safe to keep it available for requests by third parties.
<?php
/*
 * generate.php
 *
 * generate server responses via .htaccess generation on apache and reflexive http requests
 *
 * USAGE: request http://yourhost/path/generate.php
 *
 */
header('Content-Type: text/plain;');
?>
Default Server Responses Gathering Script.
<?php

$file = '.htaccess';

$base  = sprintf('http://%s%s/', $_SERVER['SERVER_NAME'], dirname($_SERVER['REDIRECT_URL']));

$codes = range(300, 307);

ob_start();
?>
RewriteEngine On
<?php foreach($codes as $code) { ?>
RewriteRule (<?php echo $code; ?>) http://example.com/ [R=<?php echo $code; ?>,L]
<?php } 

$buffer = ob_get_clean();
file_put_contents($file, $buffer);


foreach($codes as $code) {?>
=============================================================================
<?php echo $code; ?>:
-----------------------------------------------------------------------------
<?php
	$url = sprintf('%s%s', $base, $code);
	
	passthru('curl -i '.$url);
}
?>
This entry was posted in Scripts, Tools and tagged , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s