File 4732-inets-fix-httpd_serve_SUITE-on-Windows.patch of Package erlang
From 83710ecb84defa40da4891da2e63240fb5d328c3 Mon Sep 17 00:00:00 2001
From: Jakub Witczak <kuba@erlang.org>
Date: Tue, 24 Oct 2023 13:38:49 +0200
Subject: [PATCH] inets: fix httpd_serve_SUITE on Windows
- follow-up of PR-7299
---
lib/inets/test/httpd_serve_SUITE.erl | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/lib/inets/test/httpd_serve_SUITE.erl b/lib/inets/test/httpd_serve_SUITE.erl
index c49391c35c..64890fdda0 100644
--- a/lib/inets/test/httpd_serve_SUITE.erl
+++ b/lib/inets/test/httpd_serve_SUITE.erl
@@ -86,7 +86,8 @@ run_server_assertions(Response) ->
run_server_assertions(Response, ?DEFAULT_ASSERTIONS).
%% Assert that the server responds properly.
-run_server_assertions({ok, {Ip, Port, Path}}, Assertions) when is_integer(Port) ->
+run_server_assertions({ok, {Ip0, Port, Path}}, Assertions) when is_integer(Port) ->
+ Ip = maybe_convert_to_localhost(Ip0),
% From the `filelib:wildcard/1` docs:
% "Directory separators must always be written as /, even on Windows."
IpToRequest = case Ip of
@@ -104,6 +105,14 @@ run_server_assertions({ok, {Ip, Port, Path}}, Assertions) when is_integer(Port)
ok = verify_assertions(Assertions, ServerInfo),
ct:comment("Ran ~w assertion(s).", [length(Assertions)]).
+maybe_convert_to_localhost(Ip = {0, 0, 0, 0}) ->
+ case os:type() of
+ {win32, _} -> {127, 0, 0, 1};
+ _ -> Ip
+ end;
+maybe_convert_to_localhost(Ip) ->
+ Ip.
+
%%
%% Assertion helper functions
%%
--
2.35.3