Added code to correctly handle HEAD request#688
Conversation
Signed-off-by: Doug Hoard <doug.hoard@gmail.com>
|
cc @fstab @tomwilkie |
fstab
left a comment
There was a problem hiding this comment.
Thanks a lot for the PR. I tried to reproduce the bug, but I could not find a single Java version where the HEAD request doesn't work. Even with Azul's Java 6 it works. Moreover, the current implementation handles headers correctly, so if I run
curl -i --head -H 'Accept: application/openmetrics-text; version=1.0.0; charset=utf-8' http://localhost:9000/metrics
I get the correct Content-type and Content-length.
Are you aware of any Java version where HEAD requests don't work? I would only fix it if it is a real problem.
simpleclient_httpserver/src/main/java/io/prometheus/client/exporter/HTTPServer.java
Outdated
Show resolved
Hide resolved
simpleclient_httpserver/src/main/java/io/prometheus/client/exporter/HTTPServer.java
Outdated
Show resolved
Hide resolved
|
I just saw that #685 is linked here, I commented there as well. |
Signed-off-by: Doug Hoard <doug.hoard@gmail.com>
|
I updated the PR. The issue is around the generation of the warning message. I have updated #685 with specifics. |
fstab
left a comment
There was a problem hiding this comment.
Ok, I see now what was the issue. Yes, it makes sense to fix this. The API of sun.net.httpserver.HttpExchangeImpl.sendResponseHeaders() is really strange, thanks for looking into it.
Signed-off-by: Doug Hoard doug.hoard@gmail.com