errors in HTTP stream

Tony Sanders (sanders@bsdi.com)
Thu, 27 May 1993 16:56:43 -0500


If I'm in the middle of sending an HTML document and I get a server error
how should this be handled? The problem is when we have already generated
the HTTP status line and the mime headers and sent part of the document
before we know about the error.

HTTP/1.0 200 Document Follows
MIME-version: 1.0
...
<error happens here>

Right now I just sort of barf some HTML at the client, that includes an
error message, and hope it does the right thing (you might be in the middle
of a header or something).

I know that in general this isn't a big problem (the user figures out
something went wrong soon enough) but it seems like we should be able to
do this a little cleaner.

I was thinking about something like <ERROR>...</ERROR>, which could then
contain relevant facts about the error and local problem reporting
procedures if it was a server error. Clever clients would move the
error to the top and keep all other data intact just in case it's useful
in spite of the error.

You might even use </BODY><ERROR>...</ERROR> so that clients could
resync on the </BODY> in case they are inside of a <H1> or something,
this might make the parser a little easier.

Comments?

--sanders