|
101 | 101 | import static org.asynchttpclient.config.AsyncHttpClientConfigDefaults.defaultUserAgent; |
102 | 102 | import static org.asynchttpclient.config.AsyncHttpClientConfigDefaults.defaultValidateResponseHeaders; |
103 | 103 | import static org.asynchttpclient.config.AsyncHttpClientConfigDefaults.defaultWebSocketMaxBufferSize; |
| 104 | +import static org.asynchttpclient.config.AsyncHttpClientConfigDefaults.defaultHttp2CleartextEnabled; |
| 105 | +import static org.asynchttpclient.config.AsyncHttpClientConfigDefaults.defaultHttp2HeaderTableSize; |
| 106 | +import static org.asynchttpclient.config.AsyncHttpClientConfigDefaults.defaultHttp2InitialWindowSize; |
| 107 | +import static org.asynchttpclient.config.AsyncHttpClientConfigDefaults.defaultHttp2MaxConcurrentStreams; |
| 108 | +import static org.asynchttpclient.config.AsyncHttpClientConfigDefaults.defaultHttp2MaxFrameSize; |
| 109 | +import static org.asynchttpclient.config.AsyncHttpClientConfigDefaults.defaultHttp2MaxHeaderListSize; |
| 110 | +import static org.asynchttpclient.config.AsyncHttpClientConfigDefaults.defaultHttp2PingInterval; |
104 | 111 | import static org.asynchttpclient.config.AsyncHttpClientConfigDefaults.defaultWebSocketMaxFrameSize; |
105 | 112 |
|
106 | 113 | /** |
@@ -167,6 +174,13 @@ public class DefaultAsyncHttpClientConfig implements AsyncHttpClientConfig { |
167 | 174 | private final @Nullable SslContext sslContext; |
168 | 175 | private final @Nullable SslEngineFactory sslEngineFactory; |
169 | 176 | private final boolean http2Enabled; |
| 177 | + private final int http2InitialWindowSize; |
| 178 | + private final int http2MaxFrameSize; |
| 179 | + private final int http2HeaderTableSize; |
| 180 | + private final int http2MaxHeaderListSize; |
| 181 | + private final int http2MaxConcurrentStreams; |
| 182 | + private final Duration http2PingInterval; |
| 183 | + private final boolean http2CleartextEnabled; |
170 | 184 |
|
171 | 185 | // filters |
172 | 186 | private final List<RequestFilter> requestFilters; |
@@ -255,6 +269,13 @@ private DefaultAsyncHttpClientConfig(// http |
255 | 269 | @Nullable SslContext sslContext, |
256 | 270 | @Nullable SslEngineFactory sslEngineFactory, |
257 | 271 | boolean http2Enabled, |
| 272 | + int http2InitialWindowSize, |
| 273 | + int http2MaxFrameSize, |
| 274 | + int http2HeaderTableSize, |
| 275 | + int http2MaxHeaderListSize, |
| 276 | + int http2MaxConcurrentStreams, |
| 277 | + Duration http2PingInterval, |
| 278 | + boolean http2CleartextEnabled, |
258 | 279 |
|
259 | 280 | // filters |
260 | 281 | List<RequestFilter> requestFilters, |
@@ -351,6 +372,13 @@ private DefaultAsyncHttpClientConfig(// http |
351 | 372 | this.sslContext = sslContext; |
352 | 373 | this.sslEngineFactory = sslEngineFactory; |
353 | 374 | this.http2Enabled = http2Enabled; |
| 375 | + this.http2InitialWindowSize = http2InitialWindowSize; |
| 376 | + this.http2MaxFrameSize = http2MaxFrameSize; |
| 377 | + this.http2HeaderTableSize = http2HeaderTableSize; |
| 378 | + this.http2MaxHeaderListSize = http2MaxHeaderListSize; |
| 379 | + this.http2MaxConcurrentStreams = http2MaxConcurrentStreams; |
| 380 | + this.http2PingInterval = http2PingInterval; |
| 381 | + this.http2CleartextEnabled = http2CleartextEnabled; |
354 | 382 |
|
355 | 383 | // filters |
356 | 384 | this.requestFilters = requestFilters; |
@@ -616,6 +644,41 @@ public boolean isHttp2Enabled() { |
616 | 644 | return http2Enabled; |
617 | 645 | } |
618 | 646 |
|
| 647 | + @Override |
| 648 | + public int getHttp2InitialWindowSize() { |
| 649 | + return http2InitialWindowSize; |
| 650 | + } |
| 651 | + |
| 652 | + @Override |
| 653 | + public int getHttp2MaxFrameSize() { |
| 654 | + return http2MaxFrameSize; |
| 655 | + } |
| 656 | + |
| 657 | + @Override |
| 658 | + public int getHttp2HeaderTableSize() { |
| 659 | + return http2HeaderTableSize; |
| 660 | + } |
| 661 | + |
| 662 | + @Override |
| 663 | + public int getHttp2MaxHeaderListSize() { |
| 664 | + return http2MaxHeaderListSize; |
| 665 | + } |
| 666 | + |
| 667 | + @Override |
| 668 | + public int getHttp2MaxConcurrentStreams() { |
| 669 | + return http2MaxConcurrentStreams; |
| 670 | + } |
| 671 | + |
| 672 | + @Override |
| 673 | + public Duration getHttp2PingInterval() { |
| 674 | + return http2PingInterval; |
| 675 | + } |
| 676 | + |
| 677 | + @Override |
| 678 | + public boolean isHttp2CleartextEnabled() { |
| 679 | + return http2CleartextEnabled; |
| 680 | + } |
| 681 | + |
619 | 682 | @Override |
620 | 683 | public int getSslSessionCacheSize() { |
621 | 684 | return sslSessionCacheSize; |
@@ -856,6 +919,13 @@ public static class Builder { |
856 | 919 | private @Nullable SslContext sslContext; |
857 | 920 | private @Nullable SslEngineFactory sslEngineFactory; |
858 | 921 | private boolean http2Enabled = false; |
| 922 | + private int http2InitialWindowSize = defaultHttp2InitialWindowSize(); |
| 923 | + private int http2MaxFrameSize = defaultHttp2MaxFrameSize(); |
| 924 | + private int http2HeaderTableSize = defaultHttp2HeaderTableSize(); |
| 925 | + private int http2MaxHeaderListSize = defaultHttp2MaxHeaderListSize(); |
| 926 | + private int http2MaxConcurrentStreams = defaultHttp2MaxConcurrentStreams(); |
| 927 | + private Duration http2PingInterval = defaultHttp2PingInterval(); |
| 928 | + private boolean http2CleartextEnabled = defaultHttp2CleartextEnabled(); |
859 | 929 |
|
860 | 930 | // cookie store |
861 | 931 | private CookieStore cookieStore = new ThreadSafeCookieStore(); |
@@ -949,6 +1019,13 @@ public Builder(AsyncHttpClientConfig config) { |
949 | 1019 | sslContext = config.getSslContext(); |
950 | 1020 | sslEngineFactory = config.getSslEngineFactory(); |
951 | 1021 | http2Enabled = config.isHttp2Enabled(); |
| 1022 | + http2InitialWindowSize = config.getHttp2InitialWindowSize(); |
| 1023 | + http2MaxFrameSize = config.getHttp2MaxFrameSize(); |
| 1024 | + http2HeaderTableSize = config.getHttp2HeaderTableSize(); |
| 1025 | + http2MaxHeaderListSize = config.getHttp2MaxHeaderListSize(); |
| 1026 | + http2MaxConcurrentStreams = config.getHttp2MaxConcurrentStreams(); |
| 1027 | + http2PingInterval = config.getHttp2PingInterval(); |
| 1028 | + http2CleartextEnabled = config.isHttp2CleartextEnabled(); |
952 | 1029 |
|
953 | 1030 | // filters |
954 | 1031 | requestFilters.addAll(config.getRequestFilters()); |
@@ -1269,6 +1346,41 @@ public Builder setHttp2Enabled(boolean http2Enabled) { |
1269 | 1346 | return this; |
1270 | 1347 | } |
1271 | 1348 |
|
| 1349 | + public Builder setHttp2InitialWindowSize(int http2InitialWindowSize) { |
| 1350 | + this.http2InitialWindowSize = http2InitialWindowSize; |
| 1351 | + return this; |
| 1352 | + } |
| 1353 | + |
| 1354 | + public Builder setHttp2MaxFrameSize(int http2MaxFrameSize) { |
| 1355 | + this.http2MaxFrameSize = http2MaxFrameSize; |
| 1356 | + return this; |
| 1357 | + } |
| 1358 | + |
| 1359 | + public Builder setHttp2HeaderTableSize(int http2HeaderTableSize) { |
| 1360 | + this.http2HeaderTableSize = http2HeaderTableSize; |
| 1361 | + return this; |
| 1362 | + } |
| 1363 | + |
| 1364 | + public Builder setHttp2MaxHeaderListSize(int http2MaxHeaderListSize) { |
| 1365 | + this.http2MaxHeaderListSize = http2MaxHeaderListSize; |
| 1366 | + return this; |
| 1367 | + } |
| 1368 | + |
| 1369 | + public Builder setHttp2MaxConcurrentStreams(int http2MaxConcurrentStreams) { |
| 1370 | + this.http2MaxConcurrentStreams = http2MaxConcurrentStreams; |
| 1371 | + return this; |
| 1372 | + } |
| 1373 | + |
| 1374 | + public Builder setHttp2PingInterval(Duration http2PingInterval) { |
| 1375 | + this.http2PingInterval = http2PingInterval; |
| 1376 | + return this; |
| 1377 | + } |
| 1378 | + |
| 1379 | + public Builder setHttp2CleartextEnabled(boolean http2CleartextEnabled) { |
| 1380 | + this.http2CleartextEnabled = http2CleartextEnabled; |
| 1381 | + return this; |
| 1382 | + } |
| 1383 | + |
1272 | 1384 | // filters |
1273 | 1385 | public Builder addRequestFilter(RequestFilter requestFilter) { |
1274 | 1386 | requestFilters.add(requestFilter); |
@@ -1502,6 +1614,13 @@ public DefaultAsyncHttpClientConfig build() { |
1502 | 1614 | sslContext, |
1503 | 1615 | sslEngineFactory, |
1504 | 1616 | http2Enabled, |
| 1617 | + http2InitialWindowSize, |
| 1618 | + http2MaxFrameSize, |
| 1619 | + http2HeaderTableSize, |
| 1620 | + http2MaxHeaderListSize, |
| 1621 | + http2MaxConcurrentStreams, |
| 1622 | + http2PingInterval, |
| 1623 | + http2CleartextEnabled, |
1505 | 1624 | requestFilters.isEmpty() ? Collections.emptyList() : Collections.unmodifiableList(requestFilters), |
1506 | 1625 | responseFilters.isEmpty() ? Collections.emptyList() : Collections.unmodifiableList(responseFilters), |
1507 | 1626 | ioExceptionFilters.isEmpty() ? Collections.emptyList() : Collections.unmodifiableList(ioExceptionFilters), |
|
0 commit comments