From 9b6f04a6dfb955a6615f632197f3d70487a97d26 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Wed, 26 Oct 2011 13:53:45 +0200 Subject: Skip catching hex decode failure. OTP-9655 --- lib/inets/src/http_lib/http_uri.erl | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) (limited to 'lib/inets/src/http_lib') diff --git a/lib/inets/src/http_lib/http_uri.erl b/lib/inets/src/http_lib/http_uri.erl index b470fd0b46..d03acff3a9 100644 --- a/lib/inets/src/http_lib/http_uri.erl +++ b/lib/inets/src/http_lib/http_uri.erl @@ -47,19 +47,7 @@ encode(URI) -> lists:append(lists:map(fun(Char) -> uri_encode(Char, Reserved) end, URI)). decode(String) -> - try - begin - do_decode(String) - end - catch - throw:{bad_hex_value, _BadChar} -> - %% The string is either badly encoded or a string - %% containing a % followed by a non-hex char. - %% In any case, return as-is since there is nothing - %% we can do... - %% Note that the valid hex-chars are: 0-9, a-f and A-F. - String - end. + do_decode(String). do_decode([$%,Hex1,Hex2|Rest]) -> [hex2dec(Hex1)*16+hex2dec(Hex2)|do_decode(Rest)]; @@ -156,5 +144,4 @@ uri_encode(Char, Reserved) -> hex2dec(X) when (X>=$0) andalso (X=<$9) -> X-$0; hex2dec(X) when (X>=$A) andalso (X=<$F) -> X-$A+10; -hex2dec(X) when (X>=$a) andalso (X=<$f) -> X-$a+10; -hex2dec(X) -> throw({bad_hex_value, X}). +hex2dec(X) when (X>=$a) andalso (X=<$f) -> X-$a+10. -- cgit v1.2.3