Skip Navigation

Sign Up

If you sign up for an account on this web site you can customise elements of this site and subscribe to an email newsletter.

If you have an account on this web site you may login.

If you have an account on this site but have forgotten your user name and / or your password then you can request an account reminder email.

HTTP Headers

MKDoc doesn't generate HTTP headers the mod_perl way, see: http://perl.apache.org/docs/1.0/guide/porting.html#Generating_correct_HTTP_Hea ders and http://perl.apache.org/docs/general/correct_headers/correct_headers.html

Extra line before the document

*The “errors” documented here are not actually errors they are just the extra data that chunked transfer encoding adds, see http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.6.1*

The easiest way to see the errors is using telnet:

telnet mkdoc.com 80
Trying 195.10.230.124...
Connected to mkdoc.com (195.10.230.124).
Escape character is '^]'.
GET / HTTP/1.1
Host: mkdoc.com
HTTP/1.1 200 OK
Date: Wed, 27 Apr 2005 13:55:18 GMT
Server: Apache/1.3.31 (Unix) mod_throttle/3.1.2 mod_gzip/1.3.26.1a mod_perl/1.29
Vary: *
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8
45a0
<!DOCTYPE html PUBLIC
  "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
...

The odd thing in the example above is the line before the DOCTYPE with 45a0 — what generates this, where is it from?

Extra lines added to error documents

Error documents have extra content added before and after:

telnet mkdoc.com 80
Trying 195.10.230.124...
Connected to mkdoc.com (195.10.230.124).
Escape character is '^]'.
GET /foo/ HTTP/1.1
Host: mkdoc.com
HTTP/1.1 404 Not Found
Date: Wed, 27 Apr 2005 14:05:19 GMT
Server: Apache/1.3.31 (Unix) mod_throttle/3.1.2 mod_gzip/1.3.26.1a mod_perl/1.29
Transfer-Encoding: chunked
Content-Type: text/html; charset=iso-8859-1
108
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>404 Not Found</TITLE>
</HEAD><BODY>
<H1>Not Found</H1>
The requested URL /foo/ was not found on this server.<P>
<HR>
<ADDRESS>Apache/1.3.31 Server at mkdoc.com Port 80</ADDRESS>
</BODY></HTML>
0

The above example is serving the default apache error document, if a custom error document is specified, for example:

ErrorDocument 404 /.static/css/404.html

The there doesn't seem to be a problem on some servers:

telnet www.centre.public.org.uk 80
Trying 195.10.230.124...
Connected to www.centre.public.org.uk (195.10.230.124).
Escape character is '^]'.
GET /foo/ HTTP/1.1
Host: www.centre.public.org.uk
HTTP/1.1 404 Not Found
Date: Wed, 27 Apr 2005 14:10:50 GMT
Server: Apache/1.3.31 (Unix) mod_throttle/3.1.2 mod_gzip/1.3.26.1a mod_perl/1.29
Vary: *
Last-Modified: Tue, 06 Apr 2004 16:10:15 GMT
ETag: "fff7-d57-4072d667"
Accept-Ranges: bytes
Content-Length: 3415
Content-Type: text/html
<!DOCTYPE html PUBLIC
  "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

But there is still the same problem on other servers:

telnet www.helpisathand.webarch.net 80
Trying 212.100.246.252...
Connected to www.helpisathand.webarch.net (212.100.246.252).
Escape character is '^]'.
GET /blah/ HTTP/1.1
Host: www.helpisathand.webarch.net
HTTP/1.1 404 Not Found
Date: Thu, 28 Apr 2005 12:54:01 GMT
Server: Apache/1.3.33 (Unix) mod_perl/1.29
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8
1
15b2
<!DOCTYPE html PUBLIC
  "-//W3C//DTD XHTML 1.0 Transitional//EN"

MKDoc::Apache_Cache

MKDoc::Apache_Cache is alpha software and shouldn't be used for production servers.

If MKDoc::Apache_Cache is used then there are other problems…

telnet www.bndfc.co.uk 8010
Trying 69.28.204.54...
Connected to www.bndfc.co.uk (69.28.204.54).
Escape character is '^]'.
GET /foo/ HTTP/1.1
Host: www.bndfc.co.uk
HTTP/1.1 404 Not Found
Date: Wed, 27 Apr 2005 14:19:28 GMT
Server: Apache
ETag: 1a60c330fb42841e8dcf3cd507a70bfc
Expires: Wed, 27 Apr 2005 14:49:30 GMT
Content-Length: 1
Connection: close
Content-Type: text/html; charset=UTF-8
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>404 Not Found</TITLE>
</HEAD><BODY>
<H1>Not Found</H1>
The requested URL /foo/ was not found on this server.<P>
<P>Additionally, a 404 Not Found
error was encountered while trying to use an ErrorDocument to handle the request.
</BODY></HTML>

The problem here is that the Content-Length is set to 1…

If the request is for gzip compressed content:

telnet www.bndfc.co.uk 8010
Trying 69.28.204.54...
Connected to www.bndfc.co.uk (69.28.204.54).
Escape character is '^]'.
GET /foo/ HTTP/1.1
Host: www.bndfc.co.uk
Accept-Encoding: gzip
HTTP/1.1 404 Not Found
Date: Wed, 27 Apr 2005 14:22:25 GMT
Server: Apache
Content-Encoding: gzip
Vary: Accept-Encoding
ETag: 1a60c330fb42841e8dcf3cd507a70bfc
Expires: Wed, 27 Apr 2005 14:49:30 GMT
Content-Length: 21
Connection: close
Content-Type: text/html; charset=UTF-8
���<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>404 Not Found</TITLE>
</HEAD><BODY>
<H1>Not Found</H1>
The requested URL /foo/ was not found on this server.<P>
<P>Additionally, a 404 Not Found
error was encountered while trying to use an ErrorDocument to handle the request.
</BODY></HTML>

Note the incorrect Content-Length, the small bit of gzipped content before the error document and the Content-Encoding…

Up

This document was last modified by Chris Croome on 2006-06-12 07:00:39
MKDoc Ltd., 31 Psalter Lane, Sheffield, S11 8YL, UK.
Copyright © 2001-2005 MKDoc Ltd.