ObjectWeb Consortium
Search ObjectWeb Mail Archive: 

Advanced Search - Powered by Google


Mail Archive Home | enhydra List | September 2005 Index

<--  Date Index  --> <--  Thread Index  -->

Re: [enhydra] Possible Bug in MultiPartMimeInputStream


Hi,

we have applied your patch (regarding multipart request headers encoding)!

In Enhydra 5, we have integrated your adaptation directly ("HTTPUtils" based encoding).
I've already committed changes to public CVS!

In Enhydra 6 (EAF), we have implemented a bit different approach (with idea to enable application (not EAF) specific encoding option). I've adapted 'MultipartMimeInputStream' and 'MultipartMimeInput' implementation.

'MultipartMimeInputStream':
- has additional, encoding dependent, constructor (with your patch applied - MIME header initialization).

protected MultipartMimeInputStream (BMByteSearchStream source,
           BMByteSearch sep, String encoding) throws IOException,
           MimeEOFException {
...
}

'MultipartMimeInput':
This 'MultipartMimeInputStream' constructor is meant to be called only from 'MultipartMimeInput'! Therefore, I had to make additional adaptation and implement, encoding dependent, 'MultipartMimeInput.nextPart' method (that should be used from your application code).

public MultipartMimeInputStream nextPart(String encoding)
           throws MimeException {
...
}

Those changes will be included in next EAF (Enhydra) release!

Thank you for your contribution!

Regards,
 Slobodan Vujasinovic
Enhydra Development Team



João Paulo Ribeiro wrote:

Hi!

I found something that i think is bug: in MultipartMimeInputStream when
reading the headers of a multipart request, the byte are autamatically
transformed in String instead of using the correct encoding. This happen
in 5.4.1 and the last enhydra version from CVS (6.5.1?).
The problem is the headers in multipart request have usefull information
like the file name. Not using the correct encoding to transform the
bytes to a String, made the file name appears wtih strange chars on it.

For enhydra 5.4.1 a made a little patch: i just changed one line in the
constructor and added the necessary import.
I changed the line:
String line = new String(bytesToChars(lineBuf,0,n));
to:
String line = new String(lineBuf,0,n,HttpUtils.ENCODING);
And added the:
import javax.servlet.http.HttpUtils;

Now it works well. :)

For 6.5.1 i did not made a patch but it should be something similar like
changing the same line to:
String line = new String(lineBuf,0,n,
comms.request.getHttpServletRequest().getCharacterEncoding());
and add the necessary imports.

I attached the diff for 5.4.1.

I hope this can be usefull.

Best regards.
João Paulo Ribeiro

------------------------------------------------------------------------

32d31
< import javax.servlet.http.HttpUtils;
142c141
<             String line = new String(lineBuf,0,n,HttpUtils.ENCODING);
---
            String line = new String(bytesToChars(lineBuf,0,n));
------------------------------------------------------------------------


--
You receive this message as a subscriber of the enhydra@xxxxxxxxxxxxx mailing 
list.
To unsubscribe: mailto:enhydra-unsubscribe@xxxxxxxxxxxxx
For general help: mailto:sympa@xxxxxxxxxxxxx?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws



<--  Date Index  --> <--  Thread Index  -->

Reply via email to:

Powered by MHonArc.

Copyright © 1999-2005, ObjectWeb Consortium | contact | webmaster.