summaryrefslogtreecommitdiff
path: root/lib/inets
diff options
context:
space:
mode:
authorIngela Anderton Andin <ingela@erlang.org>2021-12-08 08:05:34 +0100
committerIngela Anderton Andin <ingela@erlang.org>2021-12-08 08:05:34 +0100
commit3650f3a37fe289648dacd5cad9a79f63ca823f66 (patch)
tree1b74cb49a3a982d565686ba4b6f424feecbba8c6 /lib/inets
parent075d671d216d3a56f43fe7e23bbdc55b5d0df1f7 (diff)
parent64df552786697131e0f353aa0e2f7993e695176d (diff)
downloaderlang-3650f3a37fe289648dacd5cad9a79f63ca823f66.tar.gz
Merge branch 'ingela/inets/path/ERIERL-731/OTP-17818' into maint
* ingela/inets/path/ERIERL-731/OTP-17818: inets: Remove legacy code not longer needed
Diffstat (limited to 'lib/inets')
-rw-r--r--lib/inets/src/http_server/httpd_util.erl22
-rw-r--r--lib/inets/test/httpd_SUITE.erl18
2 files changed, 20 insertions, 20 deletions
diff --git a/lib/inets/src/http_server/httpd_util.erl b/lib/inets/src/http_server/httpd_util.erl
index 21656fe164..64b3f5f9e7 100644
--- a/lib/inets/src/http_server/httpd_util.erl
+++ b/lib/inets/src/http_server/httpd_util.erl
@@ -427,27 +427,12 @@ split_path(URI) ->
query := Query} ->
{Path, Query};
#{path := Path} ->
- split_path(Path, [])
+ {Path, []}
end.
add_hashmark(Query, Fragment) ->
Query ++ "#" ++ Fragment.
-split_path([],SoFar) ->
- {lists:reverse(SoFar),[]};
-split_path([$/|Rest],SoFar) ->
- Path=lists:reverse(SoFar),
- case file:read_file_info(Path) of
- {ok,FileInfo} when FileInfo#file_info.type =:= regular ->
- {Path,[$/|Rest]};
- {ok, _FileInfo} ->
- split_path(Rest,[$/|SoFar]);
- {error, _Reason} ->
- split_path(Rest,[$/|SoFar])
- end;
-split_path([C|Rest],SoFar) ->
- split_path(Rest,[C|SoFar]).
-
%% split_script_path, URI has been decoded once when validate
%% and should only be decoded once(RFC3986, 2.4).
@@ -460,10 +445,9 @@ split_script_path(URI) ->
not_a_script;
#{path := Path,
query := Query} ->
- {Script, PathInfo} = split_path(Path, []),
- {Script, {PathInfo, Query}};
+ {Path, {[], Query}};
#{path := Path} ->
- split_path(Path, [])
+ {Path, []}
end.
%% suffix
diff --git a/lib/inets/test/httpd_SUITE.erl b/lib/inets/test/httpd_SUITE.erl
index 617c925161..b3eae4740c 100644
--- a/lib/inets/test/httpd_SUITE.erl
+++ b/lib/inets/test/httpd_SUITE.erl
@@ -157,7 +157,8 @@ http_get() ->
max_header,
max_content_length,
ignore_invalid_header,
- ipv6
+ ipv6,
+ same_file_name_dir_name
].
@@ -768,6 +769,21 @@ ipv6(Config) when is_list(Config) ->
end.
%%-------------------------------------------------------------------------
+same_file_name_dir_name() ->
+ [{doc,"Test that URI path that has a filename in it is not interprated as the file"}].
+same_file_name_dir_name(Config) when is_list(Config) ->
+ Version = proplists:get_value(http_version, Config),
+ Host = proplists:get_value(host, Config),
+ Type = proplists:get_value(type, Config),
+ ok = httpd_test_lib:verify_request(Type, Host,
+ proplists:get_value(port, Config),
+ transport_opts(Type, Config),
+ proplists:get_value(node, Config),
+ http_request("GET /index.html/foo.html ", Version, Host),
+ [{statuscode, 404},
+ {version, Version}]).
+
+%%-------------------------------------------------------------------------
chunked_post() ->
[{doc,"Test option max_client_body_chunk"}].
chunked_post(Config) when is_list(Config) ->