eclipse-vertx / vert.x

Vert.x is a tool-kit for building reactive applications on the JVM
http://vertx.io
Other
14.26k stars 2.07k forks source link

5204 reject missing host #5205

Closed NilsRenaud closed 4 months ago

NilsRenaud commented 4 months ago

An HTTP/1.1 message MUST be rejected with an HTTP 400 error code when no Host header is present. See https://datatracker.ietf.org/doc/html/rfc9112#section-3.2

See https://github.com/eclipse-vertx/vert.x/issues/5204 for details.

NilsRenaud commented 4 months ago

I've not added any tests since I'm not really sure it's the right place to have this check. Maybe we could add a new place such as verifyRequest() to handle such things. Any thoughts ?

vietj commented 4 months ago

https://github.com/vert-x3/vertx-web/pull/2612

NilsRenaud commented 4 months ago

Is there a reason why it's handled in vert.x web rather than Vert.x core ?

vietj commented 4 months ago

a couple of reasons:

We might revisit that later I think.

NilsRenaud commented 4 months ago

Ok, though I would love to have a flag like .permitInvalidInput(boolean) to have 2 versions of Vert.x core:

vietj commented 4 months ago

I think instead we should try in vertx-web to move this code to a validation handler that would be executed first to make things more clear