Skip to content

Commit 302ae4c

Browse files
TurboGittonunaks
authored andcommitted
Use localhost on server for all regression tests.
This is to ensure proper error to bind when IPv6 is not available and so get proper fallback on IPv4. eng/toolchain/aws#50
1 parent b0de4d5 commit 302ae4c

File tree

113 files changed

+339
-284
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+339
-284
lines changed

regtests/0024_tcom/tcom.adb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ procedure Tcom is
9898

9999
R : Response.Data;
100100

101-
LH : constant String := Net.Localhost (Net.IPv6_Available);
101+
LH : constant String := "localhost";
102102

103103
begin
104104
Com_Server.Start (Context => C'Access, Host => LH, Port => 0);

regtests/0030_accs/accs_proc.adb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
------------------------------------------------------------------------------
22
-- Ada Web Server --
33
-- --
4-
-- Copyright (C) 2005-2012, AdaCore --
4+
-- Copyright (C) 2005-2024, AdaCore --
55
-- --
66
-- This is free software; you can redistribute it and/or modify it --
77
-- under terms of the GNU General Public License as published by the --
@@ -167,7 +167,7 @@ procedure Accs_Proc (Security : Boolean) is
167167
begin
168168
Semaphore.Seize;
169169

170-
Acceptors.Listen (Acceptor, "", 0, 11);
170+
Acceptors.Listen (Acceptor, "localhost", 0, 11);
171171

172172
declare
173173
Servers : array (1 .. 3) of Server_Task;

regtests/0046_disp_soap/disp_soap_proc.adb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
------------------------------------------------------------------------------
22
-- Ada Web Server --
33
-- --
4-
-- Copyright (C) 2003-2012, AdaCore --
4+
-- Copyright (C) 2003-2024, AdaCore --
55
-- --
66
-- This is free software; you can redistribute it and/or modify it --
77
-- under terms of the GNU General Public License as published by the --
@@ -171,6 +171,7 @@ begin
171171
Put_Line ("Start main, wait for server to start...");
172172

173173
AWS.Config.Set.Server_Port (Config, 0);
174+
AWS.Config.Set.Server_Host (Config, "localhost");
174175
AWS.Config.Set.Security (Config, Protocol = "https");
175176

176177
AWS.Server.Start

regtests/0048_dispatch1/dispatch1.adb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
------------------------------------------------------------------------------
22
-- Ada Web Server --
33
-- --
4-
-- Copyright (C) 2003-2012, AdaCore --
4+
-- Copyright (C) 2003-2024, AdaCore --
55
-- --
66
-- This is free software; you can redistribute it and/or modify it --
77
-- under terms of the GNU General Public License as published by the --
@@ -106,6 +106,7 @@ begin
106106

107107
Cfg := AWS.Config.Get_Current;
108108

109+
AWS.Config.Set.Server_Host (Cfg, "localhost");
109110
AWS.Config.Set.Server_Port (Cfg, 0);
110111

111112
AWS.Server.Start (WS, Dispatcher => H, Config => Cfg);

regtests/0049_dispatch_method/dispatch_method.adb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
------------------------------------------------------------------------------
22
-- Ada Web Server --
33
-- --
4-
-- Copyright (C) 2003-2012, AdaCore --
4+
-- Copyright (C) 2003-2024, AdaCore --
55
-- --
66
-- This is free software; you can redistribute it and/or modify it --
77
-- under terms of the GNU General Public License as published by the --
@@ -80,6 +80,7 @@ begin
8080
Services.Dispatchers.Method.Register
8181
(H, Status.POST, CB3'Unrestricted_Access);
8282

83+
AWS.Config.Set.Server_Host (Cfg, "localhost");
8384
AWS.Config.Set.Server_Port (Cfg, 0);
8485

8586
AWS.Server.Start (WS, Dispatcher => H, Config => Cfg);

regtests/0050_dispatch_vh/dispatch_vh.adb

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
------------------------------------------------------------------------------
22
-- Ada Web Server --
33
-- --
4-
-- Copyright (C) 2003-2012, AdaCore --
4+
-- Copyright (C) 2003-2024, AdaCore --
55
-- --
66
-- This is free software; you can redistribute it and/or modify it --
77
-- under terms of the GNU General Public License as published by the --
@@ -106,16 +106,11 @@ begin
106106

107107
Server.Start (WS, Dispatcher => H, Config => Cfg);
108108

109-
if Net.IPv6_Available then
109+
if Net.IPv6_Available and then AWS.Server.Status.Is_IPv6 (WS) then
110110
-- Need to start server in opposite protocol family because we do not
111111
-- know which family would bind localhost.
112112

113-
if Server.Status.Is_IPv6 (WS) then
114-
Config.Set.Protocol_Family (Cfg, "FAMILY_INET");
115-
else
116-
Config.Set.Protocol_Family (Cfg, "FAMILY_INET6");
117-
end if;
118-
113+
Config.Set.Protocol_Family (Cfg, "FAMILY_INET");
119114
Config.Set.Server_Port (Cfg, Server.Status.Port (WS));
120115

121116
Server.Start (W6, Dispatcher => H, Config => Cfg);

regtests/0051_dispatch_with_unregister/dispatch_with_unregister.adb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
------------------------------------------------------------------------------
22
-- Ada Web Server --
33
-- --
4-
-- Copyright (C) 2007-2013, AdaCore --
4+
-- Copyright (C) 2007-2024, AdaCore --
55
-- --
66
-- This is free software; you can redistribute it and/or modify it --
77
-- under terms of the GNU General Public License as published by the --
@@ -112,6 +112,7 @@ begin
112112
Services.Dispatchers.URI.Register_Default_Callback
113113
(H_Temp, AWS.Dispatchers.Callback.Create (Default2'Unrestricted_Access));
114114

115+
AWS.Config.Set.Server_Host (Cfg, "localhost");
115116
AWS.Config.Set.Server_Port (Cfg, 0);
116117

117118
AWS.Server.Start (WS, Dispatcher => H, Config => Cfg);

regtests/0054_file2/file2.adb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
------------------------------------------------------------------------------
22
-- Ada Web Server --
33
-- --
4-
-- Copyright (C) 2003-2012, AdaCore --
4+
-- Copyright (C) 2003-2024, AdaCore --
55
-- --
66
-- This is free software; you can redistribute it and/or modify it --
77
-- under terms of the GNU General Public License as published by the --
@@ -97,7 +97,10 @@ begin
9797
("file2.netlog", Net.Log.Callbacks.Binary'Access);
9898

9999
Server.Start
100-
(WS, "file", CB'Unrestricted_Access, Port => 0, Max_Connection => 5);
100+
(WS, "file", CB'Unrestricted_Access,
101+
Host => "localhost",
102+
Port => 0,
103+
Max_Connection => 5);
101104

102105
Server.Log.Start_Error (WS);
103106

regtests/0055_file/file.adb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
------------------------------------------------------------------------------
22
-- Ada Web Server --
33
-- --
4-
-- Copyright (C) 2003-2012, AdaCore --
4+
-- Copyright (C) 2003-2024, AdaCore --
55
-- --
66
-- This is free software; you can redistribute it and/or modify it --
77
-- under terms of the GNU General Public License as published by the --
@@ -60,7 +60,10 @@ procedure File is
6060

6161
begin
6262
Server.Start
63-
(WS, "file", CB'Unrestricted_Access, Port => 0, Max_Connection => 5);
63+
(WS, "file", CB'Unrestricted_Access,
64+
Host => "localhost",
65+
Port => 0,
66+
Max_Connection => 5);
6467
Text_IO.Put_Line ("started"); Ada.Text_IO.Flush;
6568

6669
delay 1.0;

regtests/0056_get_post/get_post.adb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
------------------------------------------------------------------------------
22
-- Ada Web Server --
33
-- --
4-
-- Copyright (C) 2003-2012, AdaCore --
4+
-- Copyright (C) 2003-2024, AdaCore --
55
-- --
66
-- This is free software; you can redistribute it and/or modify it --
77
-- under terms of the GNU General Public License as published by the --
@@ -104,7 +104,10 @@ procedure Get_Post is
104104
R : Response.Data;
105105

106106
begin
107-
Server.Start (WS, "Get Post", CB'Unrestricted_Access, Port => 0);
107+
Server.Start (WS, "Get Post",
108+
CB'Unrestricted_Access,
109+
Host => "localhost",
110+
Port => 0);
108111
Text_IO.Put_Line ("started"); Ada.Text_IO.Flush;
109112

110113
-- AWS.Net.Log.Start (Dump'Unrestricted_Access);

0 commit comments

Comments
 (0)