git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5046 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
danielr 17 years ago
parent f2d0bd7790
commit 7e7e6a099a

@ -38,6 +38,7 @@ import java.net.InetAddress;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URLDecoder; import java.net.URLDecoder;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.nio.charset.Charset;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
@ -884,17 +885,14 @@ public final class httpd implements serverHandler, Cloneable {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static HashMap<String, byte[]> parseMultipart(final httpHeader header, final serverObjects args, final InputStream in, final int length) public static HashMap<String, byte[]> parseMultipart(final httpHeader header, final serverObjects args, final InputStream in, final int length)
throws IOException { throws IOException {
// read all data from network in memory RequestContext request = new yacyContextRequest(header, in);
byte[] buffer = serverFileUtils.read(in);
// parse data in memory
RequestContext request = new yacyContextRequest(header, new ByteArrayInputStream(buffer));
// check information // 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 // parse data in memory
FileItemFactory factory = new DiskFileItemFactory(); FileItemFactory factory = new DiskFileItemFactory();
FileUpload upload = new FileUpload(factory); FileUpload upload = new FileUpload(factory);
List<FileItem> items; List<FileItem> items;
@ -904,6 +902,7 @@ public final class httpd implements serverHandler, Cloneable {
throw new IOException("FileUploadException " + e.getMessage()); throw new IOException("FileUploadException " + e.getMessage());
} }
// format information for further usage
final HashMap<String, byte[]> files = new HashMap<String, byte[]>(); final HashMap<String, byte[]> files = new HashMap<String, byte[]>();
int formFieldCount = 0; int formFieldCount = 0;
for (FileItem item : items) { for (FileItem item : items) {

Loading…
Cancel
Save