RFR: 8272758: Improve HttpServer to avoid partial file name matches while mapping request path to context path [v3]

Daniel Fuchs dfuchs at openjdk.org
Wed Feb 4 15:36:23 UTC 2026


On Mon, 2 Feb 2026 20:21:39 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 requiring exact *path prefix matches*.
>> 
>> 
>>          |           Request path
>>  Context +------+-------+----------+---------
>>   path   | /foo | /foo/ | /foo/bar | /foobar
>> ---------+------+-------+----------+---------
>>  /       |   Y  |   Y   |     Y    |    Y
>>  /foo/   |   N  |   Y   |     Y    |    N
>
> Volkan Yazici has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision:
> 
>  - Apply review feedback
>  - Merge remote-tracking branch 'upstream/master' into srvCtxPath
>  - Add property to switch between prefix matching schemes
>  - Do exact path prefix matching in `HttpServer`

I wonder if we will be asked to change the name of the property in the CSR review. We typically do not use the `sun.` prefix for new properties.

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

PR Comment: https://git.openjdk.org/jdk/pull/29264#issuecomment-3848146409


More information about the net-dev mailing list