<commit_before>%%% @author <NAME> <<EMAIL>>
%%% @copyright (C) 2013, <NAME>
%%% @doc
%%% The cowboy handler that makes the multi-request
%%% @end
%%% Created : 14 Nov 2013 by <NAME> <<EMAIL>>

%%% NOTE: It appears that I can't stream a POST response.
%%% I may need to do some funky stuff to stream out the result in the accept callback.

-module(simplox_dummy_handler).

-record(state, {boundary, multirequest, procs=dict:new()}).

-define(CRLF, <<"\r\n">>).
-include_lib("simplox/include/simplox_pb.hrl").

-export([
	 init/3, 
	 rest_init/2,
	 allowed_methods/2,
	 content_types_provided/2, 
	 content_types_accepted/2,
	 resource_exists/2,
	 multirequest_parser/2,
	 echo_parser/2,
	 html_get_response/2,
	 streaming_multipart_response/2,
	 rest_terminate/2
	]).


init(_Transport, _Req, _Opts) ->
    {upgrade, protocol, cowboy_rest}.

rest_init(Req, _Opts) ->
    {ok, Req, #state{}}.

allowed_methods(Req, State) ->
    {[<<"GET">>, <<"POST">>], Req, State}.

content_types_accepted(Req, State) ->
    {[
     {<<"text/plain">>, echo_parser},
     {<<"application/protobuf">>, multirequest_parser}, %% for heroku
     {<<"application/protobuf+vnd.simplox.multirequest">>, multirequest_parser}
    ], Req, State}.
<commit_msg>troubleshooting heroku<commit_after>%%% @author <NAME> <<EMAIL>>
%%% @copyright (C) 2013, <NAME>
%%% @doc
%%% The cowboy handler that makes the multi-request
%%% @end
%%% Created : 14 Nov 2013 by <NAME> <<EMAIL>>

%%% NOTE: It appears that I can't stream a POST response.
%%% I may need to do some funky stuff to stream out the result in the accept callback.

-module(simplox_dummy_handler).

-record(state, {boundary, multirequest, procs=dict:new()}).

-define(CRLF, <<"\r\n">>).
-include_lib("simplox/include/simplox_pb.hrl").

-export([
	 init/3, 
	 rest_init/2,
	 allowed_methods/2,
	 content_types_provided/2, 
	 content_types_accepted/2,
	 resource_exists/2,
	 multirequest_parser/2,
	 echo_parser/2,
	 html_get_response/2,
	 streaming_multipart_response/2,
	 rest_terminate/2
	]).


init(_Transport, _Req, _Opts) ->
    {upgrade, protocol, cowboy_rest}.

rest_init(Req, _Opts) ->
    {ok, Req, #state{}}.

allowed_methods(Req, State) ->
    {[<<"GET">>, <<"POST">>], Req, State}.

content_types_accepted(Req, State) ->
    {[
     {<<"text/plain">>, echo_parser},
     {<<"application/protobuf">>, echo_parser}, %% for heroku
     {<<"application/protobuf+vnd.simplox.multirequest">>, echo_parser}
    ], Req, State}.

{'fraction_non_alphanumeric': 0.17745217745217745, 'fraction_numerical': 0.017094017094017096, 'mean_word_length': 4.366812227074236, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 49, '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': '3820999', 'n_tokens_mistral': 958, 'n_tokens_neox': 880, 'n_words': 201}