Skip Navigation

Resolved

Automatic Hyperlinking HTML Components

Automatic Hyperlinking of Text Components

Completed Polls

Events on Print Version

File uploads with dots in filenames

Headlines Component Document Selection

Headlines Component Leaf Documents

helo email checking

HTTP Headers

Internal link domain mixing

Linking to File Attachments

Listings Component

mailto: links

Personalised events listings

Spam Proofing

Text Component pre text

Translated Template Fragments

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

Not a bug

The “errors” documented here are not actually errors they are just the extra data that chunked transfer encoding adds, this was pointed out by Henrik Nordstrom:

On Fri 09-Jun-2006 at 01:30:30PM +0200, Henrik Nordstrom wrote:

Googled for something else and found this page…

http://www.mkdoc.org/bugs/stable/normal/http-headers/

not sure if mailing you is the correct method of contact, but it is what I found on the page.. Not interested in mkdoc as such, but I thought I might explain what those strange looking lines is about.

there is nothing wrong with those extra lines in the responses. Those responses are simply encoded using chunked transfer encoding as indicated in the header “Transfer-Encoding: chunked”. chunked transfer encoding is a key component of HTTP/1.1 allowing for persistent HTTP connections even when the content-length is not known.

Rough description of the format:

NNN<newline>
[0xNNN octets of data]
<newline>
[repeat for as many chunks of data there is..]
0<newline>
<newline>
END OF RESPONSE

There is some fineprint not included above such as trailer headers. See RFC2616 for full details if you are interested.

http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.6.1

Extra line before the document

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:24:38
MKDoc Ltd., 31 Psalter Lane, Sheffield, S11 8YL, UK.
Copyright © 2001-2005 MKDoc Ltd.