HttpClient: Remove retrying of requests.

This commit is contained in:
Andreas Schildbach 2018-12-14 00:20:34 +01:00
parent 0da46fe14d
commit e1db556f8f

View file

@ -1,5 +1,5 @@
/* /*
* Copyright 2015 the original author or authors. * Copyright the original author or authors.
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -168,9 +168,6 @@ public final class HttpClient {
checkNotNull(callback); checkNotNull(callback);
checkNotNull(url); checkNotNull(url);
int tries = 3;
while (true) {
final Request.Builder request = new Request.Builder(); final Request.Builder request = new Request.Builder();
request.url(url); request.url(url);
request.headers(Headers.of(headers)); request.headers(Headers.of(headers));
@ -247,9 +244,6 @@ public final class HttpClient {
throw new InternalErrorException(url, bodyPeek); throw new InternalErrorException(url, bodyPeek);
} else { } else {
final String message = "got response: " + responseCode + " " + response.message(); final String message = "got response: " + responseCode + " " + response.message();
if (tries-- > 0)
log.info("{}, retrying...", message);
else
throw new IOException(message + ": " + url); throw new IOException(message + ": " + url);
} }
} finally { } finally {
@ -257,7 +251,6 @@ public final class HttpClient {
response.close(); response.close();
} }
} }
}
private static final Pattern P_REDIRECT_HTTP_EQUIV = Pattern.compile( private static final Pattern P_REDIRECT_HTTP_EQUIV = Pattern.compile(
"<META\\s+http-equiv=\"?refresh\"?\\s+content=\"\\d+;\\s*URL=([^\"]+)\"", Pattern.CASE_INSENSITIVE); "<META\\s+http-equiv=\"?refresh\"?\\s+content=\"\\d+;\\s*URL=([^\"]+)\"", Pattern.CASE_INSENSITIVE);