Subject: RE: WebDAV and 404-handling

From: "Eriksson, Michael" <[email-masked]>
Date: Fri, 17 Jan 2003 12:47:53 +0100

Julian,

> I've been looking at the servlet spec (2.4) and the bug reports you cited.
> As far as I understand the topic, the servlet engine allows you to specify
> specfic URIs for error pages, but as you do so, it's your own job to ensure
> that the proper HTTP status is sent.

Correct.

>So if you map 404 response to an error
> page, that error page should send out an HTTP status of 404 as well:

Theoretically, yes. Their might however be pragmatic reasons not do so.
Specifically, Internet Explorer has a configurable setting
("friendly error messages" or similar) that ensures that most users
never see the body sent by the server for a 404. Instead a standard message
builtin in Internet Explorer is displayed.

(Yes, I know what this list thinks about breaking server-side behaviour
to accomodate client-side behaviour, but thats life.)

> "If you point at a webapp resource that *itself* returns a 200 status
> (which is the default behavior for static resources served by the
> file-serving servlet, and which is what JSP pages will return unless you
> do something different inside them), a 200 is what you should see in the
> final response to the client.
> 
> If you want something different, map your error page handlers to a servlet
> that does something different."
> 
> I agree though that this mechanism makes it ridicoulously easy to produce
> broken HTTP responses.

Indeed, until stumpling upon the problem with IE that I mentioned in
my original email, I had no idea about this behaviour.

> > ...
> > Even if the status _is_ set a client that relies on the
> > content of the original body is in difficulties -- because
> > somewhere along the line the assumption was made that it was
> > safe to send a user oriented body.
> > ...
> 
> In which case you shouldn't use the mapping.

If this is an option. But remember that this part relates to the
discussion about the existance of a "user vs. software oriented
assumption". In other words, by using the mapping one effectively
assumes that the output is user oriented.
(That this is, at least potentially, a bad thing is indisputable.)
Cf. my original mail.

[snip]

Thank you for time and help,

Michael

---

From: "Julian Reschke" <[email-masked]>
Date: Fri, 17 Jan 2003 13:13:27 +0100

> to accomodate client-side behaviour, but thats life.)

One could argue that if this is what is configured in IE, this is what the
user should get. One the other hand, there seems to be an easy workaround (I
think sending a response body with more than 500 bytes length).

> (That this is, at least potentially, a bad thing is indisputable.)

IMHO: no. If the process that originally produced the non-2xx status has
supplied a response body, it *always* seems to be wrong to replace it with
something else.

Now GET and 404 is a very simple case because WebDAV doesn't require a
specific response body (how could it?). We may want to dicuss a specific
mime type that a client could stick into the HTTP Accept header to specify
the response body type.

Julian

--
<green/>bytes GmbH -- http://www.greenbytes.de -- tel:+492512807760