diff --git a/rebar.config b/rebar.config index b2dc73e..7f751ba 100755 --- a/rebar.config +++ b/rebar.config @@ -1,4 +1,4 @@ -{relx, [{release, {'MeowMeow', "1.02-prebeta-101120"}, [app]}, +{relx, [{release, {'MeowMeow', "1.02-prebeta-9121"}, [app]}, {dev_mode, true}, {include_erts, false}, {extended_start_script, true} diff --git a/src/app.app.src b/src/app.app.src index 736c967..a0b3241 100755 --- a/src/app.app.src +++ b/src/app.app.src @@ -1,6 +1,6 @@ {application, app, [ {description, "A tiny webserver written in erlang"}, - {vsn, "1.02-prebeta-101120"}, + {vsn, "1.02-prebeta-9121"}, {modules, []}, {registered, [app_sup]}, {applications, [ diff --git a/src/config.hrl b/src/config.hrl index 2a9638c..a4dd42a 100755 --- a/src/config.hrl +++ b/src/config.hrl @@ -6,11 +6,11 @@ %%% @end %%% Created : 26. авг. 2020 19:50 %%%------------------------------------------------------------------- -%%TODO:Config file +%%DONE:Config file -author("p01ar"). -record(sockaddr_in4, {family = inet, port = 8888, addr = {0, 0, 0, 0}}). -define(CHUNK_SIZE, 2048). --define(version, "MeowMeow/1.02-prebeta-101120"). +-define(version, "MeowMeow/1.02-prebeta-9121"). -define(accessfile, "/etc/MeowMeow/routes.conf"). -define(max_request_length, 10000). -define(mime_types_file, "mime.types"). diff --git a/src/fcgi.erl b/src/fcgi.erl index e6e7386..f2cf379 100644 --- a/src/fcgi.erl +++ b/src/fcgi.erl @@ -54,17 +54,22 @@ fcgi_proxy(FastCGIConnection,Response) -> logging:debug("Sending ~p, then ~p",[NewResponse,Tail]), io_proxy:tcp_send(Response#response.socket, response:do_response_headers(NewResponse)), io_proxy:tcp_send(Response#response.socket, Tail), - fcgi_send(NewResponse); + fcgi_send(NewResponse), + NewResponse#response{is_finished=true}; NewResponse-> fcgi_proxy(FastCGIConnection, NewResponse) end; + {fast_cgi_stderr, 600, Msg}-> + logging:err("FastCGI error: ~p",[Msg]), + fcgi_proxy(FastCGIConnection, Response); Unhandled-> logging:debug("Got unhandled FastCGI data: ~p @ fcgi:fcgi_proxy/2",[Unhandled]), - io_proxy:tcp_send(Response#response.socket, handle:abort(502)) + io_proxy:tcp_send(Response#response.socket, handle:abort(502)), + Response#response{code=502, is_finished=true} after 5000 -> erl_fastcgi:close(FastCGIConnection) - end, - Response#response{is_finished=true}. + end. + %%Response#response{is_finished=true}. fcgi_exec(Arg, Response) -> [Script,Host,Port,TryToReconnectEveryMillis] = string:split(Arg, " ",all),