Only throw AcmeRetryAfterException when there is an actual retry date

pull/30/head
Richard Körber 2016-07-27 23:29:56 +02:00
parent ef7070a3b6
commit 3d6342a917
2 changed files with 10 additions and 6 deletions

View File

@ -188,9 +188,11 @@ public class Authorization extends AcmeResource {
if (rc == HttpURLConnection.HTTP_ACCEPTED) { if (rc == HttpURLConnection.HTTP_ACCEPTED) {
Date retryAfter = conn.getRetryAfterHeader(); Date retryAfter = conn.getRetryAfterHeader();
throw new AcmeRetryAfterException( if (retryAfter != null) {
"authorization is not completed yet", throw new AcmeRetryAfterException(
retryAfter); "authorization is not completed yet",
retryAfter);
}
} }
} catch (IOException ex) { } catch (IOException ex) {
throw new AcmeNetworkException(ex); throw new AcmeNetworkException(ex);

View File

@ -93,9 +93,11 @@ public class Certificate extends AcmeResource {
int rc = conn.sendRequest(getLocation()); int rc = conn.sendRequest(getLocation());
if (rc == HttpURLConnection.HTTP_ACCEPTED) { if (rc == HttpURLConnection.HTTP_ACCEPTED) {
Date retryAfter = conn.getRetryAfterHeader(); Date retryAfter = conn.getRetryAfterHeader();
throw new AcmeRetryAfterException( if (retryAfter != null) {
"certificate is not available for download yet", throw new AcmeRetryAfterException(
retryAfter); "certificate is not available for download yet",
retryAfter);
}
} }
if (rc != HttpURLConnection.HTTP_OK) { if (rc != HttpURLConnection.HTTP_OK) {