<commit_before>%% ===================================================================
%% @author <NAME>
%% @copyright (C): 2014 ACK CYFRONET AGH
%% This software is released under the MIT license 
%% cited in 'LICENSE.txt'.
%% @end
%% ===================================================================
%% @doc: This module requests directed to http and returns a 301 redirect to https.
%% @end
%% ===================================================================
-module(redirect_handler).

-include("logging.hrl").

-export([init/3, handle/2, terminate/3]).


%% init/3
%% ====================================================================
%% @doc Cowboy handler callback, no state is required
-spec init(any(), term(), any()) -> {ok, term(), []}.
%% ====================================================================
init(_Type, Req, _Opts) ->
	?dump(cowboy_req:header(<<"host">>, Req)),
	?dump(cowboy_req:get_path(Req)),
	?dump(cowboy_req:get_path_info(Req)),
	{ok, Req, []}.


%% handle/2
%% ====================================================================
%% @doc Handles a request returning a HTTP Redirect (301 - Moved permanently).
%% @end
-spec handle(term(), term()) -> {ok, term(), term()}.
%% ====================================================================
handle(Req, State) ->
	{ok, Req2} = cowboy_req:reply(200, <<"dupa">>, Req),
  	{ok, Req2, State}.


%% terminate/3
%% ====================================================================
%% @doc Cowboy handler callback, no cleanup needed
-spec terminate(term(), term(), term()) -> ok.
%% ====================================================================
terminate(_Reason, _Req, _State) ->
	ok.<commit_msg>VFS-498, add redirect handler for redirection from http to https<commit_after>%% ===================================================================
%% @author <NAME>
%% @copyright (C): 2014 ACK CYFRONET AGH
%% This software is released under the MIT license 
%% cited in 'LICENSE.txt'.
%% @end
%% ===================================================================
%% @doc: This module requests directed to http and returns a 301 redirect to https.
%% @end
%% ===================================================================
-module(redirect_handler).

-include("logging.hrl").

-export([init/3, handle/2, terminate/3]).


%% init/3
%% ====================================================================
%% @doc Cowboy handler callback, no state is required
-spec init(any(), term(), any()) -> {ok, term(), []}.
%% ====================================================================
init(_Type, Req, _Opts) ->
	try
		?dump(cowboy_req:header(<<"host">>, Req)),
		?dump(cowboy_req:get_path(Req)),
		?dump(cowboy_req:get_path_info(Req))
		catch _:_ ->
			?dump(ehkm)
		end,
	{ok, Req, []}.


%% handle/2
%% ====================================================================
%% @doc Handles a request returning a HTTP Redirect (301 - Moved permanently).
%% @end
-spec handle(term(), term()) -> {ok, term(), term()}.
%% ====================================================================
handle(Req, State) ->
	{ok, Req2} = cowboy_req:reply(200, <<"dupa">>, Req),
  	{ok, Req2, State}.


%% terminate/3
%% ====================================================================
%% @doc Cowboy handler callback, no cleanup needed
-spec terminate(term(), term(), term()) -> ok.
%% ====================================================================
terminate(_Reason, _Req, _State) ->
	ok.
{'fraction_non_alphanumeric': 0.48349124318116565, 'fraction_numerical': 0.012919896640826873, 'mean_word_length': 7.046189376443418, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 26, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4822064', 'n_tokens_mistral': 966, 'n_tokens_neox': 856, 'n_words': 234}