Commit Graph

2455 Commits

Author SHA1 Message Date
Sean McArthur
1010614a0d test(client): refactor client helper macro to handle options better 2021-11-24 14:26:26 -08:00
Paolo Barbolini
842c6553a5 feat(server): add HTTP/1 header read timeout option (#2675)
Adds `Server::http1_header_read_timeout(Duration)`. Setting a duration will determine how long a client has to finish sending all the request headers before trigger a timeout test. This can help reduce resource usage when bad actors open connections without sending full requests.

Closes #2457
2021-11-18 12:02:06 -08:00
Sean McArthur
d0b1d9ed3a v0.14.15 2021-11-16 11:56:51 -08:00
Sean McArthur
a1502e1067 docs(http1): clarify HTTP1 preserve case option 2021-11-16 11:44:21 -08:00
Sean McArthur
a12db28542 docs(upgrade): add module documentation for HTTP upgrades 2021-11-15 14:47:29 -08:00
Sean McArthur
7f5e853dd8 refactor(benches): make benchmark names more consistent 2021-11-12 15:09:52 -08:00
Ahmed Sobeh
174b553d2d fit(client): cancel blocking DNS lookup if GaiFuture dropped (#2689)
Closes #2686
2021-11-08 14:23:18 -08:00
muvlon
913be88f71 docs(client): fix missing feature attrs in another doctest
when testing my fix for #2687, I noticed that this doctest has the same issue,
so here's another fix.
2021-11-08 10:47:08 -08:00
muvlon
3221f573d2 docs(body) fix doctest failing due to missing features
The doctest uses `hyper::Client`, but that is not available unless these features are enabled.
This commit adds an attribute to check for those and allows `cargo test` with no arguments to pass again.

fixes #2687.
2021-11-08 10:47:08 -08:00
Anthony Ramine
80627141ed feat(http1): Add http1_writev(bool) to client and server Builders
Restore a way to force queue writing strategy.

Closes #2676
2021-11-04 15:29:43 -07:00
Luqman Aden
ab469eb3c6 feat(upgrade): allow http upgrades with any body type
Allow using `Request<T>`/`Response<T>` for any given T with
`upgrade::on` instead of just restricting it to `hyper::Body`.
2021-11-03 11:40:33 -07:00
Sean McArthur
b5022f3854 v0.14.14 2021-10-22 09:53:21 -07:00
Alice Ryhl
bd6c35b98f fix(client): make ResponseFuture implement Sync 2021-10-18 10:25:27 -07:00
Sean McArthur
d0c6aaa59d chore(ci): only run cargo check on MSRV, not tests 2021-10-18 09:52:21 -07:00
Sean McArthur
e48519a1e2 refactor(http1): adjust a few tracing event outputs 2021-10-13 17:42:30 -07:00
Sean McArthur
55a61c072d test(client): remove unneeded ipv6 dns parse test 2021-10-13 17:26:36 -07:00
Ryan Goodfellow
910e02687d fix(client): remove ipv6 square brackets before resolving 2021-10-13 15:54:38 -07:00
Rafael Ávila de Espíndola
1d553e52c6 feat(server): Remove Send + Sync requirement for Body in with_graceful_shutdown
Also expand the single threaded example to use that.
2021-10-12 16:47:03 -07:00
Rafael Ávila de Espíndola
7feab2f3db test(server): Use a !Send and !Sync HttpBody in an example
The default Body type is used in the client in a Pool, so it has to be
Send. On the server, we can use a !Send type if the executor is single
threaded.

Expand the existing example to show that.
2021-10-12 16:47:03 -07:00
Anthony Ramine
6169db250c feat(h2): always include original h2 error on broken pipe 2021-10-04 13:35:07 -07:00
Sean McArthur
ecd5dc1034 docs(contrib): add Minimum Support Rust Version (MSRV) policy 2021-09-21 16:02:04 -07:00
Dai Dao
3908eeb788 docs(examples): updated imports in client_json example (#2412) 2021-09-16 16:34:10 -07:00
Ivan Tham
7757789589 docs(client): add link and cleanup example for hyper::client::conn (#2533) 2021-09-16 16:31:59 -07:00
Vagelis Prokopiou
0460cd909e docs(body): add example for to_bytes()
cc #2201
2021-09-16 16:25:40 -07:00
Sean McArthur
e6b2cbda03 docs(dev): start a set of "dev" docs
Initially this creates a top-level "dev" directory to hold documents
pertaining to the development, as opposed to the usage, of hyper. For a
first doc, it splits out the commit guidelines to its own file.

cc #2586
2021-09-16 12:53:59 -07:00
Sean McArthur
6a876b8ed2 v0.14.13 2021-09-16 10:25:36 -07:00
Sean McArthur
949216f583 docs(ffi): expand URI documentation 2021-09-16 10:20:40 -07:00
David Cook
a54689b921 feat(ffi): add hyper_request_set_uri_parts
Add a second FFI interface for setting the URI of a request with three
separate schema, authority, and path/query strings, rather than one URI
string.
2021-09-16 09:55:28 -07:00
Sean McArthur
ea3e228287 fix(server): convert panic to error if Connection::without_shutdown called on HTTP/2 conn 2021-09-15 15:50:49 -07:00
Sean McArthur
c88011da4e fix(client): don't reuse a connection while still flushing
A client connection that read a full response while the request body was
still flushing would see incorrect behavior, since the pool would let it
be checked out again for a new request. In debug builds, it would then
panic, but in release builds it would intermix the 2nd request bytes
with the body of the previous request.

In practice, this only ever happens if a server replies with a full
response before reading the full request, while also choosing to not
close that connection. Most servers either wait for the full request, or
close the connection after the new response is written, so as to stop
reading.
2021-09-15 10:25:17 -07:00
Sean McArthur
e3ab409808 refactor(lints): fix unused warnings in tests/docs 2021-09-14 16:50:22 -07:00
Jonas Platte
0a4b56acb8 feat(lib): Export more things with Cargo features [server, !http1, !http2]
* server::Server
* server::conn::{AddrIncoming, AddrStream}

This allows higher-level libraries to use or re-export more parts of the
API without deciding for the end user which HTTP versions the hyper
server will support.
2021-08-31 16:35:52 -07:00
Jonas Platte
cf6f62c71e feat(lib): Export rt module independently of Cargo features 2021-08-31 16:35:52 -07:00
Jonas Platte
d49c25b224 refactor(server): Merge imports 2021-08-31 16:35:52 -07:00
Jonas Platte
db57316e14 refactor(lib): Clean up cfg usage 2021-08-31 16:35:52 -07:00
Jonas Platte
07f9208714 refactor(lib): Inline cfg_http1, cfg_http2 macros 2021-08-31 16:35:52 -07:00
Jonas Platte
a81c44f2c8 refactor(lib): Import tracing macros per-module
Instead of one #[macro_use] at the crate root.
2021-08-31 16:35:52 -07:00
Sean McArthur
165ada34a3 docs(ffi): note that hyper_buf_copy can return NULL on error 2021-08-26 16:48:03 -07:00
Sean McArthur
f46b175bf7 v0.14.12 2021-08-24 16:24:51 -07:00
Sean McArthur
39b6d01aa0 fix(ffi): on_informational callback had no headers 2021-08-19 12:21:17 -07:00
Sean McArthur
adaa8b3f0e chore(dependencies): require httparse 1.5.1 2021-08-19 11:30:41 -07:00
Soveu
95a978344c refactor(http1): use MaybeUninit for parsing with uninitialized headers (#2545)
Closes #2532
2021-08-19 11:10:30 -07:00
Anthony Ramine
be08648e82 fix(http2): improve errors emitted by HTTP2 Upgraded stream shutdown (#2622) 2021-08-19 11:05:26 -07:00
Daniel Stenberg
9a113ed416 docs(capi): fix typo in the upload example build (#2626) 2021-08-19 08:50:21 -07:00
Daniel Stenberg
a1995ee1cb docs(capi): build 'upload' example too by default (#2625) 2021-08-18 14:16:07 -07:00
Sean McArthur
3b26572876 refactor(ffi): check pointer arguments for NULL (#2624)
This changes all the extern C functions in `hyper::ffi` to check passed
pointer arguments for being `NULL` before trying to use them. Before, we
would just assume the programmer had passed a good pointer, which could
result in segmentation faults. Now:

- In debug builds, it will assert they aren't null, and so if they are,
  a message identifying the argument name will be printed and then the
  process will crash.
- In release builds, it will still check for null, but if found, it will
  return early, with a return value indicating failure if the return type
  allows (such as returning NULL, or `HYPERE_INVALID_ARG`).

Closes #2620
2021-08-18 14:15:14 -07:00
Sean McArthur
c35153998e docs(capi): output the hyper_version in the capi examples (#2623) 2021-08-18 10:29:20 -07:00
Jan Verbeek
684f2fa76d fix(http1): apply header title case for consecutive dashes (#2613)
Fix the header title-casing to work with consecutive
dashes. Previously with two dashes in a row the first dash would
uppercase the second dash which would then not count, so
`weird--header` would be cased as `Weird--header` instead of
`Weird--Header`.
2021-08-05 17:00:57 -07:00
Aaron Turon
73bff4e98c feat(client): expose http09 and http1 options on client::conn::Builder (#2611)
These options are currently available on the high-level builder only.

Along the way, rename the setters to follow the public API conventions
and add docs.

Closes #2461
2021-08-04 13:52:35 -07:00
Sean McArthur
91bbce4ed3 chore(ffi): update gen_header script to use unpretty option 2021-08-04 11:45:03 -07:00