diff options
author | Zandra <[email protected]> | 2016-01-29 17:43:37 +0100 |
---|---|---|
committer | Zandra <[email protected]> | 2016-01-29 17:43:37 +0100 |
commit | 57a928b4bc1076b169ecc95e38ab23cf79e03280 (patch) | |
tree | b6edbc2d2238d742772239f7dd64556067071b2f /lib/inets/src/http_server/httpd_util.erl | |
parent | 3eb54b2053f76d3d47eed8774153be0f7a5016c3 (diff) | |
parent | d96471b3f404f7341279d8598dd74d92fb1a923c (diff) | |
download | otp-57a928b4bc1076b169ecc95e38ab23cf79e03280.tar.gz otp-57a928b4bc1076b169ecc95e38ab23cf79e03280.tar.bz2 otp-57a928b4bc1076b169ecc95e38ab23cf79e03280.zip |
Merge branch 'maint-18' into maint
Diffstat (limited to 'lib/inets/src/http_server/httpd_util.erl')
-rw-r--r-- | lib/inets/src/http_server/httpd_util.erl | 29 |
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() |