Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use platform default TCP buffer sizes #855

Merged
merged 3 commits into from Oct 24, 2019
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

use platform default TCP buffer sizes

  • Loading branch information
elharo committed Oct 23, 2019
commit 1a9c36f825387e8fff3e542c072105041b91dd5c
@@ -29,7 +29,6 @@
import org.apache.http.client.methods.HttpPut;
import org.apache.http.client.methods.HttpRequestBase;
import org.apache.http.client.methods.HttpTrace;
import org.apache.http.config.SocketConfig;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
@@ -74,7 +73,7 @@ public ApacheHttpTransport() {
* Constructor that allows an alternative Apache HTTP client to be used.
*
* <p>
* Note that in the previous version, we overrode several settings, however, we are no longer able
* Note that in the previous version, we overrode several settings. However, we are no longer able
* to do so.
* </p>
*
@@ -102,12 +101,11 @@ public ApacheHttpTransport(HttpClient httpClient) {
* </p>
* <ul>
* <li>The client connection manager is set to {@link PoolingHttpClientConnectionManager}.</li>
* <li>The socket buffer size is set to 8192 using {@link SocketConfig}.</li>
* <li><The retry mechanism is turned off using
* {@link HttpClientBuilder#disableRedirectHandling}.</li>
* <li>The route planner uses {@link SystemDefaultRoutePlanner} with
* {@link ProxySelector#getDefault()}, which uses the proxy settings from <a
* href="http://docs.oracle.com/javase/7/docs/api/java/net/doc-files/net-properties.html">system
* href="https://docs.oracle.com/javase/7/docs/api/java/net/doc-files/net-properties.html">system
* properties</a>.</li>
* </ul>
*
@@ -127,7 +125,6 @@ public static HttpClient newDefaultHttpClient() {
* </p>
* <ul>
* <li>The client connection manager is set to {@link PoolingHttpClientConnectionManager}.</li>
* <li>The socket buffer size is set to 8192 using {@link SocketConfig}.</li>
* <li><The retry mechanism is turned off using
* {@link HttpClientBuilder#disableRedirectHandling}.</li>
* <li>The route planner uses {@link SystemDefaultRoutePlanner} with
@@ -140,17 +137,10 @@ public static HttpClient newDefaultHttpClient() {
* @since 1.31
*/
public static HttpClientBuilder newDefaultHttpClientBuilder() {
// Set socket buffer sizes to 8192
SocketConfig socketConfig =
SocketConfig.custom()
.setRcvBufSize(8192)
.setSndBufSize(8192)
.build();

return HttpClientBuilder.create()
.useSystemProperties()
.setSSLSocketFactory(SSLConnectionSocketFactory.getSocketFactory())
.setDefaultSocketConfig(socketConfig)
.setMaxConnTotal(200)
.setMaxConnPerRoute(20)
.setConnectionTimeToLive(-1, TimeUnit.MILLISECONDS)
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.