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:16:10 UTC 2026


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

-------------

Commit messages:
 - Do exact path prefix matching in `HttpServer`

Changes: https://git.openjdk.org/jdk/pull/29264/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=29264&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8272758
  Stats: 333 lines in 4 files changed: 310 ins; 2 del; 21 mod
  Patch: https://git.openjdk.org/jdk/pull/29264.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/29264/head:pull/29264

PR: https://git.openjdk.org/jdk/pull/29264


More information about the net-dev mailing list