/usr/share/ada/adainclude/aws/aws-services-dispatchers-linker.adb is in libaws2.10.2-dev 2.10.2-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | ------------------------------------------------------------------------------
-- Ada Web Server --
-- --
-- Copyright (C) 2005-2011, AdaCore --
-- --
-- This library is free software; you can redistribute it and/or modify --
-- it under the terms of the GNU General Public License as published by --
-- the Free Software Foundation; either version 2 of the License, or (at --
-- your option) any later version. --
-- --
-- This library is distributed in the hope that it will be useful, but --
-- WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
-- General Public License for more details. --
-- --
-- You should have received a copy of the GNU General Public License --
-- along with this library; if not, write to the Free Software Foundation, --
-- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --
-- --
------------------------------------------------------------------------------
with AWS.Messages;
package body AWS.Services.Dispatchers.Linker is
use AWS.Dispatchers;
-----------
-- Clone --
-----------
overriding function Clone (Dispatcher : Handler) return Handler is
New_Dispatcher : Handler;
begin
if Dispatcher.First /= null then
New_Dispatcher.First :=
new AWS.Dispatchers.Handler'Class'
(AWS.Dispatchers.Handler'Class (Dispatcher.First.Clone));
end if;
if Dispatcher.Second /= null then
New_Dispatcher.Second :=
new AWS.Dispatchers.Handler'Class'
(AWS.Dispatchers.Handler'Class (Dispatcher.Second.Clone));
end if;
return New_Dispatcher;
end Clone;
--------------
-- Dispatch --
--------------
overriding function Dispatch
(Dispatcher : Handler;
Request : Status.Data) return Response.Data
is
use type Messages.Status_Code;
R : Response.Data;
begin
R := AWS.Dispatchers.Dispatch (Dispatcher.First.all, Request);
if Response.Status_Code (R) /= Messages.S404 then
return R;
else
return AWS.Dispatchers.Dispatch (Dispatcher.Second.all, Request);
end if;
end Dispatch;
--------------
-- Finalize --
--------------
overriding procedure Finalize (Dispatcher : in out Handler) is
Ref_Counter : constant Natural := Dispatcher.Ref_Counter;
begin
Finalize (AWS.Dispatchers.Handler (Dispatcher));
if Ref_Counter = 1 then
Free (Dispatcher.First);
Free (Dispatcher.Second);
end if;
end Finalize;
----------------
-- Initialize --
----------------
overriding procedure Initialize (Dispatcher : in out Handler) is
begin
Initialize (AWS.Dispatchers.Handler (Dispatcher));
end Initialize;
--------------
-- Register --
--------------
procedure Register
(Dispatcher : in out Handler;
First, Second : AWS.Dispatchers.Handler'Class) is
begin
Dispatcher :=
(AWS.Dispatchers.Handler with
new AWS.Dispatchers.Handler'Class'(First),
new AWS.Dispatchers.Handler'Class'(Second));
end Register;
end AWS.Services.Dispatchers.Linker;
|