aboutsummaryrefslogtreecommitdiffstats
path: root/lib/inets/src/http_lib
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2011-10-26 13:53:45 +0200
committerMicael Karlberg <[email protected]>2011-10-26 13:53:45 +0200
commit9b6f04a6dfb955a6615f632197f3d70487a97d26 (patch)
tree7bcc2c222d140a4a4498470b7b0b90aca10ca648 /lib/inets/src/http_lib
parent1577983b9b3883b74e3e460ed4f8f6916ffaa3a5 (diff)
downloadotp-9b6f04a6dfb955a6615f632197f3d70487a97d26.tar.gz
otp-9b6f04a6dfb955a6615f632197f3d70487a97d26.tar.bz2
otp-9b6f04a6dfb955a6615f632197f3d70487a97d26.zip
Skip catching hex decode failure.
OTP-9655
Diffstat (limited to 'lib/inets/src/http_lib')
-rw-r--r--lib/inets/src/http_lib/http_uri.erl17
1 files changed, 2 insertions, 15 deletions
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.