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

NullPointerException when Host header is not defined in HTTP/1.0 requests #5734

Closed
syntonyze opened this issue Nov 26, 2020 · 1 comment
Closed

Comments

@syntonyze
Copy link

Jetty version

jetty-9.4.32.v20200930

Java version

openjdk version "11.0.8" 2020-07-14
OpenJDK Runtime Environment (build 11.0.8+11)
OpenJDK 64-Bit Server VM (build 11.0.8+11, mixed mode)

OS type/version

MacOS Catalina 10.15.7

Description

I believe change [1] might have introduced a regression.

HTTP/1.0 does not require a Host: header, however, when such an HTTP request is made jetty throws a NullPointerException.

This is the stacktrace of the error:

2020-11-24T16:14:16.676+01:00	java.lang.NullPointerException
2020-11-24T16:14:16.676+01:00	at org.eclipse.jetty.server.ForwardedRequestCustomizer.customize(ForwardedRequestCustomizer.java:523)
2020-11-24T16:14:16.676+01:00	at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:379)
2020-11-24T16:14:16.676+01:00	at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:556)
2020-11-24T16:14:16.676+01:00	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:375)
2020-11-24T16:14:16.676+01:00	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:273)
2020-11-24T16:14:16.676+01:00	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
2020-11-24T16:14:16.676+01:00	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
2020-11-24T16:14:16.676+01:00	at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
2020-11-24T16:14:16.676+01:00	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336)
2020-11-24T16:14:16.676+01:00	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313)
2020-11-24T16:14:16.676+01:00	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171)
2020-11-24T16:14:16.676+01:00	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:129)
2020-11-24T16:14:16.676+01:00	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:375)
2020-11-24T16:14:16.676+01:00	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:773)
2020-11-24T16:14:16.676+01:00	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:905)
2020-11-24T16:14:16.676+01:00	at java.base/java.lang.Thread.run(Thread.java:834)

This is very likely to happen through haproxy's health checks requests[2], which are not setting any header by default, not even the Host header.

[1]ac42cbd#diff-86a904c7dd1271f369ee7e75efbdcc7a1131708dad3df125327faa31a3c81c5eR508

[2]https://cbonte.github.io/haproxy-dconv/1.7/configuration.html#option%20httpchk

@joakime
Copy link
Contributor

joakime commented Nov 26, 2020

Duplicate of #5443
Fixed in Jetty 9.4.33.v20201020

@joakime joakime closed this as completed Nov 26, 2020
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

No branches or pull requests

2 participants