1
1
-- ----------------------------------------------------------------------------
2
2
-- Ada Web Server --
3
3
-- --
4
- -- Copyright (C) 2012-2016 , AdaCore --
4
+ -- Copyright (C) 2012-2021 , AdaCore --
5
5
-- --
6
6
-- This library is free software; you can redistribute it and/or modify --
7
7
-- it under terms of the GNU General Public License as published by the --
@@ -49,7 +49,8 @@ package body AWS.Net.WebSocket is
49
49
end record ;
50
50
51
51
procedure Unchecked_Free is new Ada.Unchecked_Deallocation
52
- (AWS.Client.HTTP_Connection, AWS.Client.HTTP_Connection_Access);
52
+ (AWS.Client.HTTP_Connection, AWS.Client.HTTP_Connection_Access);
53
+
53
54
procedure Unchecked_Free is new Unchecked_Deallocation
54
55
(Net.WebSocket.Protocol.State'Class,
55
56
Net.WebSocket.Protocol.State_Class);
@@ -87,12 +88,12 @@ package body AWS.Net.WebSocket is
87
88
(Socket : in out Object'Class;
88
89
URI : String)
89
90
is
91
+ URL : constant AWS.URL.Object := AWS.URL.Parse (URI);
90
92
Headers : AWS.Headers.List := AWS.Headers.Empty_List;
91
93
Resp : AWS.Response.Data;
92
- Protocol : AWS.Net.WebSocket.Protocol.State_Class;
93
- URL : constant AWS.URL.Object := AWS.URL.Parse (URI);
94
+ Protocol : Net.WebSocket.Protocol.State_Class;
94
95
begin
95
- -- Initially, the connection is initiated with standard http GET.
96
+ -- Initially, the connection is initiated with standard http GET
96
97
97
98
Socket.Connection := new AWS.Client.HTTP_Connection;
98
99
Protocol := new Net.WebSocket.Protocol.RFC6455.State;
@@ -402,7 +403,7 @@ package body AWS.Net.WebSocket is
402
403
function Poll
403
404
(Socket : in out Object'Class;
404
405
Timeout : Duration)
405
- return Boolean
406
+ return Boolean
406
407
is
407
408
procedure Do_Receive
408
409
(Socket : not null access Object'Class;
@@ -423,11 +424,11 @@ package body AWS.Net.WebSocket is
423
424
end Do_Receive ;
424
425
425
426
function Read_Message is new AWS.Net.WebSocket.Read_Message
426
- (Receive => Do_Receive);
427
+ (Receive => Do_Receive);
427
428
428
429
Obj : Object_Class := Socket'Unrestricted_Access;
429
430
Event : AWS.Net.Event_Set;
430
- Msg : Ada.Strings.Unbounded. Unbounded_String;
431
+ Msg : Unbounded_String;
431
432
begin
432
433
Event := Socket.Poll
433
434
((AWS.Net.Input => True, others => False), Timeout => Timeout);
@@ -465,8 +466,8 @@ package body AWS.Net.WebSocket is
465
466
-- ----------------
466
467
467
468
function Read_Message
468
- (WebSocket : in out Object_Class;
469
- Message : in out Ada.Strings.Unbounded. Unbounded_String)
469
+ (WebSocket : in out Object_Class;
470
+ Message : in out Unbounded_String)
470
471
return Boolean
471
472
is
472
473
Data : Stream_Element_Array (1 .. 4_096 );
0 commit comments