Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

MulitpartRequest - Unix

2 views
Skip to first unread message

claire...@reuters.com

unread,
Jan 8, 2001, 12:49:59 PM1/8/01
to
I'm using the MultipartRequest class from the oreilley.servlet package
(http://www.servlets.com/resources/com.oreilly.servlet/) in a servlet I
wrote to upload files through a browser.
I have no problems uploading on NT using JavaWebServer2.0, but when I
try using a Solaris environment together with an iPlanet WebServer, I
get the following error:

java.io.IOException: Corrupt form data: premature ending
at xx.xx.xxxx.utilities.MultipartRequest.readRequest
(MultipartRequest.java, Compiled Code)

indicating that I have already reached the end of file / no data is
being streamed in?? This same error occurs, irrespective of file
type/size, browser type...

Anyone got any ideas??
Thanks,
Claire

Sent via Deja.com
http://www.deja.com/

Robert Lynch

unread,
Jan 8, 2001, 1:23:45 PM1/8/01
to

You might try "converting" a file to unix format with a utility
like dos2unix. I would suspect this is a problem with DOS \r\n vs
Unix \n.

If that works, invoke Plan B. :)

Just a hunch.

Bob L.
--
Robert Lynch-Berkeley CA USA-r...@best.com

dhag...@my-deja.com

unread,
Jan 10, 2001, 5:52:25 PM1/10/01
to claire...@reuters.com
Welcome to the buggy world of iWS. iWS does not examine the
Content-Type of http-POST'ed data and assumes that it can
read the request input stream as if all the contents were
url-encoded as name=value&name2=value2&name3=value3...
So it really mangles a multipart-encoded POST, assuming
everything up to the first equals-sign is the name of the first
parameter (including newlines) and everything up to the next
& or the end of the Content-Length is the value.

Interestingly, we found that avoiding *any* calls to
request.getParameter and friends we could work around this
behavior. If we made sure that our multipart/form-data
parser was the absolute first thing that read from the
request.getInputStream(), we were OK. We stored all the
form params/values as attributes on the request object
with the value of file uploads being the full pathname
of the file on our filesystem where it stored the contents.

-=- D. J.

In article <93cuk3$tqa$1...@nnrp1.deja.com>,

0 new messages