Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

fixed transferRWI.html 'Read timed out'

danielrd6d9b0f14a86
diff --git a/source/de/anomic/http/httpd.java b/source/de/anomic/http/httpd.java
index 399bf8ed9..b0d008c7c 100644
--- a/source/de/anomic/http/httpd.java
+++ b/source/de/anomic/http/httpd.java
@@ -56,6 +56,7 @@ import org.apache.commons.fileupload.FileUploadException;
import org.apache.commons.fileupload.RequestContext;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.httpclient.ChunkedInputStream;
+import org.apache.commons.httpclient.ContentLengthInputStream;
import de.anomic.data.htmlTools;
import de.anomic.data.userDB;
@@ -877,14 +878,17 @@ public final class httpd implements serverHandler, Cloneable {
* hier muss ARGC gesetzt werden!
* @param args
* @param in
- * @param length
* @return
* @throws IOException
*/
@SuppressWarnings("unchecked")
- public static HashMap<String, byte[]> parseMultipart(final httpRequestHeader header, final serverObjects args, final InputStream in, final int length)
+ public static HashMap<String, byte[]> parseMultipart(final httpRequestHeader header, final serverObjects args, final InputStream in)
throws IOException {
- RequestContext request = new yacyContextRequest(header, in);
+
+ final long clength = header.getContentLength();
+ final InputStream body = (clength > 0) ? new ContentLengthInputStream(in, clength) : in;
+
+ RequestContext request = new yacyContextRequest(header, body);
// check information
if (!FileUploadBase.isMultipartContent(request)) {
@@ -898,6 +902,7 @@ public final class httpd implements serverHandler, Cloneable {
try {
items = upload.parseRequest(request);
} catch (FileUploadException e) {
+ e.printStackTrace();
throw new IOException("FileUploadException " + e.getMessage());
}
diff --git a/source/de/anomic/http/httpdFileHandler.java b/source/de/anomic/http/httpdFileHandler.java
index 3df3cb626..4e887862e 100644
--- a/source/de/anomic/http/httpdFileHandler.java
+++ b/source/de/anomic/http/httpdFileHandler.java
@@ -341,7 +341,7 @@ public final class httpdFileHandler {
if ((requestHeader.containsKey(httpHeader.CONTENT_TYPE)) &&
(requestHeader.get(httpHeader.CONTENT_TYPE).toLowerCase().startsWith("multipart"))) {
// parse multipart
- final HashMap<String, byte[]> files = httpd.parseMultipart(requestHeader, args, body, length);
+ final HashMap<String, byte[]> files = httpd.parseMultipart(requestHeader, args, body);
// integrate these files into the args
if (files != null) {
final Iterator<Map.Entry<String, byte[]>> fit = files.entrySet().iterator();
diff --git a/source/de/anomic/server/serverCore.java b/source/de/anomic/server/serverCore.java
index ae7c03bc7..582cb1c94 100644
--- a/source/de/anomic/server/serverCore.java
+++ b/source/de/anomic/server/serverCore.java
@@ -616,7 +616,7 @@ public final class serverCore extends serverAbstractBusyThread implements server
// listen for commands
listen();
- } catch (final Exception e) {
+ } catch (final IOException e) {
System.err.println("ERROR: (internal) " + e);
} finally {
try {