Skip to content

Commit

Permalink
Updates after review.
Browse files Browse the repository at this point in the history
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
  • Loading branch information
sbordet committed Jan 11, 2024
1 parent d735933 commit ea5db96
Showing 1 changed file with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -385,13 +385,10 @@ public boolean handle(Request request, Response response, Callback callback) thr
}
else
{
if (isWebSocketUpgrade(request))
if (isWebSocketUpgrade(request) && !isDeliverNonAllowedOriginWebSocketUpgradeRequests())
{
if (!isDeliverNonAllowedOriginWebSocketUpgradeRequests())
{
Response.writeError(request, response, callback, HttpStatus.BAD_REQUEST_400, "origin not allowed");
return true;
}
Response.writeError(request, response, callback, HttpStatus.BAD_REQUEST_400, "origin not allowed");
return true;
}
}

Expand Down Expand Up @@ -449,7 +446,7 @@ private boolean isPreflight(Request request)

private boolean isWebSocketUpgrade(Request request)
{
return request.getHeaders().contains(HttpHeader.UPGRADE, "websocket");
return request.getHeaders().contains(HttpHeader.SEC_WEBSOCKET_VERSION, "13");
}

private void handlePreflightResponse(String origins, Response response)
Expand Down

0 comments on commit ea5db96

Please sign in to comment.