Hello Martin,

You discovered a serious bug, IMO.

I think converting the body into a string (at readRequestContent()) is not
the best idea. If the body is an XML document, the best thing to do is to
feed the byte stream into the parser and let him decide on the encoding
issue. In this case we do not require the client to send an explicit
encoding.

Only in case of the body is really required as a string (I am personally not
aware of any WebDAV method requiring so), convert the bytes into a String.
Here your default definitely makes sense.

I want to suggest to change the type of requestBody to byte[] or (better)
InputStream. Any objections?

Best regards

Juergen



-----Original Message-----
From: Martin Holz [mailto:[EMAIL PROTECTED] 
Sent: Mittwoch, 5. M�rz 2003 20:21
To: [EMAIL PROTECTED]
Subject: AbstractWebdavMethod encoding bug

Hello,

the slide WebDAV servlet does not handle the XML
body of  a request properly, if the client does not send 
a encoding. Neither cadaver nor DAVExplorer or MS Word 
send an explicit charset.

This means, that the method req.getCharacterEncoding() 
im AbstractWebdavServlet returns null and 
AbstractWebdavServlet assumes the value of the system property
file.encoding - in my case iso-8859-1. This is not, what the
clients wanted. 

The request body of all three clients contains
<?xml version="1.0" ?>, which implies UTF-8.
And they send UTF-8.

According to RFC 2376,section 6.4 slide should 
assume US-ASCII, not ISO-8859-1 or UTF-8.

However assuming UTF-8 may be a better choice, since slide 
MUST interoperate with those clients. Since UTF-8 is a 
superset of US-ASCII, slide would be still very close to the specification.

If you agree, Ingo would change line 446 in 
AbstractWebdavMethod.java (rev 1.6) to 

  if (result == null) result = "UTF-8";


--
Martin Holz     <[EMAIL PROTECTED]>

Softwareentwicklung / Vernetztes Studium - Chemie
FIZ CHEMIE Berlin
Franklinstrasse 11
D-10587 Berlin     



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to