24
1
mirror of https://github.com/processone/ejabberd.git synced 2024-06-28 22:52:27 +02:00

Throw a meaningful error when the URL can't be parsed

This commit is contained in:
Badlop 2010-06-21 21:30:08 +02:00
parent 3f68689367
commit 3ee28ef7cc

View File

@ -350,8 +350,8 @@ process_request(#state{request_method = Method,
socket = Socket} = State) socket = Socket} = State)
when Method=:='GET' orelse Method=:='HEAD' orelse Method=:='DELETE' orelse Method=:='OPTIONS' -> when Method=:='GET' orelse Method=:='HEAD' orelse Method=:='DELETE' orelse Method=:='OPTIONS' ->
case (catch url_decode_q_split(Path)) of case (catch url_decode_q_split(Path)) of
{'EXIT', _} -> {'EXIT', Error} ->
process_request(false); throw({error_decoding_url, Path, Error});
{NPath, Query} -> {NPath, Query} ->
LPath = [path_decode(NPE) || NPE <- string:tokens(NPath, "/")], LPath = [path_decode(NPE) || NPE <- string:tokens(NPath, "/")],
LQuery = case (catch parse_urlencoded(Query)) of LQuery = case (catch parse_urlencoded(Query)) of
@ -422,8 +422,8 @@ process_request(#state{request_method = Method,
Data = recv_data(State, Len), Data = recv_data(State, Len),
?DEBUG("client data: ~p~n", [Data]), ?DEBUG("client data: ~p~n", [Data]),
case (catch url_decode_q_split(Path)) of case (catch url_decode_q_split(Path)) of
{'EXIT', _} -> {'EXIT', Error} ->
process_request(false); throw({error_decoding_url, Path, Error});
{NPath, _Query} -> {NPath, _Query} ->
LPath = [path_decode(NPE) || NPE <- string:tokens(NPath, "/")], LPath = [path_decode(NPE) || NPE <- string:tokens(NPath, "/")],
LQuery = case (catch parse_urlencoded(Data)) of LQuery = case (catch parse_urlencoded(Data)) of