diff --git a/rebar.config b/rebar.config index aa1ca3e..385abcc 100755 --- a/rebar.config +++ b/rebar.config @@ -1,4 +1,4 @@ -{relx, [{release, {'MeowMeow', "1.02-prebeta-r10"}, [app]}, +{relx, [{release, {'MeowMeow', "1.02-prebeta-r11"}, [app]}, {dev_mode, true}, {include_erts, false}, {extended_start_script, true} diff --git a/src/app.app.src b/src/app.app.src index e410a4c..83d4809 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-r10"}, + {vsn, "1.02-prebeta-r11"}, {modules, []}, {registered, [app_sup]}, {applications, [ diff --git a/src/util.erl b/src/util.erl index ca38b15..96264b9 100755 --- a/src/util.erl +++ b/src/util.erl @@ -78,8 +78,13 @@ sget2(Key, Map) -> "" end. str2int(Str) -> - {R, []} = string:to_integer(Str), - R. + case string:to_integer(Str) of + {R, []} -> R; + {R, <<>>} -> R; + Any -> logging:err("Failed to parse to int: ~p", [Str]), + {error, bad_arg} + end. + str2addr(Str) -> IP = string:split(Str,".",all), if length(IP) == 4 -> @@ -91,7 +96,7 @@ str2addr(Str) -> end. get_http_ver_pair(Str) -> - Ver = lists:nth(string:split(Str,"/"),2), + Ver = lists:nth(2,string:split(Str,"/")), [VerMajor, VerMinor] = string:split(Ver, "."), {str2int(VerMajor),str2int(VerMinor)}.