mirror of
https://github.com/yacy/yacy_search_server.git
synced 2024-09-19 00:01:41 +02:00
* 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:
parent
bb935fdbb0
commit
73c8a0839c
|
@ -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)
|
||||
*
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue
Block a user