Commit Graph
20 Commits
Author SHA1 Message Date
Artem RedkinandGitHub 8adfdb9bc5 refactor pool (#192) 2020-05-18 17:47:21 +01:00
5298f20331 Support NIO Transport Services - part 2 (#184)
This is the continuation of the good work of @Yasumoto and @weissi in #135

The following code adds support for NIO Transport services. When the ConnectionPool asks for a connection bootstrap it is returned a NIOClientTCPBootstrap which wraps either a NIOTSConnectionBootstrap or a ClientBootstrap depending on whether the EventLoop we are running on is NIOTSEventLoop.

If you initialize an HTTPClient with eventLoopGroupProvider set to .createNew then if you are running on iOS, macOS 10.14 or later it will provide a NIOTSEventLoopGroup instead of a EventLoopGroup.

Currently a number of tests are failing. 4 of these are related to the NIOSSLUncleanShutdown error the others all seem related to various race conditions which are being dealt with on other PRs. I have tested this code with aws-sdk-swift and it is working on both macOS and iOS.

Things look into:

The aws-sdk-swift NIOTS HTTP client had issues with on Mojave. We should check if this is the case for async-http-client as well.

Co-authored-by: Joe Smith <yasumoto7@gmail.com>
Co-authored-by: Johannes Weiss <johannesweiss@apple.com>
2020-04-18 14:17:46 +01:00
Iain SmithandGitHub be517e3cc1 Enable clients to call URLs that include %2F as an escaped backslash (#201)
* Enable clients to call URLs that include %2F as an escaped backslash

Previously `percentEncodedPath` was using `path.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed)`
which converts %2F to a literal '/'. This prevented users fetching URLs like https://api.travis-ci.org/repo/github/rails%2Frails
which use %2F as part of a path segment.

Migrating to `URLComponents(url: self, resolvingAgainstBaseURL: false)?.percentEncodedPath` has the desired behaviour
for the couple of test cases that exist.

Updated the test server to switch on the `percentEncodedPath` so it's easier
to understand the desired behaviour.
2020-04-15 11:24:30 +01:00
Artem RedkinandGitHub 2fcf0a9fdd fix location header lookup (#186) 2020-03-31 09:56:44 +01:00
9cdd1dc389 Close idle pool connections (#170)
* Close idle pool connections

Motivation: Pooled connections should close at some point (see #168)

Changes:
- Add new poolingTimeout property to HTTPClient.Configuration, it's
default value is .seconds(60), it can be set to nil if one wishes to
disable this timeout.
- Add relevant unit test

Co-authored-by: Johannes Weiss <johannesweiss@apple.com>
2020-03-03 21:51:50 +00:00
TrevörandGitHub 19e2ea727e Add an HTTP/1.1 connection pool (#105)
motivation: Better performance thanks to connection reuse

changes:
- Added a connection pool for HTTP/1.1
- All requests automatically use the connection pool
- Up to 8 parallel connections per (scheme, host, port)
- Multiple additional unit tests
2020-02-25 15:43:16 +00:00
Johannes WeissandGitHub de7421906c fix UDS without a baseURL (#165)
Previously, UNIX Domain Sockets would only work if the URL also had a
"base URL". If it didn't have a base URL, it would try to connect to the
empty string which would fail :).

Now, we support both cases:
- URLs with a baseURL (the path to the UDS) and a path (actual path)
- URLs that just have an actual path (path to the UDS) where we'll just
  use "/" as the URL's path
2020-02-24 17:52:36 +00:00
Johannes WeissandGitHub 48e284d1ea fix NIO deprecations & update to secure versions (#141) 2019-12-10 18:08:28 +00:00
tomer doronandGitHub 018e139eef update copyrights note (#125)
motivation: the Swift Server Workgroup is not a legal entity and cannot hold copyrights. with this change, code authors continue and retain their copyrights under the apache license and previous copyrights note, but Apple steps up instead of the workgroup which has no legal status

changes:
* update header files to say "Apple Inc. and the AsyncHTTPClient project authors" instead of "Swift Server Workgroup and the AsyncHTTPClient project authors"
* update validation scripts to check for the correct header
* add CONTRIBUTING.md file to explain how to make contributions and include a legal notice about licensing the contribution to Apple and the project
* regenerate CONTRIBUTORS.md to reflect most recent contributions
2019-11-06 11:20:30 -08:00
Artem RedkinandGitHub 51dc885a30 add support for redirect limits (#113) 2019-10-23 19:29:25 +03:00
Artem RedkinandJohannes Weiss 191c4ba506 add response decompression support (#86)
fixes #44
2019-10-22 17:45:12 -07:00
Johannes WeissandGitHub 513be15050 EventLoop preference overhaul (#102) 2019-09-21 21:33:15 +02:00
TrevörandArtem Redkin 6efe214716 Remove spaces in range operators (#104) 2019-09-17 13:28:05 +01:00
Johannes WeissandArtem Redkin 2d7ae2bbae minor: improve code style (#103) 2019-09-15 11:04:11 +01:00
vkillandJohannes Weiss 47de4bb5ec Add authorization to proxy (#94) 2019-09-08 14:30:24 +01:00
TrevörandJohannes Weiss 244aea673e Tolerate futures from arbitrary event loops (#96)
This commit fixes #95 by always hopping event loop futures received from
the delegate to the right event loop. This could be a source of bugs if
the library users forgot to hop(to:) futures from their delegates
implementations.
2019-09-06 07:40:49 +01:00
Artem RedkinandGitHub e9d0dd2cc9 rename didReceivePart to didReceiveBodyPart (#84) 2019-08-17 13:32:51 +01:00
Artem RedkinandJohannes Weiss 3c21d3cb90 fix usage of deprecated methods (#85) 2019-08-17 13:17:35 +01:00
vkillandArtem Redkin e0eeb0481c Ignore uncleanShutdown error when state is .head or .body (#77)
* Ignore uncleanShutdown error when state is head or body

* Add ignoreNIOSSLUncleanShutdownError to Configuration

* Revert old HTTPClient.init founctions

* Run generate_linux_tests.rb

* Rename ignoreNIOSSLUncleanShutdownError to ignoreUncleanSSLShutdown

* Make tests compatible with swift 5.0
2019-08-15 11:55:33 +01:00
Artem RedkinandGitHub 27fe9265b2 rename to async-http-client (#58) 2019-07-02 14:00:34 +03:00