Skip to content

Commit 19fe91b

Browse files
committed
Merge branch 'mr/25.1-backport-eng-toolchain-aws-51' into '25.1'
[25.1] backports of eng/toolchain/aws#51 See merge request eng/toolchain/aws!80
2 parents 56c26e5 + ab16c81 commit 19fe91b

File tree

120 files changed

+437
-360
lines changed

Some content is hidden

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

120 files changed

+437
-360
lines changed

config/src/aws-net-std__gnat.adb

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,16 @@ package body AWS.Net.Std is
152152

153153
exception
154154
when E : Sockets.Socket_Error | Sockets.Host_Error =>
155-
if Socket.S.FD /= Sockets.No_Socket then
156-
Sockets.Close_Socket (Socket.S.FD);
157-
Socket.S.FD := Sockets.No_Socket;
155+
-- We don't want to fail if Family_Unspec is specified and
156+
-- we try to bind to an IPv6 address. In this case we want
157+
-- to fallback to IPv4 is possible.
158+
if Family /= Family_Unspec
159+
or else Addr_Info.Addr.Family /= Sockets.Family_Inet6
160+
then
161+
if Socket.S.FD /= Sockets.No_Socket then
162+
Sockets.Close_Socket (Socket.S.FD);
163+
Socket.S.FD := Sockets.No_Socket;
164+
end if;
158165
end if;
159166

160167
Exceptions.Save_Occurrence (Keep_Excp, E);
@@ -289,9 +296,16 @@ package body AWS.Net.Std is
289296

290297
exception
291298
when E : Sockets.Socket_Error | Sockets.Host_Error =>
292-
if Close_On_Exception then
293-
Sockets.Close_Socket (Socket.S.FD);
294-
Close_On_Exception := False;
299+
-- We don't want to fail if Family_Unspec is specified and
300+
-- we try to bind to an IPv6 address. In this case we want
301+
-- to fallback to IPv4 is possible.
302+
if Family /= Family_Unspec
303+
or else Addr_Info.Addr.Family /= Sockets.Family_Inet6
304+
then
305+
if Close_On_Exception then
306+
Sockets.Close_Socket (Socket.S.FD);
307+
Close_On_Exception := False;
308+
end if;
295309
end if;
296310

297311
Save_Occurrence (Keep_Excp, E);

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;

0 commit comments

Comments
 (0)