Correct some function clauses and value types

This commit is contained in:
Evgeniy Khramtsov 2011-09-05 16:31:58 +10:00
parent ffe063a0e9
commit f1a91108ef
1 changed files with 8 additions and 5 deletions

View File

@ -353,7 +353,7 @@ process_request(#state{request_method = Method,
when Method=:='GET' orelse Method=:='HEAD' orelse Method=:='DELETE' orelse Method=:='OPTIONS' ->
case (catch url_decode_q_split(Path)) of
{'EXIT', _} ->
process_request(false);
make_bad_request(State);
{NPath, Query} ->
LPath = [path_decode(NPE) || NPE <- string:tokens(NPath, "/")],
LQuery = case (catch parse_urlencoded(Query)) of
@ -430,7 +430,7 @@ process_request(#state{request_method = Method,
?DEBUG("client data: ~p~n", [Data]),
case (catch url_decode_q_split(Path)) of
{'EXIT', _} ->
process_request(false);
make_bad_request(State);
{NPath, _Query} ->
LPath = [path_decode(NPE) || NPE <- string:tokens(NPath, "/")],
LQuery = case (catch parse_urlencoded(Data)) of
@ -464,6 +464,9 @@ process_request(#state{request_method = Method,
end;
process_request(State) ->
make_bad_request(State).
make_bad_request(State) ->
make_xhtml_output(State,
400,
[],
@ -506,7 +509,7 @@ recv_data(State, Len, Acc) ->
[] ->
case (State#state.sockmod):recv(State#state.socket, Len, 300000) of
{ok, Data} ->
recv_data(State, Len - size(Data), [Acc | Data]);
recv_data(State, Len - size(Data), [Acc | [Data]]);
_ ->
""
end;
@ -1089,8 +1092,8 @@ is_space(_) ->
strip_spaces(String) ->
strip_spaces(String, both).
strip_spaces(String, left) ->
drop_spaces(String);
%% strip_spaces(String, left) ->
%% drop_spaces(String);
strip_spaces(String, right) ->
lists:reverse(drop_spaces(lists:reverse(String)));
strip_spaces(String, both) ->