author | michaelm |
Mon, 11 Dec 2017 16:43:11 +0000 | |
branch | http-client-branch |
changeset 55981 | 907bddce488c |
parent 55973 | 4d9b002587db |
child 55982 | b6ff245c0db6 |
permissions | -rw-r--r-- |
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
1 |
/* |
48083 | 2 |
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. |
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
4 |
* |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. Oracle designates this |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
8 |
* particular file as subject to the "Classpath" exception as provided |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
10 |
* |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
15 |
* accompanied this code). |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
16 |
* |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License version |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
20 |
* |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
22 |
* or visit www.oracle.com if you need additional information or have any |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
23 |
* questions. |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
24 |
*/ |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
25 |
|
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
26 |
package jdk.incubator.http; |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
27 |
|
48083 | 28 |
import java.lang.System.Logger.Level; |
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
29 |
import java.net.InetSocketAddress; |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
30 |
import java.net.URI; |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
31 |
import java.util.Base64; |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
32 |
import java.util.Collections; |
48083 | 33 |
import java.util.HashSet; |
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
34 |
import java.util.HashMap; |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
35 |
import java.util.Map; |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
36 |
import java.util.Set; |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
37 |
import java.util.concurrent.ConcurrentHashMap; |
48083 | 38 |
import java.util.concurrent.CompletableFuture; |
39 |
import jdk.incubator.http.internal.common.MinimalFuture; |
|
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
40 |
import jdk.incubator.http.internal.common.Utils; |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
41 |
import jdk.incubator.http.internal.frame.SettingsFrame; |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
42 |
import static jdk.incubator.http.internal.frame.SettingsFrame.INITIAL_WINDOW_SIZE; |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
43 |
import static jdk.incubator.http.internal.frame.SettingsFrame.ENABLE_PUSH; |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
44 |
import static jdk.incubator.http.internal.frame.SettingsFrame.HEADER_TABLE_SIZE; |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
45 |
import static jdk.incubator.http.internal.frame.SettingsFrame.MAX_CONCURRENT_STREAMS; |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
46 |
import static jdk.incubator.http.internal.frame.SettingsFrame.MAX_FRAME_SIZE; |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
47 |
|
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
48 |
/** |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
49 |
* Http2 specific aspects of HttpClientImpl |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
50 |
*/ |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
51 |
class Http2ClientImpl { |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
52 |
|
48083 | 53 |
static final boolean DEBUG = Utils.DEBUG; // Revisit: temporary dev flag. |
54 |
final static System.Logger debug = |
|
55 |
Utils.getDebugLogger("Http2ClientImpl"::toString, DEBUG); |
|
56 |
||
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
57 |
private final HttpClientImpl client; |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
58 |
|
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
59 |
Http2ClientImpl(HttpClientImpl client) { |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
60 |
this.client = client; |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
61 |
} |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
62 |
|
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
63 |
/* Map key is "scheme:host:port" */ |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
64 |
private final Map<String,Http2Connection> connections = new ConcurrentHashMap<>(); |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
65 |
|
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
66 |
private final Set<String> opening = Collections.synchronizedSet(new HashSet<>()); |
48083 | 67 |
private final Map<String,Set<CompletableFuture<Http2Connection>>> waiting = |
68 |
Collections.synchronizedMap(new HashMap<>()); |
|
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
69 |
|
48083 | 70 |
private void addToWaiting(String key, CompletableFuture<Http2Connection> cf) { |
71 |
synchronized (waiting) { |
|
72 |
Set<CompletableFuture<Http2Connection>> waiters = waiting.get(key); |
|
73 |
if (waiters == null) { |
|
74 |
waiters = new HashSet<>(); |
|
75 |
waiting.put(key, waiters); |
|
76 |
} |
|
77 |
waiters.add(cf); |
|
78 |
} |
|
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
79 |
} |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
80 |
|
48083 | 81 |
// boolean haveConnectionFor(URI uri, InetSocketAddress proxy) { |
82 |
// return connections.containsKey(Http2Connection.keyFor(uri,proxy)); |
|
83 |
// } |
|
84 |
||
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
85 |
/** |
48083 | 86 |
* If a https request then async waits until a connection is opened. |
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
87 |
* Returns null if the request is 'http' as a different (upgrade) |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
88 |
* mechanism is used. |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
89 |
* |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
90 |
* Only one connection per destination is created. Blocks when opening |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
91 |
* connection, or when waiting for connection to be opened. |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
92 |
* First thread opens the connection and notifies the others when done. |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
93 |
* |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
94 |
* If the request is secure (https) then we open the connection here. |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
95 |
* If not, then the more complicated upgrade from 1.1 to 2 happens (not here) |
55981
907bddce488c
http-client-branch: Fixed h2c connection reuse problem (connections not being reused/cached)
michaelm
parents:
55973
diff
changeset
|
96 |
* In latter case, when the Http2Connection is connected, offerConnection() must |
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
97 |
* be called to store it. |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
98 |
*/ |
48083 | 99 |
CompletableFuture<Http2Connection> getConnectionFor(HttpRequestImpl req) { |
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
100 |
URI uri = req.uri(); |
48083 | 101 |
InetSocketAddress proxy = req.proxy(); |
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
102 |
String key = Http2Connection.keyFor(uri, proxy); |
48083 | 103 |
|
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
104 |
synchronized (opening) { |
48083 | 105 |
Http2Connection connection = connections.get(key); |
106 |
if (connection != null) { // fast path if connection already exists |
|
107 |
return CompletableFuture.completedFuture(connection); |
|
108 |
} |
|
109 |
||
110 |
if (!req.secure()) { |
|
111 |
return MinimalFuture.completedFuture(null); |
|
112 |
} |
|
113 |
||
114 |
if (!opening.contains(key)) { |
|
115 |
debug.log(Level.DEBUG, "Opening: %s", key); |
|
116 |
opening.add(key); |
|
117 |
} else { |
|
118 |
CompletableFuture<Http2Connection> cf = new MinimalFuture<>(); |
|
119 |
addToWaiting(key, cf); |
|
120 |
return cf; |
|
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
121 |
} |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
122 |
} |
48083 | 123 |
return Http2Connection |
124 |
.createAsync(req, this) |
|
125 |
.whenComplete((conn, t) -> { |
|
126 |
debug.log(Level.DEBUG, |
|
127 |
"waking up dependents with created connection"); |
|
128 |
synchronized (opening) { |
|
129 |
Set<CompletableFuture<Http2Connection>> waiters = waiting.remove(key); |
|
130 |
debug.log(Level.DEBUG, "Opening completed: %s", key); |
|
131 |
opening.remove(key); |
|
132 |
if (t == null && conn != null) |
|
55981
907bddce488c
http-client-branch: Fixed h2c connection reuse problem (connections not being reused/cached)
michaelm
parents:
55973
diff
changeset
|
133 |
offerConnection(conn); |
48083 | 134 |
final Throwable cause = Utils.getCompletionCause(t); |
135 |
if (waiters == null) { |
|
136 |
debug.log(Level.DEBUG, "no dependent to wake up"); |
|
137 |
return; |
|
138 |
} else if (cause instanceof Http2Connection.ALPNException) { |
|
139 |
waiters.forEach((cf1) -> cf1.completeAsync(() -> null, |
|
140 |
client.theExecutor())); |
|
141 |
} else if (cause != null) { |
|
142 |
debug.log(Level.DEBUG, |
|
143 |
() -> "waking up dependants: failed: " + cause); |
|
144 |
waiters.forEach((cf1) -> cf1.completeExceptionally(cause)); |
|
145 |
} else { |
|
146 |
debug.log(Level.DEBUG, "waking up dependants: succeeded"); |
|
147 |
waiters.forEach((cf1) -> cf1.completeAsync(() -> conn, |
|
148 |
client.theExecutor())); |
|
149 |
} |
|
150 |
} |
|
151 |
}); |
|
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
152 |
} |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
153 |
|
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
154 |
/* |
55981
907bddce488c
http-client-branch: Fixed h2c connection reuse problem (connections not being reused/cached)
michaelm
parents:
55973
diff
changeset
|
155 |
* Cache the given connection, if no connection to the same |
907bddce488c
http-client-branch: Fixed h2c connection reuse problem (connections not being reused/cached)
michaelm
parents:
55973
diff
changeset
|
156 |
* destination exists. If one exists, then we let the initial stream |
907bddce488c
http-client-branch: Fixed h2c connection reuse problem (connections not being reused/cached)
michaelm
parents:
55973
diff
changeset
|
157 |
* complete but allow it to close itself upon completion. |
907bddce488c
http-client-branch: Fixed h2c connection reuse problem (connections not being reused/cached)
michaelm
parents:
55973
diff
changeset
|
158 |
* This situation should not arise with https because the request |
907bddce488c
http-client-branch: Fixed h2c connection reuse problem (connections not being reused/cached)
michaelm
parents:
55973
diff
changeset
|
159 |
* has not been sent as part of the initial alpn negotiation |
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
160 |
*/ |
55981
907bddce488c
http-client-branch: Fixed h2c connection reuse problem (connections not being reused/cached)
michaelm
parents:
55973
diff
changeset
|
161 |
boolean offerConnection(Http2Connection c) { |
907bddce488c
http-client-branch: Fixed h2c connection reuse problem (connections not being reused/cached)
michaelm
parents:
55973
diff
changeset
|
162 |
String key = c.key(); |
907bddce488c
http-client-branch: Fixed h2c connection reuse problem (connections not being reused/cached)
michaelm
parents:
55973
diff
changeset
|
163 |
Http2Connection c1 = connections.putIfAbsent(key, c); |
907bddce488c
http-client-branch: Fixed h2c connection reuse problem (connections not being reused/cached)
michaelm
parents:
55973
diff
changeset
|
164 |
return c1 == null; |
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
165 |
} |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
166 |
|
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
167 |
void deleteConnection(Http2Connection c) { |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
168 |
connections.remove(c.key()); |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
169 |
} |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
170 |
|
48083 | 171 |
void stop() { |
172 |
debug.log(Level.DEBUG, "stopping"); |
|
173 |
connections.values().forEach(this::close); |
|
174 |
connections.clear(); |
|
175 |
} |
|
176 |
||
177 |
private void close(Http2Connection h2c) { |
|
178 |
try { h2c.close(); } catch (Throwable t) {} |
|
179 |
} |
|
180 |
||
42460
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
181 |
HttpClientImpl client() { |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
182 |
return client; |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
183 |
} |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
184 |
|
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
185 |
/** Returns the client settings as a base64 (url) encoded string */ |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
186 |
String getSettingsString() { |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
187 |
SettingsFrame sf = getClientSettings(); |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
188 |
byte[] settings = sf.toByteArray(); // without the header |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
189 |
Base64.Encoder encoder = Base64.getUrlEncoder() |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
190 |
.withoutPadding(); |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
191 |
return encoder.encodeToString(settings); |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
192 |
} |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
193 |
|
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
194 |
private static final int K = 1024; |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
195 |
|
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
196 |
SettingsFrame getClientSettings() { |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
197 |
SettingsFrame frame = new SettingsFrame(); |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
198 |
frame.setParameter(HEADER_TABLE_SIZE, Utils.getIntegerNetProperty( |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
199 |
"jdk.httpclient.hpack.maxheadertablesize", 16 * K)); |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
200 |
frame.setParameter(ENABLE_PUSH, Utils.getIntegerNetProperty( |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
201 |
"jdk.httpclient.enablepush", 1)); |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
202 |
frame.setParameter(MAX_CONCURRENT_STREAMS, Utils.getIntegerNetProperty( |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
203 |
"jdk.httpclient.maxstreams", 16)); |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
204 |
frame.setParameter(INITIAL_WINDOW_SIZE, Utils.getIntegerNetProperty( |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
205 |
"jdk.httpclient.windowsize", 64 * K - 1)); |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
206 |
frame.setParameter(MAX_FRAME_SIZE, Utils.getIntegerNetProperty( |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
207 |
"jdk.httpclient.maxframesize", 16 * K)); |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
208 |
return frame; |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
209 |
} |
7133f144981a
8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff
changeset
|
210 |
} |