author | dfuchs |
Tue, 01 Oct 2019 12:10:33 +0100 | |
changeset 58423 | 54de0c861d32 |
parent 52554 | 5f1ca46703f9 |
permissions | -rw-r--r-- |
36131 | 1 |
/* |
49765 | 2 |
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. |
36131 | 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 |
|
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
7 |
* published by the Free Software Foundation. |
36131 | 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 |
* |
|
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 |
|
40684
2e37c119dc2a
8164982: Fix legal notices in java/lang, java/net, java/util tests.
shurailine
parents:
38883
diff
changeset
|
21 |
* questions. |
36131 | 22 |
*/ |
23 |
||
41890
ab67b8f4f2fe
8169002: Several java/net/httpclient have undeclared dependency on java.logging module
skovalev
parents:
40684
diff
changeset
|
24 |
/* |
36131 | 25 |
* @test |
26 |
* @bug 8087112 |
|
49765 | 27 |
* @modules java.net.http |
41890
ab67b8f4f2fe
8169002: Several java/net/httpclient have undeclared dependency on java.logging module
skovalev
parents:
40684
diff
changeset
|
28 |
* java.logging |
38883 | 29 |
* jdk.httpserver |
52121
934969c63223
8211978: Move testlibrary/jdk/testlibrary/SimpleSSLContext.java and testkeys to network testlibrary
jjiang
parents:
49765
diff
changeset
|
30 |
* @library /test/lib |
934969c63223
8211978: Move testlibrary/jdk/testlibrary/SimpleSSLContext.java and testkeys to network testlibrary
jjiang
parents:
49765
diff
changeset
|
31 |
* @build jdk.test.lib.net.SimpleSSLContext |
36131 | 32 |
* @compile ../../../../com/sun/net/httpserver/LogFilter.java |
33 |
* @compile ../../../../com/sun/net/httpserver/FileServerHandler.java |
|
34 |
* @compile ../ProxyServer.java |
|
35 |
* |
|
36 |
* @run main/othervm/secure=java.lang.SecurityManager/policy=0.policy Security 0 |
|
37 |
* @run main/othervm/secure=java.lang.SecurityManager/policy=2.policy Security 2 |
|
38 |
* @run main/othervm/secure=java.lang.SecurityManager/policy=3.policy Security 3 |
|
39 |
* @run main/othervm/secure=java.lang.SecurityManager/policy=4.policy Security 4 |
|
40 |
* @run main/othervm/secure=java.lang.SecurityManager/policy=5.policy Security 5 |
|
41 |
* @run main/othervm/secure=java.lang.SecurityManager/policy=6.policy Security 6 |
|
42 |
* @run main/othervm/secure=java.lang.SecurityManager/policy=7.policy Security 7 |
|
43 |
* @run main/othervm/secure=java.lang.SecurityManager/policy=8.policy Security 8 |
|
44 |
* @run main/othervm/secure=java.lang.SecurityManager/policy=9.policy Security 9 |
|
45 |
* @run main/othervm/secure=java.lang.SecurityManager/policy=0.policy Security 13 |
|
37791
ae33107fd8b3
8155928: Remove hardcoded port numbers from httpclient/Security.java test
michaelm
parents:
36131
diff
changeset
|
46 |
* @run main/othervm/secure=java.lang.SecurityManager/policy=14.policy Security 14 |
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
47 |
* @run main/othervm/secure=java.lang.SecurityManager/policy=15.policy -Djava.security.debug=access:domain,failure Security 15 |
36131 | 48 |
*/ |
49 |
||
37791
ae33107fd8b3
8155928: Remove hardcoded port numbers from httpclient/Security.java test
michaelm
parents:
36131
diff
changeset
|
50 |
// Tests 1, 10, 11 and 12 executed from Driver |
ae33107fd8b3
8155928: Remove hardcoded port numbers from httpclient/Security.java test
michaelm
parents:
36131
diff
changeset
|
51 |
|
41890
ab67b8f4f2fe
8169002: Several java/net/httpclient have undeclared dependency on java.logging module
skovalev
parents:
40684
diff
changeset
|
52 |
import com.sun.net.httpserver.Headers; |
ab67b8f4f2fe
8169002: Several java/net/httpclient have undeclared dependency on java.logging module
skovalev
parents:
40684
diff
changeset
|
53 |
import com.sun.net.httpserver.HttpExchange; |
ab67b8f4f2fe
8169002: Several java/net/httpclient have undeclared dependency on java.logging module
skovalev
parents:
40684
diff
changeset
|
54 |
import com.sun.net.httpserver.HttpHandler; |
ab67b8f4f2fe
8169002: Several java/net/httpclient have undeclared dependency on java.logging module
skovalev
parents:
40684
diff
changeset
|
55 |
import com.sun.net.httpserver.HttpServer; |
ab67b8f4f2fe
8169002: Several java/net/httpclient have undeclared dependency on java.logging module
skovalev
parents:
40684
diff
changeset
|
56 |
import com.sun.net.httpserver.HttpsServer; |
36131 | 57 |
import java.io.IOException; |
58 |
import java.io.InputStream; |
|
59 |
import java.io.File; |
|
60 |
import java.io.OutputStream; |
|
61 |
import java.lang.reflect.Constructor; |
|
41890
ab67b8f4f2fe
8169002: Several java/net/httpclient have undeclared dependency on java.logging module
skovalev
parents:
40684
diff
changeset
|
62 |
import java.net.BindException; |
49765 | 63 |
import java.net.InetAddress; |
41890
ab67b8f4f2fe
8169002: Several java/net/httpclient have undeclared dependency on java.logging module
skovalev
parents:
40684
diff
changeset
|
64 |
import java.net.InetSocketAddress; |
ab67b8f4f2fe
8169002: Several java/net/httpclient have undeclared dependency on java.logging module
skovalev
parents:
40684
diff
changeset
|
65 |
import java.net.ProxySelector; |
ab67b8f4f2fe
8169002: Several java/net/httpclient have undeclared dependency on java.logging module
skovalev
parents:
40684
diff
changeset
|
66 |
import java.net.URI; |
ab67b8f4f2fe
8169002: Several java/net/httpclient have undeclared dependency on java.logging module
skovalev
parents:
40684
diff
changeset
|
67 |
import java.net.URLClassLoader; |
ab67b8f4f2fe
8169002: Several java/net/httpclient have undeclared dependency on java.logging module
skovalev
parents:
40684
diff
changeset
|
68 |
import java.net.URL; |
49765 | 69 |
import java.net.http.HttpHeaders; |
70 |
import java.net.http.HttpClient; |
|
71 |
import java.net.http.HttpRequest; |
|
72 |
import java.net.http.HttpResponse; |
|
36131 | 73 |
import java.nio.charset.StandardCharsets; |
74 |
import java.nio.file.Files; |
|
75 |
import java.nio.file.Path; |
|
76 |
import java.nio.ByteBuffer; |
|
77 |
import java.nio.file.Paths; |
|
78 |
import java.nio.file.StandardCopyOption; |
|
79 |
import java.util.LinkedList; |
|
80 |
import java.util.List; |
|
41890
ab67b8f4f2fe
8169002: Several java/net/httpclient have undeclared dependency on java.logging module
skovalev
parents:
40684
diff
changeset
|
81 |
import java.util.concurrent.CompletableFuture; |
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
82 |
import java.util.concurrent.CompletionException; |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
83 |
import java.util.concurrent.CompletionStage; |
41890
ab67b8f4f2fe
8169002: Several java/net/httpclient have undeclared dependency on java.logging module
skovalev
parents:
40684
diff
changeset
|
84 |
import java.util.concurrent.ExecutionException; |
ab67b8f4f2fe
8169002: Several java/net/httpclient have undeclared dependency on java.logging module
skovalev
parents:
40684
diff
changeset
|
85 |
import java.util.concurrent.Executors; |
ab67b8f4f2fe
8169002: Several java/net/httpclient have undeclared dependency on java.logging module
skovalev
parents:
40684
diff
changeset
|
86 |
import java.util.concurrent.ExecutorService; |
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
87 |
import java.util.concurrent.Flow; |
36131 | 88 |
import java.util.logging.ConsoleHandler; |
89 |
import java.util.logging.Level; |
|
90 |
import java.util.logging.Logger; |
|
37897
bc8dc7bc4a03
8156801: java/net/httpclient/security/Driver.java failed with RuntimeException: Non zero return value
michaelm
parents:
37791
diff
changeset
|
91 |
import java.lang.reflect.InvocationTargetException; |
49765 | 92 |
import static java.net.http.HttpResponse.BodyHandlers.ofString; |
36131 | 93 |
|
94 |
/** |
|
95 |
* Security checks test |
|
96 |
*/ |
|
97 |
public class Security { |
|
98 |
||
49765 | 99 |
static HttpServer s1; |
100 |
static ExecutorService executor; |
|
37791
ae33107fd8b3
8155928: Remove hardcoded port numbers from httpclient/Security.java test
michaelm
parents:
36131
diff
changeset
|
101 |
static int port, proxyPort; |
36131 | 102 |
static HttpClient client; |
103 |
static String httproot, fileuri, fileroot, redirectroot; |
|
104 |
static List<HttpClient> clients = new LinkedList<>(); |
|
105 |
static URI uri; |
|
106 |
||
49765 | 107 |
interface ThrowingRunnable { void run() throws Throwable; } |
36131 | 108 |
|
109 |
static class TestAndResult { |
|
49765 | 110 |
private final ThrowingRunnable runnable; |
111 |
private final boolean expectSecurityException; |
|
112 |
||
113 |
TestAndResult(boolean expectSecurityException, ThrowingRunnable runnable) { |
|
114 |
this.expectSecurityException = expectSecurityException; |
|
115 |
this.runnable = runnable; |
|
116 |
} |
|
117 |
||
118 |
static TestAndResult of(boolean expectSecurityException, |
|
119 |
ThrowingRunnable runnable) { |
|
120 |
return new TestAndResult(expectSecurityException, runnable); |
|
121 |
} |
|
36131 | 122 |
|
49765 | 123 |
void runWithPolicy(String policy) { |
124 |
System.out.println("Using policy file: " + policy); |
|
125 |
try { |
|
126 |
runnable.run(); |
|
127 |
if (expectSecurityException) { |
|
128 |
String msg = "FAILED: expected security exception not thrown"; |
|
129 |
System.out.println(msg); |
|
130 |
throw new RuntimeException(msg); |
|
131 |
} |
|
132 |
System.out.println (policy + " succeeded as expected"); |
|
133 |
} catch (BindException e) { |
|
134 |
System.exit(10); |
|
135 |
} catch (SecurityException e) { |
|
136 |
if (!expectSecurityException) { |
|
137 |
System.out.println("UNEXPECTED security Exception: " + e); |
|
138 |
throw new RuntimeException("UNEXPECTED security Exception", e); |
|
139 |
} |
|
140 |
System.out.println(policy + " threw SecurityException as expected: " + e); |
|
141 |
} catch (Throwable t) { |
|
142 |
throw new AssertionError(t); |
|
143 |
} |
|
36131 | 144 |
} |
145 |
} |
|
146 |
||
49765 | 147 |
static TestAndResult[] tests = createTests(); |
36131 | 148 |
static String testclasses; |
149 |
static File subdir; |
|
150 |
||
151 |
/** |
|
152 |
* The ProxyServer class is compiled by jtreg, but we want to |
|
153 |
* move it so it is not on the application claspath. We want to |
|
154 |
* load it through a separate classloader so that it has a separate |
|
155 |
* protection domain and security permissions. |
|
156 |
* |
|
157 |
* Its permissions are in the second grant block in each policy file |
|
158 |
*/ |
|
159 |
static void setupProxy() throws IOException, ClassNotFoundException, NoSuchMethodException { |
|
160 |
testclasses = System.getProperty("test.classes"); |
|
161 |
subdir = new File (testclasses, "proxydir"); |
|
162 |
subdir.mkdir(); |
|
163 |
||
164 |
movefile("ProxyServer.class"); |
|
165 |
movefile("ProxyServer$Connection.class"); |
|
166 |
movefile("ProxyServer$1.class"); |
|
167 |
||
49765 | 168 |
URL url = subdir.toURI().toURL(); |
36131 | 169 |
System.out.println("URL for class loader = " + url); |
170 |
URLClassLoader urlc = new URLClassLoader(new URL[] {url}); |
|
171 |
proxyClass = Class.forName("ProxyServer", true, urlc); |
|
172 |
proxyConstructor = proxyClass.getConstructor(Integer.class, Boolean.class); |
|
173 |
} |
|
174 |
||
175 |
static void movefile(String f) throws IOException { |
|
176 |
Path src = Paths.get(testclasses, f); |
|
177 |
Path dest = subdir.toPath().resolve(f); |
|
178 |
if (!dest.toFile().exists()) { |
|
179 |
System.out.printf("moving %s to %s\n", src.toString(), dest.toString()); |
|
180 |
Files.move(src, dest, StandardCopyOption.REPLACE_EXISTING); |
|
37791
ae33107fd8b3
8155928: Remove hardcoded port numbers from httpclient/Security.java test
michaelm
parents:
36131
diff
changeset
|
181 |
} else if (src.toFile().exists()) { |
ae33107fd8b3
8155928: Remove hardcoded port numbers from httpclient/Security.java test
michaelm
parents:
36131
diff
changeset
|
182 |
System.out.printf("%s exists, deleting %s\n", dest.toString(), src.toString()); |
ae33107fd8b3
8155928: Remove hardcoded port numbers from httpclient/Security.java test
michaelm
parents:
36131
diff
changeset
|
183 |
Files.delete(src); |
36131 | 184 |
} else { |
185 |
System.out.printf("NOT moving %s to %s\n", src.toString(), dest.toString()); |
|
186 |
} |
|
187 |
} |
|
188 |
||
49765 | 189 |
static Object createProxy(int port, boolean b) throws Throwable { |
37897
bc8dc7bc4a03
8156801: java/net/httpclient/security/Driver.java failed with RuntimeException: Non zero return value
michaelm
parents:
37791
diff
changeset
|
190 |
try { |
bc8dc7bc4a03
8156801: java/net/httpclient/security/Driver.java failed with RuntimeException: Non zero return value
michaelm
parents:
37791
diff
changeset
|
191 |
return proxyConstructor.newInstance(port, b); |
bc8dc7bc4a03
8156801: java/net/httpclient/security/Driver.java failed with RuntimeException: Non zero return value
michaelm
parents:
37791
diff
changeset
|
192 |
} catch (InvocationTargetException e) { |
bc8dc7bc4a03
8156801: java/net/httpclient/security/Driver.java failed with RuntimeException: Non zero return value
michaelm
parents:
37791
diff
changeset
|
193 |
throw e.getTargetException(); |
bc8dc7bc4a03
8156801: java/net/httpclient/security/Driver.java failed with RuntimeException: Non zero return value
michaelm
parents:
37791
diff
changeset
|
194 |
} |
36131 | 195 |
} |
196 |
||
197 |
static Class<?> proxyClass; |
|
198 |
static Constructor<?> proxyConstructor; |
|
199 |
||
49765 | 200 |
static TestAndResult[] createTests() { |
201 |
return new TestAndResult[] { |
|
36131 | 202 |
// (0) policy does not have permission for file. Should fail |
49765 | 203 |
TestAndResult.of(true, () -> { // Policy 0 |
204 |
URI u = URI.create("http://localhost:" + port + "/files/foo.txt"); |
|
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
205 |
HttpRequest request = HttpRequest.newBuilder(u).GET().build(); |
49765 | 206 |
HttpResponse<?> response = client.send(request, ofString()); |
207 |
System.out.println("Received response:" + response); |
|
36131 | 208 |
}), |
209 |
// (1) policy has permission for file URL |
|
49765 | 210 |
TestAndResult.of(false, () -> { //Policy 1 |
211 |
URI u = URI.create("http://localhost:" + port + "/files/foo.txt"); |
|
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
212 |
HttpRequest request = HttpRequest.newBuilder(u).GET().build(); |
49765 | 213 |
HttpResponse<?> response = client.send(request, ofString()); |
214 |
System.out.println("Received response:" + response); |
|
36131 | 215 |
}), |
216 |
// (2) policy has permission for all file URLs under /files |
|
49765 | 217 |
TestAndResult.of(false, () -> { // Policy 2 |
218 |
URI u = URI.create("http://localhost:" + port + "/files/foo.txt"); |
|
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
219 |
HttpRequest request = HttpRequest.newBuilder(u).GET().build(); |
49765 | 220 |
HttpResponse<?> response = client.send(request, ofString()); |
221 |
System.out.println("Received response:" + response); |
|
36131 | 222 |
}), |
223 |
// (3) policy has permission for first URL but not redirected URL |
|
49765 | 224 |
TestAndResult.of(true, () -> { // Policy 3 |
225 |
URI u = URI.create("http://localhost:" + port + "/redirect/foo.txt"); |
|
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
226 |
HttpRequest request = HttpRequest.newBuilder(u).GET().build(); |
49765 | 227 |
HttpResponse<?> response = client.send(request, ofString()); |
228 |
System.out.println("Received response:" + response); |
|
36131 | 229 |
}), |
230 |
// (4) policy has permission for both first URL and redirected URL |
|
49765 | 231 |
TestAndResult.of(false, () -> { // Policy 4 |
232 |
URI u = URI.create("http://localhost:" + port + "/redirect/foo.txt"); |
|
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
233 |
HttpRequest request = HttpRequest.newBuilder(u).GET().build(); |
49765 | 234 |
HttpResponse<?> response = client.send(request, ofString()); |
235 |
System.out.println("Received response:" + response); |
|
36131 | 236 |
}), |
237 |
// (5) policy has permission for redirected but not first URL |
|
49765 | 238 |
TestAndResult.of(true, () -> { // Policy 5 |
239 |
URI u = URI.create("http://localhost:" + port + "/redirect/foo.txt"); |
|
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
240 |
HttpRequest request = HttpRequest.newBuilder(u).GET().build(); |
49765 | 241 |
HttpResponse<?> response = client.send(request, ofString()); |
242 |
System.out.println("Received response:" + response); |
|
36131 | 243 |
}), |
244 |
// (6) policy has permission for file URL, but not method |
|
49765 | 245 |
TestAndResult.of(true, () -> { //Policy 6 |
246 |
URI u = URI.create("http://localhost:" + port + "/files/foo.txt"); |
|
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
247 |
HttpRequest request = HttpRequest.newBuilder(u).GET().build(); |
49765 | 248 |
HttpResponse<?> response = client.send(request, ofString()); |
249 |
System.out.println("Received response:" + response); |
|
36131 | 250 |
}), |
251 |
// (7) policy has permission for file URL, method, but not header |
|
49765 | 252 |
TestAndResult.of(true, () -> { //Policy 7 |
253 |
URI u = URI.create("http://localhost:" + port + "/files/foo.txt"); |
|
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
254 |
HttpRequest request = HttpRequest.newBuilder(u) |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
255 |
.header("X-Foo", "bar") |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
256 |
.GET() |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
257 |
.build(); |
49765 | 258 |
HttpResponse<?> response = client.send(request, ofString()); |
259 |
System.out.println("Received response:" + response); |
|
36131 | 260 |
}), |
261 |
// (8) policy has permission for file URL, method and header |
|
49765 | 262 |
TestAndResult.of(false, () -> { //Policy 8 |
263 |
URI u = URI.create("http://localhost:" + port + "/files/foo.txt"); |
|
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
264 |
HttpRequest request = HttpRequest.newBuilder(u) |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
265 |
.header("X-Foo", "bar") |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
266 |
.GET() |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
267 |
.build(); |
49765 | 268 |
HttpResponse<?> response = client.send(request, ofString()); |
269 |
System.out.println("Received response:" + response); |
|
36131 | 270 |
}), |
271 |
// (9) policy has permission for file URL, method and header |
|
49765 | 272 |
TestAndResult.of(false, () -> { //Policy 9 |
273 |
URI u = URI.create("http://localhost:" + port + "/files/foo.txt"); |
|
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
274 |
HttpRequest request = HttpRequest.newBuilder(u) |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
275 |
.headers("X-Foo", "bar", "X-Bar", "foo") |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
276 |
.GET() |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
277 |
.build(); |
49765 | 278 |
HttpResponse<?> response = client.send(request, ofString()); |
279 |
System.out.println("Received response:" + response); |
|
36131 | 280 |
}), |
281 |
// (10) policy has permission for destination URL but not for proxy |
|
49765 | 282 |
TestAndResult.of(true, () -> { //Policy 10 |
37791
ae33107fd8b3
8155928: Remove hardcoded port numbers from httpclient/Security.java test
michaelm
parents:
36131
diff
changeset
|
283 |
directProxyTest(proxyPort, true); |
36131 | 284 |
}), |
285 |
// (11) policy has permission for both destination URL and proxy |
|
49765 | 286 |
TestAndResult.of(false, () -> { //Policy 11 |
37791
ae33107fd8b3
8155928: Remove hardcoded port numbers from httpclient/Security.java test
michaelm
parents:
36131
diff
changeset
|
287 |
directProxyTest(proxyPort, true); |
36131 | 288 |
}), |
289 |
// (12) policy has permission for both destination URL and proxy |
|
49765 | 290 |
TestAndResult.of(true, () -> { //Policy 12 ( 11 & 12 are the same ) |
37791
ae33107fd8b3
8155928: Remove hardcoded port numbers from httpclient/Security.java test
michaelm
parents:
36131
diff
changeset
|
291 |
directProxyTest(proxyPort, false); |
36131 | 292 |
}), |
293 |
// (13) async version of test 0 |
|
49765 | 294 |
TestAndResult.of(true, () -> { // Policy 0 |
295 |
URI u = URI.create("http://localhost:" + port + "/files/foo.txt"); |
|
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
296 |
HttpRequest request = HttpRequest.newBuilder(u).GET().build(); |
36131 | 297 |
try { |
49765 | 298 |
HttpResponse<?> response = client.sendAsync(request, ofString()).get(); |
299 |
System.out.println("Received response:" + response); |
|
36131 | 300 |
} catch (ExecutionException e) { |
301 |
if (e.getCause() instanceof SecurityException) { |
|
302 |
throw (SecurityException)e.getCause(); |
|
303 |
} else { |
|
304 |
throw new RuntimeException(e); |
|
305 |
} |
|
306 |
} |
|
307 |
}), |
|
308 |
// (14) async version of test 1 |
|
49765 | 309 |
TestAndResult.of(false, () -> { //Policy 1 |
310 |
URI u = URI.create("http://localhost:" + port + "/files/foo.txt"); |
|
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
311 |
HttpRequest request = HttpRequest.newBuilder(u).GET().build(); |
36131 | 312 |
try { |
49765 | 313 |
HttpResponse<?> response = client.sendAsync(request, ofString()).get(); |
314 |
System.out.println("Received response:" + response); |
|
36131 | 315 |
} catch (ExecutionException e) { |
316 |
if (e.getCause() instanceof SecurityException) { |
|
317 |
throw (SecurityException)e.getCause(); |
|
318 |
} else { |
|
319 |
throw new RuntimeException(e); |
|
320 |
} |
|
321 |
} |
|
322 |
}), |
|
323 |
// (15) check that user provided unprivileged code running on a worker |
|
324 |
// thread does not gain ungranted privileges. |
|
49765 | 325 |
TestAndResult.of(true, () -> { //Policy 12 |
326 |
URI u = URI.create("http://localhost:" + port + "/files/foo.txt"); |
|
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
327 |
HttpRequest request = HttpRequest.newBuilder(u).GET().build(); |
49765 | 328 |
HttpResponse.BodyHandler<String> sth = ofString(); |
36131 | 329 |
|
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
330 |
CompletableFuture<HttpResponse<String>> cf = |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
331 |
client.sendAsync(request, new HttpResponse.BodyHandler<String>() { |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
332 |
@Override |
49765 | 333 |
public HttpResponse.BodySubscriber<String> apply(HttpResponse.ResponseInfo rinfo) { |
334 |
final HttpResponse.BodySubscriber<String> stproc = sth.apply(rinfo); |
|
48083 | 335 |
return new HttpResponse.BodySubscriber<String>() { |
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
336 |
@Override |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
337 |
public CompletionStage<String> getBody() { |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
338 |
return stproc.getBody(); |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
339 |
} |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
340 |
@Override |
48083 | 341 |
public void onNext(List<ByteBuffer> item) { |
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
342 |
SecurityManager sm = System.getSecurityManager(); |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
343 |
// should succeed. |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
344 |
sm.checkPermission(new RuntimePermission("foobar")); |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
345 |
// do some mischief here |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
346 |
System.setSecurityManager(null); |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
347 |
System.setSecurityManager(sm); |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
348 |
// problem if we get this far |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
349 |
stproc.onNext(item); |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
350 |
} |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
351 |
@Override |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
352 |
public void onSubscribe(Flow.Subscription subscription) { |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
353 |
stproc.onSubscribe(subscription); |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
354 |
} |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
355 |
@Override |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
356 |
public void onError(Throwable throwable) { |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
357 |
stproc.onError(throwable); |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
358 |
} |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
359 |
@Override |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
360 |
public void onComplete() { |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
361 |
stproc.onComplete(); |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
362 |
} |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
363 |
}; |
36131 | 364 |
} |
365 |
} |
|
366 |
); |
|
367 |
try { |
|
49765 | 368 |
HttpResponse<String> response = cf.join(); |
369 |
System.out.println("Received response:" + response); |
|
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
370 |
} catch (CompletionException e) { |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
371 |
Throwable t = e.getCause(); |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
372 |
if (t instanceof SecurityException) |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
373 |
throw (SecurityException)t; |
48083 | 374 |
else if ((t instanceof IOException) |
375 |
&& (t.getCause() instanceof SecurityException)) |
|
376 |
throw ((SecurityException)t.getCause()); |
|
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
377 |
else |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
378 |
throw new RuntimeException(t); |
36131 | 379 |
} |
52554
5f1ca46703f9
8213189: Make restricted headers in HTTP Client configurable and remove Date by default
michaelm
parents:
52121
diff
changeset
|
380 |
}), |
5f1ca46703f9
8213189: Make restricted headers in HTTP Client configurable and remove Date by default
michaelm
parents:
52121
diff
changeset
|
381 |
// (16) allowed to set Host header but does not have permission |
5f1ca46703f9
8213189: Make restricted headers in HTTP Client configurable and remove Date by default
michaelm
parents:
52121
diff
changeset
|
382 |
TestAndResult.of(true, () -> { //Policy 16 |
5f1ca46703f9
8213189: Make restricted headers in HTTP Client configurable and remove Date by default
michaelm
parents:
52121
diff
changeset
|
383 |
URI u = URI.create("http://localhost:" + port + "/files/foo.txt"); |
5f1ca46703f9
8213189: Make restricted headers in HTTP Client configurable and remove Date by default
michaelm
parents:
52121
diff
changeset
|
384 |
HttpRequest request = HttpRequest.newBuilder(u) |
5f1ca46703f9
8213189: Make restricted headers in HTTP Client configurable and remove Date by default
michaelm
parents:
52121
diff
changeset
|
385 |
.header("Host", "foohost:123") |
5f1ca46703f9
8213189: Make restricted headers in HTTP Client configurable and remove Date by default
michaelm
parents:
52121
diff
changeset
|
386 |
.GET().build(); |
5f1ca46703f9
8213189: Make restricted headers in HTTP Client configurable and remove Date by default
michaelm
parents:
52121
diff
changeset
|
387 |
HttpResponse<?> response = client.send(request, ofString()); |
5f1ca46703f9
8213189: Make restricted headers in HTTP Client configurable and remove Date by default
michaelm
parents:
52121
diff
changeset
|
388 |
System.out.println("Received response:" + response); |
5f1ca46703f9
8213189: Make restricted headers in HTTP Client configurable and remove Date by default
michaelm
parents:
52121
diff
changeset
|
389 |
}), |
5f1ca46703f9
8213189: Make restricted headers in HTTP Client configurable and remove Date by default
michaelm
parents:
52121
diff
changeset
|
390 |
// (17) allowed to set Host header and does have permission |
5f1ca46703f9
8213189: Make restricted headers in HTTP Client configurable and remove Date by default
michaelm
parents:
52121
diff
changeset
|
391 |
TestAndResult.of(false, () -> { //Policy 17 |
5f1ca46703f9
8213189: Make restricted headers in HTTP Client configurable and remove Date by default
michaelm
parents:
52121
diff
changeset
|
392 |
URI u = URI.create("http://localhost:" + port + "/files/foo.txt"); |
5f1ca46703f9
8213189: Make restricted headers in HTTP Client configurable and remove Date by default
michaelm
parents:
52121
diff
changeset
|
393 |
HttpRequest request = HttpRequest.newBuilder(u) |
5f1ca46703f9
8213189: Make restricted headers in HTTP Client configurable and remove Date by default
michaelm
parents:
52121
diff
changeset
|
394 |
.header("Host", "foohost:123") |
5f1ca46703f9
8213189: Make restricted headers in HTTP Client configurable and remove Date by default
michaelm
parents:
52121
diff
changeset
|
395 |
.GET().build(); |
5f1ca46703f9
8213189: Make restricted headers in HTTP Client configurable and remove Date by default
michaelm
parents:
52121
diff
changeset
|
396 |
HttpResponse<?> response = client.send(request, ofString()); |
5f1ca46703f9
8213189: Make restricted headers in HTTP Client configurable and remove Date by default
michaelm
parents:
52121
diff
changeset
|
397 |
System.out.println("Received response:" + response); |
36131 | 398 |
}) |
399 |
}; |
|
400 |
} |
|
401 |
||
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
402 |
private static void directProxyTest(int proxyPort, boolean samePort) |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
403 |
throws IOException, InterruptedException |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
404 |
{ |
49765 | 405 |
System.out.println("proxyPort:" + proxyPort + ", samePort:" + samePort); |
406 |
||
407 |
int p = proxyPort; |
|
408 |
if (samePort) { |
|
409 |
Object proxy; |
|
410 |
try { |
|
411 |
proxy = createProxy(p, true); |
|
412 |
} catch (BindException e) { |
|
413 |
System.out.println("Bind failed"); |
|
414 |
throw e; |
|
415 |
} catch (Throwable ee) { |
|
416 |
throw new RuntimeException(ee); |
|
417 |
} |
|
418 |
} else { |
|
419 |
while (p == proxyPort || p == port) { |
|
420 |
// avoid ports that may be granted permission |
|
421 |
p++; |
|
422 |
if (p > 65535) { |
|
423 |
p = 32000; // overflow |
|
424 |
} |
|
425 |
} |
|
36131 | 426 |
} |
49765 | 427 |
System.out.println("Proxy port, p:" + p); |
36131 | 428 |
|
49765 | 429 |
InetSocketAddress addr = new InetSocketAddress(InetAddress.getLoopbackAddress(), |
430 |
p); |
|
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
431 |
HttpClient cl = HttpClient.newBuilder() |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
432 |
.proxy(ProxySelector.of(addr)) |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
433 |
.build(); |
36131 | 434 |
clients.add(cl); |
435 |
||
49765 | 436 |
URI u = URI.create("http://localhost:" + port + "/files/foo.txt"); |
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
437 |
HttpRequest request = HttpRequest.newBuilder(u) |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
438 |
.headers("X-Foo", "bar", "X-Bar", "foo") |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
439 |
.build(); |
49765 | 440 |
HttpResponse<?> response = cl.send(request, ofString()); |
441 |
System.out.println("Received response:" + response); |
|
36131 | 442 |
} |
443 |
||
444 |
public static void main(String[] args) throws Exception { |
|
37791
ae33107fd8b3
8155928: Remove hardcoded port numbers from httpclient/Security.java test
michaelm
parents:
36131
diff
changeset
|
445 |
try { |
ae33107fd8b3
8155928: Remove hardcoded port numbers from httpclient/Security.java test
michaelm
parents:
36131
diff
changeset
|
446 |
initServer(); |
ae33107fd8b3
8155928: Remove hardcoded port numbers from httpclient/Security.java test
michaelm
parents:
36131
diff
changeset
|
447 |
setupProxy(); |
ae33107fd8b3
8155928: Remove hardcoded port numbers from httpclient/Security.java test
michaelm
parents:
36131
diff
changeset
|
448 |
} catch (BindException e) { |
ae33107fd8b3
8155928: Remove hardcoded port numbers from httpclient/Security.java test
michaelm
parents:
36131
diff
changeset
|
449 |
System.exit(10); |
ae33107fd8b3
8155928: Remove hardcoded port numbers from httpclient/Security.java test
michaelm
parents:
36131
diff
changeset
|
450 |
} |
49765 | 451 |
fileroot = System.getProperty("test.src")+ "/docs"; |
36131 | 452 |
int testnum = Integer.parseInt(args[0]); |
453 |
String policy = args[0]; |
|
454 |
||
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
455 |
client = HttpClient.newBuilder() |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
456 |
.followRedirects(HttpClient.Redirect.ALWAYS) |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
41890
diff
changeset
|
457 |
.build(); |
36131 | 458 |
|
459 |
clients.add(client); |
|
460 |
||
461 |
try { |
|
462 |
TestAndResult tr = tests[testnum]; |
|
49765 | 463 |
tr.runWithPolicy(policy); |
36131 | 464 |
} finally { |
465 |
s1.stop(0); |
|
37791
ae33107fd8b3
8155928: Remove hardcoded port numbers from httpclient/Security.java test
michaelm
parents:
36131
diff
changeset
|
466 |
executor.shutdownNow(); |
36131 | 467 |
} |
468 |
} |
|
469 |
||
37791
ae33107fd8b3
8155928: Remove hardcoded port numbers from httpclient/Security.java test
michaelm
parents:
36131
diff
changeset
|
470 |
public static void initServer() throws Exception { |
ae33107fd8b3
8155928: Remove hardcoded port numbers from httpclient/Security.java test
michaelm
parents:
36131
diff
changeset
|
471 |
String portstring = System.getProperty("port.number"); |
ae33107fd8b3
8155928: Remove hardcoded port numbers from httpclient/Security.java test
michaelm
parents:
36131
diff
changeset
|
472 |
port = portstring != null ? Integer.parseInt(portstring) : 0; |
ae33107fd8b3
8155928: Remove hardcoded port numbers from httpclient/Security.java test
michaelm
parents:
36131
diff
changeset
|
473 |
portstring = System.getProperty("port.number1"); |
ae33107fd8b3
8155928: Remove hardcoded port numbers from httpclient/Security.java test
michaelm
parents:
36131
diff
changeset
|
474 |
proxyPort = portstring != null ? Integer.parseInt(portstring) : 0; |
36131 | 475 |
|
476 |
Logger logger = Logger.getLogger("com.sun.net.httpserver"); |
|
477 |
ConsoleHandler ch = new ConsoleHandler(); |
|
478 |
logger.setLevel(Level.ALL); |
|
479 |
ch.setLevel(Level.ALL); |
|
480 |
logger.addHandler(ch); |
|
49765 | 481 |
String root = System.getProperty("test.src")+ "/docs"; |
482 |
InetSocketAddress addr = new InetSocketAddress(InetAddress.getLoopbackAddress(), port); |
|
36131 | 483 |
s1 = HttpServer.create (addr, 0); |
484 |
if (s1 instanceof HttpsServer) { |
|
49765 | 485 |
throw new RuntimeException("should not be httpsserver"); |
36131 | 486 |
} |
49765 | 487 |
s1.createContext("/files", new FileServerHandler(root)); |
488 |
s1.createContext("/redirect", new RedirectHandler("/redirect")); |
|
36131 | 489 |
|
490 |
executor = Executors.newCachedThreadPool(); |
|
49765 | 491 |
s1.setExecutor(executor); |
36131 | 492 |
s1.start(); |
493 |
||
37791
ae33107fd8b3
8155928: Remove hardcoded port numbers from httpclient/Security.java test
michaelm
parents:
36131
diff
changeset
|
494 |
if (port == 0) |
ae33107fd8b3
8155928: Remove hardcoded port numbers from httpclient/Security.java test
michaelm
parents:
36131
diff
changeset
|
495 |
port = s1.getAddress().getPort(); |
ae33107fd8b3
8155928: Remove hardcoded port numbers from httpclient/Security.java test
michaelm
parents:
36131
diff
changeset
|
496 |
else { |
ae33107fd8b3
8155928: Remove hardcoded port numbers from httpclient/Security.java test
michaelm
parents:
36131
diff
changeset
|
497 |
if (s1.getAddress().getPort() != port) |
ae33107fd8b3
8155928: Remove hardcoded port numbers from httpclient/Security.java test
michaelm
parents:
36131
diff
changeset
|
498 |
throw new RuntimeException("Error wrong port"); |
ae33107fd8b3
8155928: Remove hardcoded port numbers from httpclient/Security.java test
michaelm
parents:
36131
diff
changeset
|
499 |
System.out.println("Port was assigned by Driver"); |
ae33107fd8b3
8155928: Remove hardcoded port numbers from httpclient/Security.java test
michaelm
parents:
36131
diff
changeset
|
500 |
} |
36131 | 501 |
System.out.println("HTTP server port = " + port); |
49765 | 502 |
httproot = "http://localhost:" + port + "/files/"; |
503 |
redirectroot = "http://localhost:" + port + "/redirect/"; |
|
36131 | 504 |
uri = new URI(httproot); |
505 |
fileuri = httproot + "foo.txt"; |
|
506 |
} |
|
507 |
||
508 |
static class RedirectHandler implements HttpHandler { |
|
509 |
||
510 |
String root; |
|
511 |
int count = 0; |
|
512 |
||
513 |
RedirectHandler(String root) { |
|
514 |
this.root = root; |
|
515 |
} |
|
516 |
||
517 |
synchronized int count() { |
|
518 |
return count; |
|
519 |
} |
|
520 |
||
521 |
synchronized void increment() { |
|
522 |
count++; |
|
523 |
} |
|
524 |
||
525 |
@Override |
|
49765 | 526 |
public synchronized void handle(HttpExchange t) throws IOException { |
36131 | 527 |
System.out.println("Server: " + t.getRequestURI()); |
528 |
try (InputStream is = t.getRequestBody()) { |
|
49765 | 529 |
is.readAllBytes(); |
36131 | 530 |
} |
531 |
increment(); |
|
532 |
if (count() == 1) { |
|
533 |
Headers map = t.getResponseHeaders(); |
|
534 |
String redirect = "/redirect/bar.txt"; |
|
535 |
map.add("Location", redirect); |
|
536 |
t.sendResponseHeaders(301, -1); |
|
537 |
t.close(); |
|
538 |
} else { |
|
539 |
String response = "Hello world"; |
|
540 |
t.sendResponseHeaders(200, response.length()); |
|
541 |
OutputStream os = t.getResponseBody(); |
|
542 |
os.write(response.getBytes(StandardCharsets.ISO_8859_1)); |
|
543 |
t.close(); |
|
544 |
} |
|
545 |
} |
|
546 |
} |
|
547 |
} |