On Wed, 4 Mar 2026 10:03:38 GMT, Volkan Yazici <[email protected]> wrote:

> [JDK-8272758] (#29264) incorrectly added the `if (contextPath == '/') { 
> return true; }` fast path to the `HttpServer` context matcher. As a result, 
> `GET foo` started matching context `/`, where it should not. Fix this.
> 
> [JDK-8272758]: https://bugs.openjdk.org/browse/JDK-8272758

src/jdk.httpserver/share/classes/sun/net/httpserver/ContextList.java line 193:

> 191:                 return true;
> 192:             }
> 193: 

This is _"the fix"_.

test/jdk/com/sun/net/httpserver/ContextPathMatcherPathPrefixTest.java line 215:

> 213: 
> 214:             // Connect to the server
> 215:             try (Socket socket = new Socket()) {

I needed to switch from `HttpClient` to `Socket` to be able to send 
_unconventional_ requests such as `OPTIONS *`, `GET`, `GET `, etc.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/30044#discussion_r2882953568
PR Review Comment: https://git.openjdk.org/jdk/pull/30044#discussion_r2882967496

Reply via email to