]> granicus.if.org Git - ejabberd/commitdiff
Properly process OPTIONS header in http_api for all paths
authorPaweł Chmielowski <pchmielowski@process-one.net>
Mon, 12 Sep 2016 13:38:27 +0000 (15:38 +0200)
committerPaweł Chmielowski <pchmielowski@process-one.net>
Mon, 12 Sep 2016 13:40:38 +0000 (15:40 +0200)
src/mod_http_api.erl

index 73e6f7e4ea54f4a74c41982e3718214e18e3c1d8..95a4ad51ef81e24e0f98a2a9a06ba566884c7ce0 100644 (file)
@@ -259,8 +259,10 @@ process([Call], #request{method = 'GET', q = Data, ip = IP} = Req) ->
         ?DEBUG("Bad Request: ~p ~p", [_Error, erlang:get_stacktrace()]),
         badrequest_response()
     end;
-process([], #request{method = 'OPTIONS', data = <<>>}) ->
+process([_Call], #request{method = 'OPTIONS', data = <<>>}) ->
     {200, ?OPTIONS_HEADER, []};
+process(_, #request{method = 'OPTIONS'}) ->
+    {400, ?OPTIONS_HEADER, []};
 process(_Path, Request) ->
     ?DEBUG("Bad Request: no handler ~p", [Request]),
     json_error(400, 40, <<"Missing command name.">>).