[iCalendar] Fix httpclient getting stuck with broken requests (#11866)
* [iCalendar] Fix httpclient getting stuck with broken requests Fixes #9827 Signed-off-by: Stefan Triller <github@stefantriller.de>
This commit is contained in:
@@ -102,22 +102,25 @@ class PullJob implements Runnable {
|
|||||||
try {
|
try {
|
||||||
response = asyncListener.get(HTTP_TIMEOUT_SECS, TimeUnit.SECONDS);
|
response = asyncListener.get(HTTP_TIMEOUT_SECS, TimeUnit.SECONDS);
|
||||||
} catch (InterruptedException e1) {
|
} catch (InterruptedException e1) {
|
||||||
logger.warn("Download of calendar was interrupted.");
|
logger.warn("Download of calendar was interrupted: {}", e1.getMessage());
|
||||||
logger.debug("InterruptedException message is: {}", e1.getMessage());
|
request.abort(e1.getCause() != null ? e1.getCause() : e1);
|
||||||
return;
|
return;
|
||||||
} catch (TimeoutException e1) {
|
} catch (TimeoutException e1) {
|
||||||
logger.warn("Download of calendar timed out (waited too long for headers).");
|
logger.warn("Download of calendar timed out (waited too long for headers): {}", e1.getMessage());
|
||||||
logger.debug("TimeoutException message is: {}", e1.getMessage());
|
request.abort(e1.getCause() != null ? e1.getCause() : e1);
|
||||||
return;
|
return;
|
||||||
} catch (ExecutionException e1) {
|
} catch (ExecutionException e1) {
|
||||||
logger.warn("Download of calendar failed.");
|
String msg = e1.getCause() != null ? e1.getCause().getMessage() : "";
|
||||||
logger.debug("ExecutionException message is: {}", e1.getCause().getMessage());
|
logger.warn("Download of calendar failed with ExecutionException: {}", msg);
|
||||||
|
request.abort(e1.getCause() != null ? e1.getCause() : e1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (response.getStatus() != HttpStatus.OK_200) {
|
if (response.getStatus() != HttpStatus.OK_200) {
|
||||||
logger.warn("Response status for getting \"{}\" was {} instead of 200. Ignoring it.", sourceURI,
|
logger.warn("Response status for getting \"{}\" was {} instead of 200. Ignoring it.", sourceURI,
|
||||||
response.getStatus());
|
response.getStatus());
|
||||||
|
request.abort(new IllegalStateException(
|
||||||
|
"Got response status " + response.getStatus() + " while requesting " + sourceURI));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user