-
Notifications
You must be signed in to change notification settings - Fork 536
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
NPE when computing absoluteURI and host is not passed and forwarded headers are present #2511
Comments
@cescoffier thanks very much for the reproducer, it allows to quickly spot the problem It looks like the problem is not related to HTTP/2, but to public static HostAndPortImpl parseHostAndPort(String s, int schemePort) { // s is 127.0.0.1.nip.io:8443
int pos = parseHost(s, 0, s.length()); // pos is 9 because parseHost computes the host to be 127.0.0.1
if (pos == s.length()) {
return new HostAndPortImpl(s, schemePort);
}
if (pos < s.length() && s.charAt(pos) == ':') { // expected colon but finds dot
String host = s.substring(0, pos);
int port = 0;
while (++pos < s.length()) {
int digit = parseDigit(s, pos, s.length());
if (digit == -1) {
return null;
}
port = port * 10 + digit;
}
return new HostAndPortImpl(host, port);
}
return null; // returns null
} Or did I miss something? |
@cescoffier I've filed eclipse-vertx/vert.x#4947 When it's fixed, we'll see if there's another problem or not (unless you have more info in the meantime). |
@cescoffier I've tried again with this patch and the problem goes away (the browser displays The reproducer was missing So, as far as I can see, there is no issue with HTTP/2, only a bug in Vert.x core related to nip hosts parsing. If you can provide more info, I'll take another look. Otherwise, I'll close this issue after merging eclipse-vertx/vert.x#4947 |
@tsegismont Thanks! I merged the PR. |
Closing as this is a Vert.x core bug, fixed upstream eclipse-vertx/vert.x#4947 |
Browsers using HTTP/2 do not pass the
host
anymore.This breaks the computation of the absolute URI when using Vert.x Web.
Note that it works when using the bare HTTP server (it replaces the host with 0.0.0.0).
Here is a reproducer:
openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -keyout key.pem -out cert.pem
jbang HostNpe.java
The stack trace is:
Related to quarkusio/quarkus#37045.
The text was updated successfully, but these errors were encountered: