Skip to content
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.

Commit

Permalink
Fixed #9
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrewerr committed Jun 14, 2021
1 parent 81ae6eb commit fba36aa
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion rebar.config
Original file line number Diff line number Diff line change
@@ -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}
Expand Down
2 changes: 1 addition & 1 deletion src/app.app.src
Original file line number Diff line number Diff line change
@@ -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, [
Expand Down
11 changes: 8 additions & 3 deletions src/util.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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 ->
Expand All @@ -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)}.

Expand Down

0 comments on commit fba36aa

Please sign in to comment.