-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Empty Host
header not supported anymore
#4879
Comments
FTR: correct curl line is |
I tried with latest Vert.x 4.4 branch and 4.x branch with an hello-world HTTP server and it does not happen, can you provide more details ? like the exception or maybe I am missing vertx-web handlers that create this NPE (although this is reported on vertx-core) |
So, it seems to be in Vert.x Web. The NPE is in HostAndPortImpl: public HostAndPortImpl(String host, int port) {
if (host == null) {
throw new NullPointerException(); // Thrown...
}
this.host = host;
this.port = port;
} that line got called from the ForardedPArser of Vert.x Web ( authority = HostAndPort.create(host, port); line 137 ) |
Here is the all in one reproducer: ///usr/bin/env jbang "$0" "$@" ; exit $?
//DEPS io.vertx:vertx-web:4.4.5
import io.vertx.core.Vertx;
import io.vertx.ext.web.Router;
import static java.lang.System.*;
public class VertxHostNpe {
public static void main(String... args) throws Exception {
Vertx vertx = Vertx.vertx();
Router router = Router.router(vertx);
router.get("/").handler(ctx -> {
ctx.response().end("Hello World! " + ctx.request().host());
});
vertx.createHttpServer()
.requestHandler(router)
.listen(8080);
Thread.sleep(100000);
}
} Run it with:
and in another terminal: You will get the NPE I mentioned above:
|
thanks, was missing that |
Describe the bug
Empty
host
header not supported anymoreFails with 500 and an NullPointerException in log.
The text was updated successfully, but these errors were encountered: