Skip to content

Commit 8127a28

Browse files
committed
Add test for URL decoding and plus sign.
Continued work for U326-027.
1 parent 50d579b commit 8127a28

File tree

4 files changed

+103
-0
lines changed

4 files changed

+103
-0
lines changed

regtests/0335_turl5/test.out

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
http://ftp.ch.debian.org/debian/pool/main/g/git/git_2.20.1-2+deb10u3_amd64.deb
2+
http://ftp.ch.debian.org/debian/pool/main/g/git/git_2.20.1-2+deb10u3_amd64.deb
3+
Server : ftp.ch.debian.org
4+
Port : 80
5+
Path : /debian/pool/main/g/git/
6+
File : git_2.20.1-2+deb10u3_amd64.deb
7+
Parameters :
8+
URI : /debian/pool/main/g/git/git_2.20.1-2+deb10u3_amd64.deb
9+
*
10+
Server : ftp.ch.debian.org
11+
Port : 80
12+
Path : /debian/pool/main/g/git/
13+
File : git_2.20.1-2+deb10u3_amd64.deb
14+
Parameters :
15+
URI : /debian/pool/main/g/git/git_2.20.1-2+deb10u3_amd64.deb

regtests/0335_turl5/test.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from test_support import *
2+
3+
build_and_run('turl5');

regtests/0335_turl5/turl5.adb

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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;

regtests/0335_turl5/turl5.gpr

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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 "aws";
20+
21+
project Turl5 is
22+
for Source_Dirs use (".");
23+
for Main use ("turl5.adb");
24+
end Turl5;

0 commit comments

Comments
 (0)