Commit Graph

560 Commits

Author SHA1 Message Date
Oleg Kalnichevski 32228cd4ff Regression: Multipart body builder and multipart formatters fail to escape special characters such as backslash and quote mark 2022-11-13 12:28:51 +01:00
Oleg Kalnichevski 16b2cf467d HTTPCLIENT-2242: RoutingSupport fails to copy InetAddress when normalizing HttpHost 2022-11-06 11:18:15 +01:00
Oleg Kalnichevski fe1e095ef9 Regression: connection managers fail to take into account per route connection config when closing expired connections 2022-11-06 11:11:53 +01:00
Oleg Kalnichevski d76d27bed7 Bug fix: PoolingAsyncClientConnectionManager fails to update the execution context upon upgrade to HTTP/2 2022-11-05 16:42:47 +01:00
Oleg Kalnichevski 7626230ffd Fixed integration tests broken by JUnit 5 upgrade 2022-11-05 11:16:05 +01:00
Oleg Kalnichevski ba45d80b07 HTTPCLIENT-2240: fixed incorrect CONNECT method initialization in ProxyClient 2022-10-23 20:01:46 +02:00
Oleg Kalnichevski 646ff6988e Corrected ClientExecuteProxy example 2022-10-23 20:01:46 +02:00
Oleg Kalnichevski 7ab435c271 HTTPCLIENT-2236: MultihomeIOSessionRequester fails to enhance the cause exception in case of connect failure if the remoteAddress argument has been given 2022-10-03 15:25:19 +02:00
Gary Gregory bfa6a5ea72 Use Objects.toString() instead of String type cast 2022-10-02 16:46:07 +02:00
Oleg Kalnichevski 9c0575494a HTTPCLIENT-2232: last protocol interceptrs moved at the end of the H2 protocol processing pipeline 2022-09-11 18:50:45 +02:00
Oleg Kalnichevski ed7701c509 H2 async runtime to proactively set HTTP/2 protocol version in the execution context 2022-09-11 18:47:31 +02:00
Oleg Kalnichevski 3fe6a8bcdf HTTPCLIENT-2231: a race condition in the main async exec when the request execution on an I/O thread is faster then execution pipeline management on the client thread 2022-08-19 14:04:25 +02:00
Arturo Bernal 18fa09f6a2 Avoid duplicate redundant objects and use Singleton instead. 2022-07-08 19:11:10 +02:00
Gary Gregory 1cd12fc1dc Cleaning up:
- Super interface already implements FutureCallback
- No need to override methods to only call super
- Add missing Javadoc tag
- Access static field directly
2022-07-06 10:13:23 -04:00
jkmcl 69e2ed6c41 Remove unused local variable 2022-07-01 10:50:03 +02:00
jkmcl 8d9b52abd1 Remove redundant if 2022-07-01 10:50:03 +02:00
Oleg Kalnichevski 3771129376 HTTPCLIENT-2225: connection route calculation does not take the default RequestConfig into account 2022-06-29 09:46:19 +02:00
jkmcl 518eb410fe Avoid unnecessary use of Instant.toEpochMilli
Avoid unnecessary use of Instant.toEpochMilli by using Instant.compareTo
to compare Instants direclty
2022-06-26 23:34:51 +02:00
jkmcl 15951d8094 Use HTTP header name constants
Use HTTP header name constants instead of string literals.
2022-06-20 19:25:00 +02:00
Carter Kozak 944e308a52 ResponseEntityProxy.writeTo(null) leaves connections in the correct state
Previously writeTo would conditionally delegate to the wrapped
entity if the provided outputstream was non-null, however in the
null case the entity would not be drained and the connection would
be released potentially with bytes remaining. If this occurs in
practice, it may result in timeouts as the server expects to write
data to the response while the client is attempting to send a
request.
2022-06-13 19:29:19 +02:00
Carter Kozak 3bd017cb0a HTTPCLIENT-2221 Closing a classic response/entity allows connection reuse
Previously, a partially consumed response body closed via
CloseableHttpResponse.close or HttpEntity.close would fully consume
remaining bytes (via close), however it would not release the
connection for reuse.
If CloseableHttpResponse.close was called, it would follow the close
with a discard/disconnect, however if only the entity was closed,
the connection would remain in a checked-out (leaked) state.

Now, we take advantage of the fact that closing a response stream
on any reusable connection is required to drain bytes on closure.
Failures are detected by writeTo and the stream returned by
getContent, so we can be confident that we will not return a
broken connection to the pool.
2022-06-11 14:11:06 +02:00
Oleg Kalnichevski 91a93accd7 Corrected javadoc errors in Base64 2022-06-03 23:48:13 +02:00
j3graham 26dcc6f914 HTTPCLIENT-2218: Use Java 8 Base64 utility (#370) 2022-06-01 23:04:29 +02:00
殷成涛 db47570efe
add br decompression support (#363) 2022-05-18 15:18:25 +02:00
niranjan ghule 34327ae83e Refactor testcase 2022-05-11 11:56:59 +02:00
niranjan ghule daac18619a Remove unused code 2022-05-05 10:52:49 +02:00
Oleg Kalnichevski 62fb4bcbe0 HTTPCLIENT-2212: MinimalHttpAsyncClient fails to release client endpoints in case of a connect error (such as TLS handshake failure) 2022-05-05 10:47:27 +02:00
Richard Hernandez 36678c44dc Create daemon threads in InternalAbstractHttpAsyncClient 2022-04-06 12:22:36 -07:00
Anthony Baldocchi 94017237b2
HTTPCLIENT-2080: add getRetryInterval to HttpRequestRetryStrategy for use on retriable IOExceptions (#356) 2022-03-30 16:31:07 +02:00
Ryan Schmitt c395aad5ad Fix infinite recursion in SSLConnectionSocketFactory 2022-03-23 09:09:14 +01:00
Oleg Kalnichevski f00ce5da9e HTTPCLIENT-2200: Protocol interceptors are executed before the connection route has been fully established 2022-03-17 17:43:22 +01:00
Oleg Kalnichevski a3bbcc82ae Upgraded HttpCore to version 5.2-beta1 2022-03-17 17:18:12 +01:00
John Gallagher 5f9bc347ee StringBody: just write the bytes to the output stream 2022-03-16 10:01:24 +01:00
Andriy Redko 6a487ba686
HTTPCLIENT-2209: Pass HttpContext to AsyncClientConnectionOperator (#353) 2022-03-12 18:53:45 +01:00
David Schlosnagle 04aeaa5bcd
Optimize ExecSupport.getNextExchangeId() (#352) 2022-02-26 12:45:18 +01:00
cda007 157174543f Added option to set an IOSessionListener on async client builders 2022-02-21 12:15:30 +01:00
Oleg Kalnichevski 19626731c0 HTTPCLIENT-2203: Corrected target host normalization by the request execution interceptors; added ContextBuilder with support for preemptive authentication initialization 2022-02-13 20:07:47 +01:00
Oleg Kalnichevski 8881ef4b3f Fixed incompatibility with older versions of Android shipping with Commons Codec < 1.4 2022-01-24 14:16:33 +01:00
Oleg Kalnichevski 235900eb57 Bug fix: ByteArrayBuilder incorrectly handles empty strings 2022-01-24 14:05:33 +01:00
Andrei Vasilev 75e8dc6f9b HTTPCLIENT-2198, Fixed NPE in TlsConfig.toString()
Replaced called to Arrays.asList() to Arrays.toString(), which allows for null argument.
2022-01-22 08:55:40 +01:00
Andrei Vasilev d4c0e961ab HTTPCLIENT-2198, Fixed AbstractClientTlsStrategy to respect HttpVersionPolicy
Updated AbstractClientTlsStrategy to pass only the HttpVersionPolicy set by TlsConfig  instead of the entire TlsConfig to H2TlsSupport.selectApplicationProtocols() method.
2022-01-21 09:04:24 +01:00
Oleg Kalnichevski 3ee994b25c HTTPCLIENT-2195, regression: classic ConnectExec incorrectly discards the proxy response body even if the request cannot be executed and the response is final 2022-01-13 15:37:23 +01:00
Arturo Bernal 9e876e7ff0 Remove no need it ConnectionConfig. 2022-01-13 15:04:20 +01:00
Arturo Bernal d2a9977290 HTTPCLIENT-2188 - Improve logging when BasicHttpClientConnectionManager is still allocated 2022-01-13 15:00:54 +01:00
JasonMathison dd0bbda070 Httpclient-2194 async retries not including body (#343) 2022-01-05 21:55:58 +01:00
Oleg Kalnichevski e6ad081b3c Deprecated execute methods that return an open response object in favor of execute methods with a response handler and automatic resource deallocation 2021-12-26 17:02:55 +01:00
Oleg Kalnichevski 19571aa207 Bug fix: Incorrect connection validity check in the async connection manager can cause an IllegalStateException and lead to a connection leak. Treat closed connections as valid due to the connection open check being inherently racy 2021-12-17 10:58:09 +01:00
Arturo Bernal 6ba9b4acdc Method to check if the connection manager has been shut down and is closed or not. 2021-12-15 12:21:59 +01:00
Arturo Bernal f8f5bbda87 Complete test for HTTP Methods. 2021-12-04 13:43:16 +01:00
Arturo Bernal d323e0d684 HTTPCLIENT-2189 - Cookie and Cache APIs to use Java time primitives 2021-11-29 14:21:01 +01:00
Arturo Bernal 0a42d173ef HTTPCLIENT-2186 - Migrate Test to Unit 5. 2021-11-21 19:44:13 +01:00
Arturo Bernal ef9f8ba9ab Convert QOP constants into an enum. 2021-11-19 12:22:58 +01:00
Arturo Bernal d2c59fd5e4 HTTPCLIENT-2065: Simplify additon of content type parameters in MultipartEntityBuilder
This closes #320
2021-11-14 09:51:07 +01:00
Arturo Bernal af2cc82e82 HTTPCLIENT-2066 Provide ByteArrayBody constructors w/o filename parameter
This closes #319
2021-11-13 18:04:46 +01:00
Arturo Bernal 0926f1e07a HTTPCLIENT-2079: version.properties contains non-interpolated value
This closes #321
2021-11-13 17:47:16 +01:00
Michael Osipov f055b3e83b Apply English locale to all date header formatters 2021-11-13 17:09:45 +01:00
Carter Kozak e09c5d0691 HTTPCLIENT-2184: Fix classic client connection reuse
This fixes an issue in which connections were not returned to the
pool when requests contained non-repeatable bodies AND responses
were streamed. When both of these criteria were met, responses
were returned without ResponseEntityProxy enhancements so that
closing the response entity or stream no longer completed the
exchange, thus leaking the connection which forever lived in the
`leased` state in the connection pool.
2021-11-12 17:33:59 -05:00
Arturo Bernal 4d0caa4f42 Fix typo method and class. Deprecate the old ones. 2021-11-12 22:16:52 +01:00
Oleg Kalnichevski 0e8adf79dc Updated examples and unit tests to make use of lambda expressions for response message processing 2021-11-12 22:16:43 +01:00
Arturo Bernal 58386f857b Add @OverRide. 2021-11-06 14:59:45 +01:00
Arturo Bernal 0289c78e8d Use {@code } instead <code>. 2021-11-06 14:59:19 +01:00
Oleg Kalnichevski 000fa7bc10 Fixed javadoc errors 2021-10-29 14:55:37 +02:00
Arturo Bernal 1fb79b96f6 Make IOReactor IO session decorator and exception callback configurable. 2021-10-26 14:27:09 +02:00
Oleg Kalnichevski dfc2086d24 Replaced SimpleDateFormat and Calendar with Java 8 Time APIs; removed thread-local from DateUtils 2021-10-24 16:50:07 +02:00
Oleg Kalnichevski ffc8cd7585 Updated connection and TLS configuration examples 2021-10-23 19:48:00 +02:00
Oleg Kalnichevski a02455acb3 Support for connection TTL setting on a per-route basis 2021-10-23 19:24:39 +02:00
Arturo Bernal fff097615b Make IOReactor IO session decorator configurable. 2021-10-23 18:34:14 +02:00
Arturo Bernal 012429391c * Fix javadoc typo.
* Use java array declarations instead of "c" way.
2021-10-23 18:10:15 +02:00
Arturo Bernal bc7aae743a Re-use core URIScheme instead of String. 2021-10-23 18:10:15 +02:00
Gary Gregory 238401731b Don't initialize AtomicReference to its default value. 2021-10-23 18:10:15 +02:00
Oleg Kalnichevski 8b73f6b83c HTTPCLIENT-2182: access to SSLSession attributes via reflection disallowed as of Java 16. Core TLS functions now use new Java 1.8 API introduced by 8u251 update 2021-10-23 18:09:11 +02:00
Oleg Kalnichevski b10d43f2bb HTTPCLIENT-2135: TLS configuration on a per-host basis 2021-10-23 18:07:41 +02:00
Gary Gregory 445d4271f9 Use compact array initialization syntax. 2021-10-13 10:36:49 +02:00
Gary Gregory b6ae693fe5 Don't initialize AtomicReference to its default value. 2021-10-13 10:36:49 +02:00
Oleg Kalnichevski 4dd7cefbde Corrected resolution of the target host in DefaultUserTokenHandler 2021-09-29 18:01:47 +02:00
Oleg Kalnichevski fb0c073783 RFC 7230: treat presence of a userinfo component in request URI as an HTTP protocol violation 2021-09-29 18:01:46 +02:00
Oleg Kalnichevski 30c253b37b AuthCache conformance to RFC 7617 2021-09-29 18:01:46 +02:00
Oleg Kalnichevski 5390aef223 Always bind the exchange ID to the execution context 2021-09-29 18:01:46 +02:00
Oleg Kalnichevski 013851d898 Logger cleanup (no functional changes) 2021-09-29 18:01:46 +02:00
Oleg Kalnichevski 4150ac0592 Refactored AuthCache keeping logic into a separate utility class 2021-09-29 18:01:46 +02:00
Oleg Kalnichevski 670f0456ba More consistent handling of request scheme and authority by protocol interceptors 2021-09-29 18:01:46 +02:00
Oleg Kalnichevski 7b47b28d46 Added immutable CredentialsProvider implementations and a CredentialsProvider builder; changed test cases and examples to use immutable CredentialsProvider where possible 2021-09-29 18:01:45 +02:00
Oleg Kalnichevski 17ebfc529e HTTPCLIENT-2120: force HTTP/1.1 protocol policy when creating a tunnel via HTTP/1.1 proxy 2021-09-29 18:01:43 +02:00
Oleg Kalnichevski 9496bb8475 Better connect operation logging 2021-09-18 21:31:10 +02:00
Oleg Kalnichevski 90f69c87b2 HTTPCLIENT-2177: fixed incorrect route state tracking by the async connect executor when negotiating a tunnel via a proxy 2021-09-18 21:31:04 +02:00
Oleg Kalnichevski 4ce032c92c HTTPCLIENT-2177: keep successful tunnel connections alive regardless of `Connection: close` 2021-09-18 21:31:02 +02:00
Oleg Kalnichevski 50f93ec18b HTTPCLIENT-2045: BASIC auth scheme conformance to RFC 7617 2021-09-17 11:17:49 +02:00
Marcono1234 8e8774e6b5 Fix bad test class name 2021-09-11 17:01:59 +02:00
Oleg Kalnichevski 92f757eee3 HTTPCLIENT-2120: support for H2 via HTTP/1.1 proxy 2021-09-09 14:58:49 +02:00
Oleg Kalnichevski bdc7f3b93e Upgraded HttpCore to version 5.2-alpha1 2021-09-09 14:23:37 +02:00
Oleg Kalnichevski c56c00c549 Fixed deprecation warnings that could be fixed and suppressed those that could not 2021-09-09 13:49:44 +02:00
Jaikiran Pai 755b69ea3c Don't retry a request for NoRouteToHostException 2021-08-23 22:24:15 +02:00
Oleg Kalnichevski 5164a4e7b4 HTTPCLIENT-2170: Classic protocol layer no longer releases the underlying connection back to the pool prematurely while the NTLM handshake is still ongoing 2021-08-19 18:58:41 +02:00
Oleg Kalnichevski 29ba623ebe Fixed connection lease request cancellation race in both classic and asyc pooling connection managers 2021-06-28 22:27:01 +02:00
Oleg Kalnichevski aff1d2024c Better exception asserts in unit tests 2021-06-19 21:10:43 +02:00
Arturo Bernal d77112f608 Replace assert calls by simpler but equivalent calls. 2021-06-19 16:47:44 +02:00
Arturo Bernal fde3fca687 Simplify conditions and avoid extra checks.
Inline return variables.
2021-06-19 16:47:41 +02:00
Oleg Kalnichevski 0805cfe582 Updated test cases with exception asserts 2021-05-24 18:53:58 +02:00
Oleg Kalnichevski 82432f50d9 Removed references to deprecated Assert#assertThat 2021-05-24 16:58:33 +02:00
Oleg Kalnichevski 8580d7fddf Redundant type declarations 2021-05-24 14:43:18 +02:00