mirror of https://github.com/shred/acme4j
Avoid parameter variable name clashes
parent
26b86b8f72
commit
fb3f56921d
|
@ -52,7 +52,7 @@ public class Connection implements AutoCloseable {
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(Connection.class);
|
private static final Logger LOG = LoggerFactory.getLogger(Connection.class);
|
||||||
|
|
||||||
private final AcmeClientProvider provider;
|
private final AcmeClientProvider provider;
|
||||||
private HttpURLConnection conn;
|
protected HttpURLConnection conn;
|
||||||
|
|
||||||
public Connection(AcmeClientProvider provider) {
|
public Connection(AcmeClientProvider provider) {
|
||||||
this.provider = provider;
|
this.provider = provider;
|
||||||
|
@ -75,12 +75,12 @@ public class Connection implements AutoCloseable {
|
||||||
public void startSession(URI uri, Session session) throws AcmeException {
|
public void startSession(URI uri, Session session) throws AcmeException {
|
||||||
try {
|
try {
|
||||||
LOG.debug("Initial replay nonce from {}", uri);
|
LOG.debug("Initial replay nonce from {}", uri);
|
||||||
HttpURLConnection conn = provider.openConnection(uri);
|
HttpURLConnection localConn = provider.openConnection(uri);
|
||||||
conn.setRequestMethod("HEAD");
|
localConn.setRequestMethod("HEAD");
|
||||||
conn.setRequestProperty("Accept-Charset", "utf-8");
|
localConn.setRequestProperty("Accept-Charset", "utf-8");
|
||||||
conn.connect();
|
localConn.connect();
|
||||||
|
|
||||||
session.setNonce(getNonceFromHeader(conn));
|
session.setNonce(getNonceFromHeader(localConn));
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
throw new AcmeException("Failed to request a nonce", ex);
|
throw new AcmeException("Failed to request a nonce", ex);
|
||||||
}
|
}
|
||||||
|
@ -281,7 +281,7 @@ public class Connection implements AutoCloseable {
|
||||||
* @throws AcmeException
|
* @throws AcmeException
|
||||||
* if the server returned a JSON problem
|
* if the server returned a JSON problem
|
||||||
*/
|
*/
|
||||||
private void throwException() throws AcmeException {
|
protected void throwException() throws AcmeException {
|
||||||
if ("application/problem+json".equals(conn.getHeaderField("Content-Type"))) {
|
if ("application/problem+json".equals(conn.getHeaderField("Content-Type"))) {
|
||||||
Map<String, Object> map = readJsonResponse();
|
Map<String, Object> map = readJsonResponse();
|
||||||
String type = (String) map.get("type");
|
String type = (String) map.get("type");
|
||||||
|
@ -293,14 +293,14 @@ public class Connection implements AutoCloseable {
|
||||||
/**
|
/**
|
||||||
* Extracts a nonce from the header.
|
* Extracts a nonce from the header.
|
||||||
*
|
*
|
||||||
* @param conn
|
* @param localConn
|
||||||
* {@link HttpURLConnection} to read the headers from
|
* {@link HttpURLConnection} to get the nonce from
|
||||||
* @return Nonce
|
* @return Nonce
|
||||||
* @throws AcmeException
|
* @throws AcmeException
|
||||||
* if there was no {@code Replay-Nonce} header, or the nonce was invalid
|
* if there was no {@code Replay-Nonce} header, or the nonce was invalid
|
||||||
*/
|
*/
|
||||||
private static byte[] getNonceFromHeader(HttpURLConnection conn) throws AcmeException {
|
protected byte[] getNonceFromHeader(HttpURLConnection localConn) throws AcmeException {
|
||||||
String nonceHeader = conn.getHeaderField("Replay-Nonce");
|
String nonceHeader = localConn.getHeaderField("Replay-Nonce");
|
||||||
if (nonceHeader == null) {
|
if (nonceHeader == null) {
|
||||||
throw new AcmeException("No replay nonce");
|
throw new AcmeException("No replay nonce");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue