author | mikael |
Fri, 04 Dec 2015 15:08:49 -0800 | |
changeset 35090 | 1f5b6aa795d0 |
parent 15528 | 18f0bac88177 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
15528
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
2 |
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. |
2 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
5506 | 19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
2 | 22 |
*/ |
23 |
||
15528
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
24 |
/* |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
25 |
* @test |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
26 |
* @bug 4393671 |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
27 |
* @summary URL constructor URL(URL context, String spec) FAILED with specific input |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
28 |
*/ |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
29 |
|
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
30 |
/* |
2 | 31 |
* This program tests the URL parser in the URL constructor. It |
32 |
* tries to construct a variety of valid URLs with a given context |
|
33 |
* (which may be null) and a variety of specs. It then compares the |
|
34 |
* result with an expected value. |
|
35 |
*/ |
|
36 |
||
15528
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
37 |
import java.net.MalformedURLException; |
2 | 38 |
import java.net.URL; |
15528
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
39 |
import java.util.ArrayList; |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
40 |
import java.util.Arrays; |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
41 |
import java.util.List; |
2 | 42 |
|
43 |
public class Constructor { |
|
44 |
||
45 |
public static void main(String[] args) throws Exception { |
|
15528
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
46 |
List<Entry> entries = new ArrayList<>(); |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
47 |
entries.addAll(Arrays.asList(fileURLs)); |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
48 |
entries.addAll(Arrays.asList(jarURLs)); |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
49 |
entries.addAll(Arrays.asList(normalHttpURLs)); |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
50 |
entries.addAll(Arrays.asList(abnormalHttpURLs)); |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
51 |
if (hasFtp()) |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
52 |
entries.addAll(Arrays.asList(ftpURLs)); |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
53 |
URL url; |
2 | 54 |
|
15528
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
55 |
for (Entry e : entries) { |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
56 |
if (e.context == null) |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
57 |
url = new URL(e.spec); |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
58 |
else |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
59 |
url = new URL(new URL(e.context), e.spec); |
2 | 60 |
|
15528
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
61 |
if (!(url.toString().equals(e.expected))) { |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
62 |
throw new RuntimeException("error for: \n\tURL:" + e.context + |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
63 |
"\n\tspec: " + e.spec + |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
64 |
"\n\texpected: " + e.expected + |
2 | 65 |
"\n\tactual: " + url.toString()); |
66 |
} else { |
|
15528
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
67 |
//debug |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
68 |
//System.out.println("success for: " + url); |
2 | 69 |
} |
15528
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
70 |
} |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
71 |
} |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
72 |
|
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
73 |
private static boolean hasFtp() { |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
74 |
try { |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
75 |
return new java.net.URL("ftp://") != null; |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
76 |
} catch (java.net.MalformedURLException x) { |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
77 |
System.out.println("FTP not supported by this runtime."); |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
78 |
return false; |
2 | 79 |
} |
15528
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
80 |
} |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
81 |
|
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
82 |
static class Entry { |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
83 |
final String context; |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
84 |
final String spec; |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
85 |
final String expected; |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
86 |
Entry(String context, String spec, String expected) { |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
87 |
this.context = context; |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
88 |
this.spec =spec; |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
89 |
this.expected = expected; |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
90 |
} |
2 | 91 |
} |
92 |
||
15528
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
93 |
static Entry[] fileURLs = new Entry[] { |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
94 |
new Entry(null, |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
95 |
"file://JavaSoft/Test", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
96 |
"file://JavaSoft/Test"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
97 |
new Entry(null, |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
98 |
"file:///JavaSoft/Test", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
99 |
"file:/JavaSoft/Test"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
100 |
new Entry(null, |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
101 |
"file:/JavaSoft/Test", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
102 |
"file:/JavaSoft/Test"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
103 |
new Entry(null, |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
104 |
"file:/c:/JavaSoft/Test", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
105 |
"file:/c:/JavaSoft/Test"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
106 |
new Entry(null, |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
107 |
"file:/c:/JavaSoft/Test:something", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
108 |
"file:/c:/JavaSoft/Test:something"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
109 |
new Entry(null, |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
110 |
"file:/c:/JavaSoft/Test#anchor", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
111 |
"file:/c:/JavaSoft/Test#anchor"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
112 |
new Entry("file://JavaSoft/Test", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
113 |
"Test#bar", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
114 |
"file://JavaSoft/Test#bar"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
115 |
new Entry("file://codrus/c:/jdk/eng/index.html", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
116 |
"pulsar.html", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
117 |
"file://codrus/c:/jdk/eng/pulsar.html"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
118 |
new Entry("file:///c:/jdk/eng/index.html", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
119 |
"pulsar.html", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
120 |
"file:/c:/jdk/eng/pulsar.html"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
121 |
new Entry("file:///jdk/eng/index.html", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
122 |
"pulsar.html", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
123 |
"file:/jdk/eng/pulsar.html"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
124 |
new Entry("file://JavaSoft/Test", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
125 |
"file://radartoad.com/Test#bar", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
126 |
"file://radartoad.com/Test#bar"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
127 |
new Entry("file://JavaSoft/Test", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
128 |
"/c:/Test#bar", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
129 |
"file://JavaSoft/c:/Test#bar"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
130 |
}; |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
131 |
|
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
132 |
static Entry[] jarURLs = new Entry[] { |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
133 |
new Entry(null, |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
134 |
"jar:http://www.foo.com/dir1/jar.jar!/dir2/entry.txt", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
135 |
"jar:http://www.foo.com/dir1/jar.jar!/dir2/entry.txt"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
136 |
new Entry(null, |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
137 |
"jar:http://www.foo.com/dir1/jar.jar!/", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
138 |
"jar:http://www.foo.com/dir1/jar.jar!/"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
139 |
new Entry(null, |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
140 |
"jar:http://www.foo.com/dir1/jar.jar!/", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
141 |
"jar:http://www.foo.com/dir1/jar.jar!/"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
142 |
new Entry("jar:http://www.foo.com/dir1/jar.jar!/", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
143 |
"entry.txt", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
144 |
"jar:http://www.foo.com/dir1/jar.jar!/entry.txt"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
145 |
new Entry("jar:http://www.foo.com/dir1/jar.jar!/", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
146 |
"/entry.txt", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
147 |
"jar:http://www.foo.com/dir1/jar.jar!/entry.txt"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
148 |
new Entry("jar:http://www.foo.com/dir1/jar.jar!/", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
149 |
"dir1/entry.txt", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
150 |
"jar:http://www.foo.com/dir1/jar.jar!/dir1/entry.txt"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
151 |
new Entry("jar:http://www.foo.com/dir1/jar.jar!/", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
152 |
"/dir1/entry.txt", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
153 |
"jar:http://www.foo.com/dir1/jar.jar!/dir1/entry.txt"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
154 |
new Entry("jar:http://www.foo.com/dir1/jar.jar!/", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
155 |
"entry.txt", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
156 |
"jar:http://www.foo.com/dir1/jar.jar!/entry.txt"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
157 |
new Entry("jar:http://www.foo.com/dir1/jar.jar!/", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
158 |
"/entry.txt", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
159 |
"jar:http://www.foo.com/dir1/jar.jar!/entry.txt"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
160 |
new Entry("jar:http://www.foo.com/dir1/jar.jar!/", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
161 |
"/entry.txt", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
162 |
"jar:http://www.foo.com/dir1/jar.jar!/entry.txt"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
163 |
new Entry("jar:http://www.foo.com/dir1/jar.jar!/dir1/", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
164 |
"entry.txt", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
165 |
"jar:http://www.foo.com/dir1/jar.jar!/dir1/entry.txt"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
166 |
new Entry("jar:http://www.foo.com/dir1/jar.jar!/dir2/dir3/entry2.txt", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
167 |
"/dir1/entry.txt", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
168 |
"jar:http://www.foo.com/dir1/jar.jar!/dir1/entry.txt"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
169 |
new Entry("jar:http://www.foo.com/dir1/jar.jar!/", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
170 |
"/dir1/foo/entry.txt", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
171 |
"jar:http://www.foo.com/dir1/jar.jar!/dir1/foo/entry.txt"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
172 |
new Entry("jar:http://www.foo.com/dir1/jar.jar!/dir1/dir2/dir3/", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
173 |
"dir4/foo/entry.txt", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
174 |
"jar:http://www.foo.com/dir1/jar.jar!/dir1/dir2/dir3/dir4/foo/entry.txt"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
175 |
new Entry("jar:http://www.foo.com/dir1/jar.jar!/", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
176 |
"/dir1/foo/entry.txt", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
177 |
"jar:http://www.foo.com/dir1/jar.jar!/dir1/foo/entry.txt"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
178 |
new Entry(null, |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
179 |
"jar:http://www.foo.com/dir1/jar.jar!/foo.txt#anchor", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
180 |
"jar:http://www.foo.com/dir1/jar.jar!/foo.txt#anchor"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
181 |
new Entry("jar:http://www.foo.com/dir1/jar.jar!/foo.txt", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
182 |
"#anchor", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
183 |
"jar:http://www.foo.com/dir1/jar.jar!/foo.txt#anchor"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
184 |
new Entry("jar:http://www.foo.com/dir1/jar.jar!/foo/bar/", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
185 |
"baz/quux#anchor", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
186 |
"jar:http://www.foo.com/dir1/jar.jar!/foo/bar/baz/quux#anchor"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
187 |
new Entry("jar:http://balloo.com/olle.jar!/", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
188 |
"p2", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
189 |
"jar:http://balloo.com/olle.jar!/p2") |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
190 |
}; |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
191 |
|
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
192 |
static Entry[] normalHttpURLs = new Entry[] { |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
193 |
new Entry("http://a/b/c/d;p?q", "g", "http://a/b/c/g"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
194 |
new Entry("http://a/b/c/d;p?q", "./g", "http://a/b/c/g"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
195 |
new Entry("http://a/b/c/d;p?q", "g/", "http://a/b/c/g/"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
196 |
new Entry("http://a/b/c/d;p?q", "/g", "http://a/g"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
197 |
new Entry("http://a/b/c/d;p?q", "//g", "http://g"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
198 |
new Entry("http://a/b/c/d;p?q", "?y", "http://a/b/c/?y"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
199 |
new Entry("http://a/b/c/d;p?q", "g?y", "http://a/b/c/g?y"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
200 |
new Entry("http://a/b/c/d;p?q", "g#s", "http://a/b/c/g#s"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
201 |
new Entry("http://a/b/c/d;p?q", "g?y#s", "http://a/b/c/g?y#s"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
202 |
new Entry("http://a/b/c/d;p?q", ";x", "http://a/b/c/;x"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
203 |
new Entry("http://a/b/c/d;p?q", "g;x", "http://a/b/c/g;x"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
204 |
new Entry("http://a/b/c/d;p?q", "g;x?y#s", "http://a/b/c/g;x?y#s"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
205 |
new Entry("http://a/b/c/d;p?q", ".", "http://a/b/c/"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
206 |
new Entry("http://a/b/c/d;p?q", "./", "http://a/b/c/"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
207 |
new Entry("http://a/b/c/d;p?q", "..", "http://a/b/"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
208 |
new Entry("http://a/b/c/d;p?q", "../", "http://a/b/"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
209 |
new Entry("http://a/b/c/d;p?q", "../g", "http://a/b/g"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
210 |
new Entry("http://a/b/c/d;p?q", "../..", "http://a/"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
211 |
new Entry("http://a/b/c/d;p?q", "../../", "http://a/"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
212 |
new Entry("http://a/b/c/d;p?q", "../../g", "http://a/g"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
213 |
new Entry(null, |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
214 |
"http://www.javasoft.com/jdc/community/chat/index.html#javalive?frontpage-jdc", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
215 |
"http://www.javasoft.com/jdc/community/chat/index.html#javalive?frontpage-jdc") |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
216 |
}; |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
217 |
|
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
218 |
static Entry[] abnormalHttpURLs = new Entry[] { |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
219 |
new Entry("http://a/b/c/d;p?q", "../../../g", "http://a/../g"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
220 |
new Entry("http://a/b/c/d;p?q", "../../../../g", "http://a/../../g"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
221 |
new Entry("http://a/b/c/d;p?q", "/./g", "http://a/./g"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
222 |
new Entry("http://a/b/c/d;p?q", "/../g", "http://a/../g"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
223 |
new Entry("http://a/b/c/d;p?q", ".g", "http://a/b/c/.g"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
224 |
new Entry("http://a/b/c/d;p?q", "g.", "http://a/b/c/g."), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
225 |
new Entry("http://a/b/c/d;p?q", "./../g", "http://a/b/g"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
226 |
new Entry("http://a/b/c/d;p?q", "./g/.", "http://a/b/c/g/"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
227 |
new Entry("http://a/b/c/d;p?q", "g/./h", "http://a/b/c/g/h"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
228 |
new Entry("http://a/b/c/d;p?q", "g;x=1/./y", "http://a/b/c/g;x=1/y"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
229 |
new Entry("http://a/b/c/d;p?q", "g;x=1/../y", "http://a/b/c/y") |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
230 |
}; |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
231 |
|
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
232 |
static Entry[] ftpURLs = new Entry[] { |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
233 |
new Entry(null, |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
234 |
"ftp://ftp.foo.com/dir1/entry.txt", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
235 |
"ftp://ftp.foo.com/dir1/entry.txt"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
236 |
new Entry(null, |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
237 |
"ftp://br:pwd@ftp.foo.com/dir1/jar.jar", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
238 |
"ftp://br:pwd@ftp.foo.com/dir1/jar.jar"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
239 |
new Entry("ftp://ftp.foo.com/dir1/foo.txt", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
240 |
"bar.txt", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
241 |
"ftp://ftp.foo.com/dir1/bar.txt"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
242 |
new Entry("ftp://ftp.foo.com/dir1/jar.jar", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
243 |
"/entry.txt", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
244 |
"ftp://ftp.foo.com/entry.txt"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
245 |
new Entry("ftp://ftp.foo.com/dir1/jar.jar", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
246 |
"dir1/entry.txt", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
247 |
"ftp://ftp.foo.com/dir1/dir1/entry.txt"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
248 |
new Entry("ftp://ftp.foo.com/dir1/jar.jar", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
249 |
"/dir1/entry.txt", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
250 |
"ftp://ftp.foo.com/dir1/entry.txt"), |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
251 |
new Entry("ftp://br:pwd@ftp.foo.com/dir1/jar.jar", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
252 |
"/dir1/entry.txt", |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
253 |
"ftp://br:pwd@ftp.foo.com/dir1/entry.txt") |
18f0bac88177
8007322: untangle ftp protocol from general networking URL tests
chegar
parents:
5506
diff
changeset
|
254 |
}; |
2 | 255 |
} |