aboutsummaryrefslogtreecommitdiffstats
path: root/lib/inets/src/http_server/httpd_util.erl
diff options
context:
space:
mode:
authorErlang/OTP <[email protected]>2016-01-29 15:13:38 +0100
committerErlang/OTP <[email protected]>2016-01-29 15:13:38 +0100
commit80e2ab864725f62ba0e4e8e6d1d14ac4272c9ab2 (patch)
tree60f2d2fa5efdb3a837a3102388c5462ab32f0ef0 /lib/inets/src/http_server/httpd_util.erl
parent7cf9a621c5280a3e97967c4c63ab6ca1adde69c3 (diff)
parenta6a766143bd5332ff0173a9a3c05e3b36d20297c (diff)
downloadotp-80e2ab864725f62ba0e4e8e6d1d14ac4272c9ab2.tar.gz
otp-80e2ab864725f62ba0e4e8e6d1d14ac4272c9ab2.tar.bz2
otp-80e2ab864725f62ba0e4e8e6d1d14ac4272c9ab2.zip
Merge branch 'ia/maint/inets/mod_alias/OTP-13248' into maint-18
* ia/maint/inets/mod_alias/OTP-13248: inets: Prepare for release inets: Traverse all aliases looking for the longest match inets: Use re instead of inets_regexp # Conflicts: # lib/inets/vsn.mk
Diffstat (limited to 'lib/inets/src/http_server/httpd_util.erl')
-rw-r--r--lib/inets/src/http_server/httpd_util.erl29
1 files changed, 6 insertions, 23 deletions
diff --git a/lib/inets/src/http_server/httpd_util.erl b/lib/inets/src/http_server/httpd_util.erl
index ab43f0b378..6dd6db6a0c 100644
--- a/lib/inets/src/http_server/httpd_util.erl
+++ b/lib/inets/src/http_server/httpd_util.erl
@@ -420,11 +420,11 @@ flatlength([],L) ->
%% split_path
split_path(Path) ->
- case inets_regexp:match(Path,"[\?].*\$") of
+ case re:run(Path,"[\?].*\$", [{capture, first}]) of
%% A QUERY_STRING exists!
- {match,Start,Length} ->
- {http_uri:decode(string:substr(Path,1,Start-1)),
- string:substr(Path,Start,Length)};
+ {match,[{Start,Length}]} ->
+ {http_uri:decode(string:substr(Path,1,Start)),
+ string:substr(Path,Start+1,Length)};
%% A possible PATH_INFO exists!
nomatch ->
split_path(Path,[])
@@ -522,25 +522,8 @@ remove_ws(Rest) ->
%% split
-split(String,RegExp,Limit) ->
- case inets_regexp:parse(RegExp) of
- {error,Reason} ->
- {error,Reason};
- {ok,_} ->
- {ok,do_split(String,RegExp,Limit)}
- end.
-
-do_split(String, _RegExp, 1) ->
- [String];
-
-do_split(String,RegExp,Limit) ->
- case inets_regexp:first_match(String,RegExp) of
- {match,Start,Length} ->
- [string:substr(String,1,Start-1)|
- do_split(lists:nthtail(Start+Length-1,String),RegExp,Limit-1)];
- nomatch ->
- [String]
- end.
+split(String,RegExp,N) ->
+ {ok, re:split(String, RegExp, [{parts, N}, {return, list}])}.
%% make_name/2, make_name/3
%% Prefix -> string()