fixed 'FileUploadException Stream ended unexpectedly'

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5044 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
danielr 17 years ago
parent 8422ee5ec4
commit bb6a6fc233

@ -873,7 +873,8 @@ public final class httpd implements serverHandler, Cloneable {
* *
* @author danielr * @author danielr
* @since 07.08.2008 * @since 07.08.2008
* @param header hier muss ARGC gesetzt werden! * @param header
* hier muss ARGC gesetzt werden!
* @param args * @param args
* @param in * @param in
* @param length * @param length
@ -881,13 +882,19 @@ public final class httpd implements serverHandler, Cloneable {
* @throws IOException * @throws IOException
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static HashMap<String, byte[]> parseMultipart(final httpHeader header, final serverObjects args, final InputStream in, final int length) throws IOException { public static HashMap<String, byte[]> parseMultipart(final httpHeader header, final serverObjects args, final InputStream in, final int length)
RequestContext request = new yacyContextRequest(header, in); throws IOException {
// read all data from network in memory
byte[] buffer = serverFileUtils.read(in);
// parse data in memory
RequestContext request = new yacyContextRequest(header, new ByteArrayInputStream(buffer));
// check information
if (!FileUploadBase.isMultipartContent(request)) { if (!FileUploadBase.isMultipartContent(request)) {
throw new IOException("the request is not a multipart-message!"); throw new IOException("the request is not a multipart-message!");
} }
// format information for further usage
FileItemFactory factory = new DiskFileItemFactory(); FileItemFactory factory = new DiskFileItemFactory();
FileUpload upload = new FileUpload(factory); FileUpload upload = new FileUpload(factory);
List<FileItem> items; List<FileItem> items;

Loading…
Cancel
Save