On Wed, 21 Jan 2026 12:21:42 GMT, Volkan Yazici <[email protected]> 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 incrementally with one additional 
> commit since the last revision:
> 
>   Add property to switch between prefix matching schemes

src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpServer.java line 
287:

> 285:      * this context path matches request paths {@code /foo},
> 286:      * {@code /foo/bar}, or {@code /foobar}. Others may use <em>path 
> prefix
> 287:      * matching</em> where {@code /foo} matches only request paths

Suggestion:

     * matching</em> where {@code /foo} matches request paths

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29264#discussion_r2742167398

Reply via email to