Commit graph

61 commits

Author SHA1 Message Date
Ruth Linehan
4176251521 (TK-179) Remove unused ssl config functions
These functions were previously used for initializing an ssl context for the
clojure http client. However, with the clojure client initialization now just
wrapping the java code, these are no longer needed.
2016-02-08 14:00:07 +00:00
Scott Walker
66c584fff4 Handle an empty content type in the response 2016-02-04 13:11:27 +00:00
Scott Walker
41836a72ad Add async/sync test to check that a bad HTTP verb is rejected 2016-02-04 11:07:07 +00:00
Scott Walker
8548bbb4d7 (TK-179) Modify the Clojure implementation to share more of the Java impl
This commit removes duplicate functionality from the Clojure implementation and reuses the Java request/response handling impl. It doesn't address client creation so there are still two distinct paths for that.

The main changes are Ring <-> Java request/response conversion and the addition of interface ResponseDeliveryDelegate. The delegate implementations take care of the language-specific aspects of response building and promise delivery. One of the Clojure test namespaces is removed too.
2016-02-04 10:47:18 +00:00
Alex Dreyer
a383bd7046 Add a general request function to the client protocol.
There are a few places where we map request method keywords to
http-client function. The http client then maps them back to keywords
which is redundant. This adds a general request function to the protocol
that accepts a keyword method.
2016-01-29 08:45:44 -08:00
Scott Walker
15b13fed4f Update Java API to include ResponseBodyType.UNBUFFERED_STREAM and update Clojure implementation to give consistent HttpContext usage with both clj and Java 2016-01-15 14:31:36 +00:00
Scott Walker
a5ed1d0bf8 Move unbuffered stream Clojure tests into a separate namespace 2016-01-11 07:57:12 +00:00
Chris Price
e7c9d22aa4 (MAINT) Update to latest apache httpasyncclient
This commit updates us to the latest version of the Apache
HTTPAsyncClient.  This is necessary in order to make it
possible to use this library in the same VM as the latest
version of clj-http, because they have some common dependencies.

The commit also cleans up some other dependencies while I was
in there.
2015-12-18 12:21:27 -08:00
Scott Walker
fbab9a37bc Rework tests for improved clarity and AsyncConsumer releaseResources() fix 2015-10-13 12:09:50 +01:00
Scott Walker
862090251c Incorporate comments from camlow325
- Fixes to ExceptionInsertingPipedInputStream
- Fix to async consumer and removal of decompression code
- Use ResponseContentEncoding to do all decompression including removing previous approach
- Clarify tests and add ConnectionException
2015-10-07 17:45:18 +01:00
Scott Walker
ca5ad63179 (PE-11976) Add option to return the response early and stream the body asynchronously
Adds a new :as option that uses Apache's AsyncConsumer to return the response as quickly as possible then asynchronously stream the response body using piped input/output streams.
2015-10-05 15:38:30 +01:00
Joe Pinsonault
08ca923e69 (MAINT) nil body is coerced into empty string 2015-04-24 10:17:05 -07:00
Joe Pinsonault
c906d5abd0 (TK-182) coerce-body-type handles nil body 2015-04-24 10:05:29 -07:00
Jeremy Barlow
a4c8994189 (MAINT) Fix timeout test names and testing strings
This commit has a couple of cosmetic fixes to the names and testing
strings for a few tests introduced by TK-134.
2015-03-19 21:25:55 -07:00
Jeremy Barlow
6520abfb1d (TK-134) Updated connection tests to handle Connect or SocketTimeout
This commit updates the short connect timeout tests to tolerate either a
ConnectException or SocketTimeoutException as a success condition.
Connections could fail with either exception depending upon timing or
network setup.
2015-03-16 22:46:07 -07:00
Jeremy Barlow
9b55ed31b6 (TK-134) Add connect and socket timeout client configuration
This commit enables http clients to optionally configure a connect
and/or socket timeout for requests.  For persistent clients, the
timeout values can only be configured at the client and not a
per-request level.  Non-persistent client requests support the
configuration of these timeouts.

This commit also bumps a few dependencies - tk-jetty9 to 1.2.0,
trapperkeeper to 1.10, ssl-utils to 0.8.0, and clojure to 1.6.0 -
and adds the 'test' tk-jetty9 library as a dev dependency for
testing.
2015-03-16 12:22:35 -07:00
Kevin Corcoran
583b71a556 (TK-145) fix application of default charset
Fix a bug in which a default charset of UTF-8 would be added to the
Content-Type header for certain requests.  This change restricts that
behavior to cases in which the body is a string and there is no charset
provided by the caller.
2015-02-13 10:53:12 -08:00
Nate Wolfe
e164bb12d7 (SERVER-101) Upgrade jvm-ca dependency to 0.7.0
This commit changes the usages to reflect the new name of the library
and API.
2015-01-23 17:33:02 -08:00
Jeremy Barlow
137ae4bd48 (TK-103) Restored redirect-test-async tests
This commit restores several of the `rediret-test-async` tests, using a
client to make the requests since the client-less single-request async
APIs are no longer available.
2014-11-15 14:37:00 -08:00
Jeremy Barlow
91f679a795 (TK-103) Restored query-params-test-async tests
This commit restores the `query-params-test-async` tests, using a client
to make the requests since the client-less single-request async APIs are
no longer available.
2014-11-14 15:54:02 -08:00
Jeremy Barlow
4e56352c44 (TK-103) Restore client close tests
This commit restores some of the client close tests which had been
disabled temporarily per some of the refactoring for TK-108.
2014-11-12 14:20:50 -08:00
Jeremy Barlow
d437646203 (TK-103) Remove non-client based async APIs
This commit removes the non-client based APIs for doing async requests.
2014-11-12 11:04:11 -08:00
Preben Ingvaldsen
c77e449f11 (TK-108) Remove failing close test
Remove the tests to ensure that the persistent async and sync
Java clients close correctly due to a race condition that
was present in the tests.
2014-11-11 09:45:18 -08:00
Preben Ingvaldsen
fb6772b623 (TK-108) Return interface in createClient methods
Return interfaces in the createClient methods rather than the
implementation classes themselves.
2014-11-10 11:24:36 -08:00
Preben Ingvaldsen
8126f13100 (TK-108) Add SimpleRequestOptions class
Add SimpleRequestOptions class, which unifies the Client and
Request options under a single class used for the simple API
calls.
2014-11-10 11:05:15 -08:00
Preben Ingvaldsen
c6ce8dd301 (TK-108) Add a persistent sync Java client
Add a PersistentSyncHttpClient class, which is a wrapper around
CloseableHttpAsyncClient and allows multiple requests to be made
with a persistent synchronous client.
2014-11-10 10:08:13 -08:00
Preben Ingvaldsen
018fe70153 (TK-108) Add a persistent async Java client
Add a new class, PersistentAsyncHttpClient, that is a wrapped
CloseableHttpAsyncClient that is persistent.
2014-11-07 13:29:17 -08:00
Preben Ingvaldsen
972de1e9e9 (TK-108) Separate Java RequestOptions class
Separate the Java RequestOptions class into two new classes:
RequestOptions, which contains options related to the request,
and ClientOptions, which contains options related to the client.
Both are now required when calling the request methods in
AsyncHttpClient and SyncHttpClient.
2014-11-07 10:44:20 -08:00
Chris Price
b70ac50b17 (TK-97) Fix bug in tests on Oracle JDKs
The test code related to the configurable SSL protocols was
written using some ciphers that are available in OpenJDK, but
are not available by default in Oracle JDK.  This caused the
tests to fail on Oracle JDKs.

This commit changes the test to use some older ciphers that
are available in the Oracle JDK out of the box.
2014-10-21 15:08:15 -07:00
Chris Price
251d859d10 (TK-97) Expose configuration settings for protocols/cipher suites
This commit adds configuration settings for the SSL protocols
and cipher suites, in both the java and clojure clients.  It
also adds a list of default protocols which will be used if
the protocols setting is not explicitly set.
2014-10-17 23:35:05 -07:00
Chris Price
c2cbb11d5d (TK-97) Update dependencies to latest versions
Update dependencies (trapperkeeper, trapperkeeper-webserver-jetty9,
etc.) to the latest versions and fix tests accordingly.
2014-10-17 19:50:08 -07:00
Jeremy Barlow
f83d7821ad (PE-6019) Encode string request body per Content-Type header
This commit encodes a request body string per the content of the
Content-Type header.  In the event that no charset is specified in the
Content-Type header, the charset is set to UTF-8.  Previously, the
request body string was always encoded to ISO-8859-1 and was not
necessarily in sync with the value of the Content-Type header.
2014-09-18 17:02:00 -07:00
Chris Price
cbb3984368 Merge pull request #14 from fpringvaldsen/PE-5623-follow-redirects
(PE-5623) Add force-redirects option
2014-08-27 10:38:07 -07:00
Preben Ingvaldsen
73292ab690 (PE-5623) Add followRedirects option to Java client
Add followRedirects option to Java client, which functions
the same as the :follow-redirects option in the clj client.
2014-08-26 16:49:36 -07:00
Preben Ingvaldsen
06636b461e (PE-5623) Add :follow-redirects option clj clients
Add a :follow-redirects option to the clj clients which, when
set to false, will prevent the client from following a redirect.
2014-08-26 16:36:47 -07:00
Preben Ingvaldsen
4bd7d25403 (PE-5623) Add forceRedirects option to Java client
Add a forceRedirects option to the Java client that allows it to
follow redirects on POST and PUT requests.
2014-08-25 11:57:39 -07:00
Preben Ingvaldsen
d9f2f1d0f3 (PE-5623) Add :force-redirects to clj client
Add a :force-redirects option to the clojure client that will
relax the redirect restrictions put on the client for a POST
or PUT method.
2014-08-25 11:15:22 -07:00
Preben Ingvaldsen
9e37eeeabe Add RequestOptions constructor with string
Add a RequestOptions constructor that takes a string instead
of a URI. Modify the basic-test function to use the string
constructor.
2014-08-22 14:46:06 -07:00
Preben Ingvaldsen
606754bc81 (TK-29) Move to URI instead of String
Have the RequestOptions constructor take a URI instead of a
string. Add signature to the HTTP request methods that take
a URI.
2014-08-08 16:32:48 -07:00
Preben Ingvaldsen
fee17ad543 (TK-29) Use :query-params and change variable names
Use :query-params in the query param ring handler instead of
:params. Also change variable names used for testing.
2014-08-07 10:36:03 -07:00
Preben Ingvaldsen
449c677c9e Reformat query-options variable
Reformat the query-options variable to line things up and
increase readability.
2014-08-06 14:33:26 -07:00
Preben Ingvaldsen
b20b7a58b2 (TK-29) Overwrite parameters set in URL
Overwrite parameters set in the URL of a request if query
parameters are specified in the options map. If no parameters are
set in the options map, any query parameters set in the URL will
NOT be overwritten and will be successfully passed as part of the
request.
2014-08-06 14:23:56 -07:00
Preben Ingvaldsen
c439b2ed87 (TK-29) Add query params option to clj client
Add query parameter support to the clojure client. User can now
specify a :query-params option in the options map containing a
map of query parameters.
2014-08-06 14:02:10 -07:00
Preben Ingvaldsen
e1e283d701 (TK-29) Add query params to Java client
Add query params back into the Java client, along with tests
to validate this functionality is working.
2014-08-06 10:49:48 -07:00
Preben Ingvaldsen
6fe97dee92 (TK-27) Add test for sync client close
Add test to make sure that a sync client is closed properly.
2014-07-23 10:20:15 -07:00
Preben Ingvaldsen
0aeaf73dd9 (TK-27) Add tests for request-with-client
Add asynchronous and synchronous tests for request-with-client.
2014-07-17 14:03:39 -07:00
Preben Ingvaldsen
e586ea53c8 (TK-27) Add request-with-client functions
Add request-with-client functions to the async and sync
namespaces. These now do all the work of the request functions,
so that the request functions cannot directly be passed a client
by the user.
2014-07-17 13:28:33 -07:00
Preben Ingvaldsen
81cd0eabaf (TK-27) Remove persistent namespaces
Remove persistent-async and persistent-sync namespaces,
moving their contents into async and sync, respectively.
2014-07-17 11:06:13 -07:00
Preben Ingvaldsen
b807083c5a (TK-27) Refactor client protocols
Refactor the async and sync client protocols into a single
protocol which resides in a new file, common.clj.
2014-07-15 16:46:20 -07:00
Preben Ingvaldsen
0b2755eef5 (TK-27) Add persistent sync client
Add a persistent sync client to the persistent-sync namespace.
With this namespace, a user can now create a persistent
sync client for reuse. Also, add persistent sync client test.
2014-07-15 16:01:36 -07:00