|
| 1 | +------------------------------------------------------------------------------ |
| 2 | +-- Ada Web Server -- |
| 3 | +-- -- |
| 4 | +-- Copyright (C) 2021, AdaCore -- |
| 5 | +-- -- |
| 6 | +-- This is free software; you can redistribute it and/or modify it -- |
| 7 | +-- under terms of the GNU General Public License as published by the -- |
| 8 | +-- Free Software Foundation; either version 3, or (at your option) any -- |
| 9 | +-- later version. This software is distributed in the hope that it will -- |
| 10 | +-- be useful, but WITHOUT ANY WARRANTY; without even the implied warranty -- |
| 11 | +-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- |
| 12 | +-- General Public License for more details. -- |
| 13 | +-- -- |
| 14 | +-- You should have received a copy of the GNU General Public License -- |
| 15 | +-- distributed with this software; see file COPYING3. If not, go -- |
| 16 | +-- to http://www.gnu.org/licenses for a complete copy of the license. -- |
| 17 | +------------------------------------------------------------------------------ |
| 18 | + |
| 19 | +with Ada.Exceptions; use Ada.Exceptions; |
| 20 | +with Ada.Text_IO; use Ada.Text_IO; |
| 21 | +with AWS.URL; use AWS.URL; |
| 22 | + |
| 23 | +procedure Turl5 is |
| 24 | + |
| 25 | + procedure Test (URL : String) is |
| 26 | + O : Object; |
| 27 | + begin |
| 28 | + O := Parse (URL); |
| 29 | + |
| 30 | + Put_Line (URL); |
| 31 | + Put_Line (AWS.URL.URL (O)); |
| 32 | + Put_Line (" Server : " & Host (O)); |
| 33 | + Put_Line (" Port : " & Port (O)); |
| 34 | + Put_Line (" Path : " & Path (O)); |
| 35 | + Put_Line (" File : " & File (O)); |
| 36 | + Put_Line (" Parameters : " & Parameters (O)); |
| 37 | + Put_Line (" URI : " & Pathname_And_Parameters (O)); |
| 38 | + |
| 39 | + Normalize (O); |
| 40 | + |
| 41 | + Put_Line (" *"); |
| 42 | + Put_Line (" Server : " & Host (O)); |
| 43 | + Put_Line (" Port : " & Port (O)); |
| 44 | + Put_Line (" Path : " & Path (O)); |
| 45 | + Put_Line (" File : " & File (O)); |
| 46 | + Put_Line (" Parameters : " & Parameters (O)); |
| 47 | + Put_Line (" URI : " & Pathname_And_Parameters (O)); |
| 48 | + |
| 49 | + exception |
| 50 | + when E : URL_Error => |
| 51 | + Put_Line ("Error on " & URL & " - " & Exception_Message (E)); |
| 52 | + end Test; |
| 53 | + |
| 54 | + URL_Host : constant String := |
| 55 | + "http://ftp.ch.debian.org"; |
| 56 | + URL_Path : constant String := |
| 57 | + "/debian/pool/main/g/git/git_2.20.1-2+deb10u3_amd64.deb"; |
| 58 | + |
| 59 | +begin |
| 60 | + Test (URL_Host & URL_Path); |
| 61 | +end Turl5; |
0 commit comments