RFR: 8272758: Improve HttpServer to avoid partial file name matches while mapping request path to context path
Volkan Yazici
vyazici at openjdk.org
Fri Jan 16 08:18:59 UTC 2026
On Fri, 16 Jan 2026 08:07:48 GMT, Volkan Yazici <vyazici at openjdk.org> wrote:
> Currently `HttpServer` allows matching a request path `/foobar` to context path `/foo`. Replace this surprising behaviour with a safer approach by disallowing partial file name matches.
>
>
> | Request path
> Context +------+-------+----------+---------
> path | /foo | /foo/ | /foo/bar | /foobar
> ---------+------+-------+----------+---------
> / | Y | Y | Y | Y
> /foo/ | N | Y | Y | N
test/jdk/java/net/httpclient/PlainProxyConnectionTest.java line 1:
> 1: /*
Surprisingly, this is *the only test* that failed due to this change, and, IMHO, this is a typo in the test. That is, the test author actually wanted to introduce the `x` prefix to the URI to exactly avoid the problem we're trying to solve in this PR, yet he/she unintentionally fell into the trap.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/29264#discussion_r2697436911
More information about the net-dev
mailing list