mirror of https://github.com/shred/acme4j
Log HTTP headers in debug mode
parent
e6cfc3d159
commit
97d0856a04
|
@ -91,6 +91,8 @@ public class DefaultConnection implements Connection {
|
||||||
|
|
||||||
conn.connect();
|
conn.connect();
|
||||||
|
|
||||||
|
logHeaders();
|
||||||
|
|
||||||
return conn.getResponseCode();
|
return conn.getResponseCode();
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
throw new AcmeException("API access failed", ex);
|
throw new AcmeException("API access failed", ex);
|
||||||
|
@ -131,6 +133,8 @@ public class DefaultConnection implements Connection {
|
||||||
conn.setFixedLengthStreamingMode(outputData.length);
|
conn.setFixedLengthStreamingMode(outputData.length);
|
||||||
conn.connect();
|
conn.connect();
|
||||||
|
|
||||||
|
logHeaders();
|
||||||
|
|
||||||
try (OutputStream out = conn.getOutputStream()) {
|
try (OutputStream out = conn.getOutputStream()) {
|
||||||
out.write(outputData);
|
out.write(outputData);
|
||||||
}
|
}
|
||||||
|
@ -313,4 +317,18 @@ public class DefaultConnection implements Connection {
|
||||||
return Base64Url.decode(nonceHeader);
|
return Base64Url.decode(nonceHeader);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Log all HTTP headers in debug mode.
|
||||||
|
*/
|
||||||
|
private void logHeaders() {
|
||||||
|
if (LOG.isDebugEnabled()) {
|
||||||
|
Map<String, List<String>> headers = conn.getHeaderFields();
|
||||||
|
for (String key : headers.keySet()) {
|
||||||
|
for (String value : headers.get(key)) {
|
||||||
|
LOG.debug("HEADER {}: {}", key, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue