* abort download, when proxy connection is closed

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5409 6c8d7289-2bf4-0310-a012-ef5d649a1542
This commit is contained in:
f1ori 2008-12-23 11:30:24 +00:00
parent bb935fdbb0
commit 73c8a0839c
2 changed files with 19 additions and 0 deletions

View File

@ -123,6 +123,15 @@ public class JakartaCommonsHttpResponse {
return new httpdByteCountInputStream(inStream, incomingAccountingName);
}
/**
* Abort Download, e. g. when proxy connection was closed
* Do not forget to call closeStream afterwards...
*
*/
public void abort() {
method.abort();
}
/*
* (non-Javadoc)
*

View File

@ -61,6 +61,7 @@ import java.net.InetAddress;
import java.net.MalformedURLException;
import java.net.NoRouteToHostException;
import java.net.Socket;
import java.net.SocketException;
import java.net.SocketTimeoutException;
import java.net.UnknownHostException;
import java.nio.charset.Charset;
@ -665,6 +666,9 @@ public final class httpdProxyHandler {
chunkedOut.flush();
}
} // end hasBody
} catch(SocketException se) {
// client cut proxy connection, abort download
res.abort();
} finally {
// if opened ...
if(res != null) {
@ -1090,6 +1094,9 @@ public final class httpdProxyHandler {
chunked.finish();
}
outStream.flush();
} catch(SocketException se) {
// connection closed by client, abort download
res.abort();
} finally {
// if opened ...
if(res != null) {
@ -1383,6 +1390,9 @@ public final class httpdProxyHandler {
forceConnectionClose(conProp);
return;
}
} catch (SocketException se) {
// connection closed by client, abort download
response.abort();
} catch (final Exception e) {
throw new IOException(e.getMessage());
} finally {