Skip to content
Snippets Groups Projects
Commit 81867b0b authored by vkovtun's avatar vkovtun
Browse files

SSDM-13579: Added a check in the pre-flight requests (OPTIONS) branch, which...

SSDM-13579: Added a check in the pre-flight requests (OPTIONS) branch, which is required for a DELETE request. This is to make it do a real request check instead of merely accepting everything.
parent 80cba2cd
No related branches found
No related tags found
1 merge request!40SSDM-13578 : 2PT : Database and V3 Implementation - include the new AFS "free"...
...@@ -67,8 +67,22 @@ public class NettyHttpHandler extends ChannelInboundHandlerAdapter ...@@ -67,8 +67,22 @@ public class NettyHttpHandler extends ChannelInboundHandlerAdapter
{ {
if (OPTIONS.equals(request.method())) if (OPTIONS.equals(request.method()))
{ {
final String requestMethod = request.headers().get(HttpHeaderNames.ACCESS_CONTROL_REQUEST_METHOD);
final HttpResponseStatus responseStatus;
if (requestMethod == null)
{
responseStatus = HttpResponseStatus.BAD_REQUEST;
} else if (!allowedMethods.contains(HttpMethod.valueOf(requestMethod)))
{
responseStatus = HttpResponseStatus.METHOD_NOT_ALLOWED;
} else
{
responseStatus = HttpResponseStatus.OK;
}
final FullHttpResponse response = getHttpResponse( final FullHttpResponse response = getHttpResponse(
HttpResponseStatus.OK, responseStatus,
HttpResponse.CONTENT_TYPE_TEXT, HttpResponse.CONTENT_TYPE_TEXT,
new EmptyByteBuf(ByteBufAllocator.DEFAULT), new EmptyByteBuf(ByteBufAllocator.DEFAULT),
0); 0);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment