Code Monkey home page Code Monkey logo

Comments (4)

b8b avatar b8b commented on July 20, 2024

RoutingContextImpl.java#83

All requests without host header are rejected with code 400. Technically, for HTTP/1.0 this might not be completely correct.
It is possible to handle such a request with a low level Handler (and implement ugly workaround).

NPE in Router code

This is actually not h2 related. It happens when trying to access RoutingContext#request().authority() from within a failure handler (regardless of allowForward settings).

java.lang.NullPointerException: Cannot invoke "io.vertx.core.net.HostAndPort.host()" because "authority" is null
	at io.vertx.ext.web.impl.ForwardedParser.setHostAndPort(ForwardedParser.java:195)
	at io.vertx.ext.web.impl.ForwardedParser.calculate(ForwardedParser.java:114)
	at io.vertx.ext.web.impl.ForwardedParser.authority(ForwardedParser.java:81)
	at io.vertx.ext.web.impl.HttpServerRequestWrapper.authority(HttpServerRequestWrapper.java:188)
	at TestVertx.testHttp10$lambda$0(TestVertx.kt:76)
	at io.vertx.ext.web.impl.RoutingContextImplBase.unhandledFailure(RoutingContextImplBase.java:235)

The 2 issues are closely related. Documentation for HttpServerRequest#authority() informs explicitly about a nullable return value. HttpServerRequestWrapper#authority() should return null instead of throwing an NPE. Also, I see no strict reason to reject requests with null authority - it should always be handled by the user anyway.

from vertx-web.

tsegismont avatar tsegismont commented on July 20, 2024

Would you like to contribute a fix for this?

from vertx-web.

b8b avatar b8b commented on July 20, 2024

Would you like to contribute a fix for this?

Yes sure. I have created a commit in my fork: b8b@a7edbe4

Is it good to target the 4.x branch with a pull request or should it rather target the master branch?

from vertx-web.

tsegismont avatar tsegismont commented on July 20, 2024

Yes sure. I have created a commit in my fork: b8b@a7edbe4

Thank you !

Is it good to target the 4.x branch with a pull request or should it rather target the master branch?

We need to fix both the 4.x and master branches.

from vertx-web.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.