From 22d12124ee6097ff3a2f3354cfd3dd98b9e57099 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Tue, 5 Dec 2017 14:02:07 +0100 Subject: [PATCH] Fix rabbit_cowboy_redirect and remove unused optional callbacks The handler rabbit_cowboy_redirect was apparently not converted to Cowboy 2. It should work properly now. --- .../src/rabbit_cowboy_redirect.erl | 12 ++---------- .../src/rabbit_web_dispatch_listing_handler.erl | 4 ---- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/deps/rabbitmq_web_dispatch/src/rabbit_cowboy_redirect.erl b/deps/rabbitmq_web_dispatch/src/rabbit_cowboy_redirect.erl index 8312c84919..40aec8539b 100644 --- a/deps/rabbitmq_web_dispatch/src/rabbit_cowboy_redirect.erl +++ b/deps/rabbitmq_web_dispatch/src/rabbit_cowboy_redirect.erl @@ -16,17 +16,9 @@ -module(rabbit_cowboy_redirect). --export([init/3]). --export([handle/2]). --export([terminate/3]). +-export([init/2]). -init(_, Req, RedirectPort) -> - {ok, Req, RedirectPort}. - -handle(Req0, RedirectPort) -> +init(Req0, RedirectPort) -> URI = cowboy_req:uri(Req0, #{port => RedirectPort}), Req = cowboy_req:reply(301, #{<<"location">> => URI}, Req0), {ok, Req, RedirectPort}. - -terminate(_, _, _) -> - ok. diff --git a/deps/rabbitmq_web_dispatch/src/rabbit_web_dispatch_listing_handler.erl b/deps/rabbitmq_web_dispatch/src/rabbit_web_dispatch_listing_handler.erl index 9b2b052e1e..a17e6d1be6 100644 --- a/deps/rabbitmq_web_dispatch/src/rabbit_web_dispatch_listing_handler.erl +++ b/deps/rabbitmq_web_dispatch/src/rabbit_web_dispatch_listing_handler.erl @@ -17,7 +17,6 @@ -module(rabbit_web_dispatch_listing_handler). -export([init/2]). --export([terminate/3]). init(Req0, Listener) -> HTMLPrefix = @@ -35,6 +34,3 @@ init(Req0, Listener) -> end, Req = cowboy_req:reply(200, #{}, [HTMLPrefix, List, HTMLSuffix], Req0), {ok, Req, Listener}. - -terminate(_, _, _) -> - ok.