Fixed NPE introduced by #10618.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
Simone Bordet 2023-10-02 15:53:40 +02:00
parent 0981c22c33
commit 27865d29b4
No known key found for this signature in database
GPG Key ID: 1677D141BCF3584D
1 changed files with 5 additions and 5 deletions

View File

@ -616,11 +616,11 @@ public class HttpChannelState implements HttpChannel, Components
try try
{ {
if (!Request.getPathInContext(_request).startsWith("/") && String pathInContext = Request.getPathInContext(request);
!HttpMethod.PRI.is(request.getMethod()) && if (pathInContext != null && !pathInContext.startsWith("/"))
!HttpMethod.CONNECT.is(request.getMethod()) &&
!HttpMethod.OPTIONS.is(request.getMethod()))
{ {
String method = request.getMethod();
if (!HttpMethod.PRI.is(method) && !HttpMethod.CONNECT.is(method) && !HttpMethod.OPTIONS.is(method))
throw new BadMessageException("Bad URI path"); throw new BadMessageException("Bad URI path");
} }