Commit Graph

94 Commits

Author SHA1 Message Date
Artem Redkin 037b702919 fix location header lookup 1.1.1 2020-03-31 09:59:25 +01:00
Johannes Weiss e2636a4c24 require secure NIO version (#162) 1.1.0 2020-02-11 12:56:45 +00:00
Johannes Weiss f648c04d18 some lets in Requests were vars by accident (#163) 2020-02-11 12:33:25 +00:00
Artem Redkin 70ad494183 add a public init to StreamWriter (#161) 2020-02-05 22:31:35 +00:00
Johannes Weiss 8031c46933 add a test that does many equal concurrent requests (#160) 2020-02-05 15:57:18 +00:00
tomer doron b8fb78f27c actually use 16.04 on 16.04 builds (#159)
motivation: 16.04 docker-compose setup was pulling 18.04 by mistake

changes: use xenial instead of bionic
2020-02-03 21:21:34 +00:00
tomer doron a49510c9f1 enable tsan and improve docker security (#157)
motivation: more secured ci setup

changes:
* enable :z selinux flag on bind mounts so we can enable selinux on ci
* drop potentially exploitable capabilities from docker-compose
* create a 16.04 docker-compose setup so we can run tsan in ci (broken on 18.04)
2020-01-31 15:37:31 +00:00
Marcin Krzyzanowski e90f5fd03d Support UNIX Domain Sockets (#151)
Adds support for UNIX Domain Socket requests.

Usage:

```
let httpClient = HTTPClient(eventLoopGroupProvider: .createNew)
let socketURL = URL(string: "unix:///var/run/docker.sock")!
let req = try HTTPClient.Request(url: URL(string: "/users/list", relativeTo: socketURL)!, method: .GET)
let response = try httpClient.execute(request: req).wait()
```
2020-01-27 15:55:12 +00:00
Artem Redkin a8e6f8de43 fix usage of older api in readme example (#156) 2020-01-27 12:06:54 +00:00
Fabian Fett 84026a7ba0 ResponseAccumulator is now public (#155)
As discussed in #128. We make the ResponseAccumulator public to give developers an easy time to create a Task. With the ResponseAccumulator the developer using this does not have to worry, about implementing the HTTPClientResponseDelegate all by himself.
2020-01-20 17:11:39 +00:00
Marcin Krzyzanowski d5aa3a1bee Make public class public contrictible (#154) 2020-01-19 21:26:30 +00:00
Trevör 871c655a1a Remove parts of #139 relying on the Network framework (#147)
Use the UNIX implementation across all platforms to avoid unnecessary
complexity introduced by platform specific implementations
2019-12-19 17:10:08 +00:00
Johannes Weiss 669745f533 Update docker-compose.1804.51.yaml (#145) 2019-12-18 13:32:32 -08:00
Andreas Kostuch 8f2f7b1691 Bugfix HTTPS SNI and IP Address (#139)
* Bugfix HTTPS SNI and IP Address

Motivation:

Solving the SNI Bug

Modifications:

Added an internal extension on String for checking if the hostname is an IP Address -- see the private extension on SNI. Additionally using the IPv4Address and IPv6Address Function from Network above 10.14 as protecting with #availabe.
Adding the test for HTTPS and IP in as hostname

Result:

We get results with an IP as Hostname
2019-12-16 22:21:25 +00:00
Johannes Weiss d2d7bde0ca add test where server sends connection: close (#143)
Motivation:

We need a test that we can handle servers that repeatedly send
connection: closes.

Modification:

Add a unit test that always makes the server send connection: close.

Result:

More test coverage.
2019-12-15 12:57:06 +00:00
Johannes Weiss 726d0c62d1 sanity check: fix copyright year parsing (#142) 2019-12-11 11:55:33 +00:00
Johannes Weiss 48e284d1ea fix NIO deprecations & update to secure versions (#141) 1.0.1 2019-12-10 18:08:28 +00:00
Johannes Weiss de4d1add8d add a parallel test case (#140)
Motivation:

It's important to also have a test case where async-http-client is
actually used to do multiple parallel requests on multiple workers.

Modification:

Add a test where 5 workers are doing 100 requests each.

Result:

Better test coverage.
2019-12-06 17:40:45 +00:00
Johannes Weiss 7aeaf6f0e1 a set of extra test cases (#132)
Motivation:

More unit tests are good and now that SwiftNIO shipd
`NIOHTTP1TestServer`, writing integration tests for async-http-client is also
more straightforward.

Modification:

Demonstrate some tests using NIOHTTP1TestServer.

Result:

More tests.
2019-11-18 16:11:30 +01:00
tomer doron 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
tomer doron cbe6a53755 check for api breakage and prepare to test with thread sanitizer in ci (#122)
motivation: better ci testing

changes:
* add api breakage script to test api breakage in ci
* add "shell" utility docker-compose task to run api breakage script
* change test task to treat warning as errors
* prepare to test with thread sanitizer in 5.1
2019-11-04 16:57:39 -08:00
Armand Grillet 4eedb14948 Update dependency given in README to 1.0.0 (#121)
Following the release of async-http-client 1.0.0, the dependency to add in Package.swift is now bumped too.
2019-10-27 11:21:11 +03:00
Artem Redkin 51dc885a30 add support for redirect limits (#113) 1.0.0 2019-10-23 19:29:25 +03:00
Johannes Weiss c1c3da3990 remove all deprecations (#116) 2019-10-22 17:52:11 -07:00
Artem Redkin 191c4ba506 add response decompression support (#86)
fixes #44
2019-10-22 17:45:12 -07:00
tomer doron d84a1da59e swift 5.1 docker setup (#111)
motivation: support swift 5.1

changes:
* add docker compose file for swift 5.1, will add CI job once merged
* update swiftformat version to 0.40.12
1.0.0-alpha.4
2019-09-24 16:03:23 -07:00
Artem Redkin 54b0b96b74 cancel should be done with outbound user event (#110)
cancel should be done with outbound user event
2019-09-23 16:43:15 +01:00
Johannes Weiss 513be15050 EventLoop preference overhaul (#102) 2019-09-21 21:33:15 +02:00
Artem Redkin 79cd718c35 preserve trailing slash in uri path (#107) 2019-09-20 15:32:49 +01:00
Trevör 6efe214716 Remove spaces in range operators (#104) 2019-09-17 13:28:05 +01:00
Johannes Weiss 2d7ae2bbae minor: improve code style (#103) 2019-09-15 11:04:11 +01:00
Trevör 8f9023cd64 Update .gitignore (#106)
Ignore .swiftpm/
2019-09-15 10:22:24 +01:00
Johannes Weiss 1b31c5a4e3 give generic parameters nice names (#99) 1.0.0-alpha.3 2019-09-09 17:54:21 +01:00
vkill 47de4bb5ec Add authorization to proxy (#94) 2019-09-08 14:30:24 +01:00
Trevör 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
Johannes Weiss 26afbc14bb make sure HTTPClient is shutdown (#98)
Motivation:

Right now, HTTPClient only asserts that it's shut down if it was started with its own EventLoopGroup.
That however is weird because it's lifecycle model depends on the parameters you pass to `init`.

Modifications:

Always validate the lifecycle (in debug mode).

Result:

API makes more sense.
2019-09-05 15:33:13 +01:00
Artem Redkin bbf7966992 nest timeout configuration type inside configuration (#93)
* nest timeout configuration type inside configuration

* move timeout to an extension
2019-08-31 09:49:56 +01:00
vkill 5156eb22b1 Fix forgot to set maxAge in Cookie init function (#91) 2019-08-24 11:21:05 +01:00
tomer doron b1eb92eb3d refactor proxy configuration (#90)
* refactor proxy configuration

motivation: make proxy configuration follow same convention as other configuration

changes:
* nest Proxy under HTTPClient.Configuration instad of top level HTTPClient
* make host and port public and mutable, following convention of other configuration objects in this library
* add some API docs

* fixup
2019-08-24 08:58:51 +01:00
Ludovic Dewailly 8814439abe redirects ignore EventLoop preference - issue#88 (#89) 2019-08-21 11:26:19 +01:00
Artem Redkin 64851a1a0a add NIO event loop as an argument for execute (#79)
* add NIO event loop as an argument for execute

* review fix: add to np-delegate method as well

* Resolve confict

* add missing linux test

* fix formatting

* missing self

* review fix: add event loop preference argument instead of eventloop

* formatting

* review fix: spelling

* fix compilation error

* review fixes: make preference argument not explicit and add precondition that EL must be part of ELG
1.0.0-alpha.2
2019-08-20 17:50:10 +01:00
Johannes Weiss 6c6162b27f fix README: fixed a couple of documentation mistakes (#87)
* fix README: fixed a couple of documentation mistakes

- README suggested that you should shut down the client in a `defer` block right after calling `get` which will not actually work because the `get` is asynchronous so returns before it's done
- README said that if you share the `EventLoop` you don't need to shut down the `HTTPClient` which is not true
- README didn't make it clear that using `HTTPClient(eventLoopGroupProvider: .createNew)` is an acceptable thing to write in many places but it's really resource inefficient

* Update README.md
2019-08-19 14:37:21 +01:00
Artem Redkin e9d0dd2cc9 rename didReceivePart to didReceiveBodyPart (#84) 2019-08-17 13:32:51 +01:00
Artem Redkin 3c21d3cb90 fix usage of deprecated methods (#85) 2019-08-17 13:17:35 +01:00
vkill 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
Trevör 690e8ee797 Add @discardableResult to HTTPHandler setChannel method (#81)
The only place where this method is currently called uses its return
value, but that's specific to the context where it's used (inside of
chained calls to map/flatMap). Future uses might not always need to use
the return value since it is the same as what's passed as the method
argument.
2019-08-14 11:06:32 +01:00
Trevör 45bbe121b7 Update .gitignore (#80)
Ignore .DS_Store files
2019-08-13 13:25:35 +01:00
vkill 912005b4f1 Add init to HTTPClient.Response (#75) 2019-08-12 15:15:00 +01:00
tomer doron e64448e1ef improve request validation (#67)
motivation: safer handling of request validation and mutation

changes:
* drop request version
* made request method and url immutable
* made request scheme and host internal
* fix scheme logic to be non-case sensitive
* adjusted redirect handler implementation to stricter request immutabllity
* adjust and add tests
2019-07-30 09:55:38 -07:00
tomer doron bab22d0ebd test formatting issues as part of sanity check (#73)
motivaiton: unified format

changes:
* fix outstanding formatting issues
* add a call to swiftformat as part of sanity script
* fix sanity script language check debugging statements
2019-07-30 10:00:10 +01:00