Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added code to correctly handle HEAD request #688

Merged
merged 2 commits into from
Sep 11, 2021

Conversation

dhoard
Copy link
Collaborator

@dhoard dhoard commented Sep 1, 2021

Signed-off-by: Doug Hoard doug.hoard@gmail.com

Signed-off-by: Doug Hoard <doug.hoard@gmail.com>
@dhoard
Copy link
Collaborator Author

dhoard commented Sep 2, 2021

cc @fstab @tomwilkie

Copy link
Member

@fstab fstab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@fstab
Copy link
Member

fstab commented Sep 10, 2021

I just saw that #685 is linked here, I commented there as well.

Signed-off-by: Doug Hoard <doug.hoard@gmail.com>
@dhoard
Copy link
Collaborator Author

dhoard commented Sep 10, 2021

I updated the PR. The issue is around the generation of the warning message. I have updated #685 with specifics.

Copy link
Member

@fstab fstab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@fstab fstab merged commit a125fc3 into prometheus:master Sep 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants