Commit Graph

1942 Commits

Author SHA1 Message Date
Sergio Benitez
c2960e7e6f Uniformly implement utility traits on URI types. 2021-06-09 17:44:12 -07:00
Sergio Benitez
d2c2725689 Implement 'De(Serialize)' for 'Method'. 2021-06-09 17:07:26 -07:00
Sergio Benitez
ca655051ba Update 'state' version in CHANGELOG. 2021-06-09 11:02:30 -07:00
Sergio Benitez
36c1570c61 Fix order of contrib crates in config script. 2021-06-09 09:59:44 -07:00
Sergio Benitez
ecde703bb9 Add news article for v0.5-rc.1. 2021-06-09 09:52:37 -07:00
Sergio Benitez
c028d63e5b New version: 0.5.0-rc.1.
New contrib versions: 0.1.0-rc.1.
2021-06-09 09:52:37 -07:00
Jeb Rosen
b0684c8327 Add initial CHANGELOG for v0.5.
Co-authored-by: Sergio Benitez <sb@sergio.bz>
2021-06-09 09:52:35 -07:00
Sergio Benitez
6961a717d8 Use crates.io compatible internal package names. 2021-06-09 09:47:21 -07:00
Sergio Benitez
1aa551ada6 Ignore heartbeats in non-heartbeat SSE test. 2021-06-09 04:51:46 -07:00
Sergio Benitez
32ec00ca19 Update deps when testing sibling workspaces. 2021-06-09 04:51:46 -07:00
Sergio Benitez
394982edbd Make new contrib libraries publishable. 2021-06-09 04:51:46 -07:00
Sergio Benitez
fe16d11581 Update 'release' date for master. 2021-06-09 04:51:46 -07:00
Sergio Benitez
06455b6eb2 Use crate version in pre-release docs. 2021-06-09 04:51:46 -07:00
Sergio Benitez
01436d2d24 Fix a ton of broken links. 2021-06-09 04:51:46 -07:00
Jeb Rosen
3b5f5afc6e Advertise HTTP/2 support via ALPN. 2021-06-09 04:51:33 -07:00
Sergio Benitez
dd9629697a Use published 'devise'. 2021-06-09 00:46:28 -07:00
Sergio Benitez
f4ecc3e3bd Update 'sqlite' contrib dependencies. 2021-06-09 00:36:25 -07:00
Sergio Benitez
b19544c346 Fix doc typo: "Contracting" -> "Constructing". 2021-06-08 23:13:03 -07:00
Sergio Benitez
128234d9a8 Allow customizing and removing 'Server' header. 2021-06-08 23:09:57 -07:00
Sergio Benitez
6206a46222 Try to preserve header casing in HTTP/1.1.
Unfortunately, this doesn't actually do anything at the moment due to
what appears to be a bug in hyper.
2021-06-08 23:00:59 -07:00
Sergio Benitez
1a42009e9f Fix various generated and direct clippy warnings. 2021-06-08 13:27:09 -07:00
Sergio Benitez
4c6562cd29 Drop 'Data' after sending a response, not before.
This allows responses to be sent to the client even when data is only
partially read, significantly improving the experience for the client
from one with a "connection closed" error to one with a proper response.
The consequence is a lifetime in 'Data'.

Though other non-lifetime-introducing solutions exist, the introduction
of a lifetime to 'Data' is a longstanding desire as it prevents
smuggling 'Data' into a longer-lived context. Use of 'Data' in that
context was unspecified with various runtime consequences. The addition
of a lifetime bound by the request prevents this error statically.

In summary, the changes are:
  * Clients receive responses even when data isn't fully read.
  * 'Data' becomes 'Data<'r>'. 'FromData' changes accordingly.
  * Route 'Outcome's are strictly tied to the request lifetime.

Tangentially, the invalid length form field validation error message has
improved to format length in byte units if it exceeds 1024.
2021-06-08 13:26:16 -07:00
Sergio Benitez
7595450adc Use published 'state'. 2021-06-07 20:34:27 -07:00
Sergio Benitez
723afa317a Remove 'Copy' impl on 'Segments' iterator.
This ideally prevents logic bugs where one thinks they've modified the
iterator where, in reality, a new iterator has been returned.
2021-06-07 20:34:27 -07:00
Sergio Benitez
fc2a1736ec Use stable, Windows compatible benchmarking. 2021-06-07 20:34:20 -07:00
Sergio Benitez
333da45470 Allow non-breaking config additions.
If stars aligned properly, we might imagine writing this:

    #[non_exhaustive]
    struct Config {
        pub field: Foo,
        pub other: Bar,
    }

...with semantics that would allow the defining crate (here, Rocket), to
construct the structure directly while consumers would need to use
public constructors or struct update syntax:

    Config {
        field: Foo,
        other: Bar,
        ..Default::default()
    }

Alas, this is not the way `non_exhaustive` works on structs. You cannot
use field-update syntax to construct `Config` above. You must use public
constructors. This means builder methods or mutating an already built
struct. This is not what we want.

I don't know why it works this way. I don't see why it must. Something
something Drop.

So we have this hack from the pre-non_exhaustive era.
2021-06-07 19:31:23 -07:00
Sergio Benitez
5f50d5e232 Check for trailing new lines in testing script. 2021-06-07 19:31:23 -07:00
Sergio Benitez
2d974ece78 Check fuzzers and benchmarks in testing script. 2021-06-07 19:31:23 -07:00
Sergio Benitez
0aa9a11ca4 Fix typos throughout codebase. 2021-06-07 19:31:21 -07:00
Sergio Benitez
cad5494d42 Document ignored segments. 2021-06-07 17:22:35 -07:00
Sergio Benitez
94a5f5eca6 Fuzz URI parsing and display. 2021-06-06 21:52:44 -07:00
Sergio Benitez
0d53e23bf6 Discover sentinels in known type macros.
Resolves #1657.
2021-06-03 19:31:30 -07:00
Juhasz Sandor
469f3942eb Use an 'include' in tera templating example. 2021-06-03 13:21:04 -07:00
Sergio Benitez
dc5c57b624 Be even more tolerant in heartbeat testing. 2021-06-03 02:51:06 -07:00
Sergio Benitez
1e4db983e8 Fix, finish 'FromForm' derive field defaults.
Resolves #1536.
2021-06-03 00:05:02 -07:00
ThouCheese
ebb9f3cfdd Allow field defaults in 'FromForm' derive. 2021-06-03 00:02:32 -07:00
Sergio Benitez
559320d155 Increase tolerance in SSE heartbeat test. 2021-06-02 22:35:50 -07:00
Sergio Benitez
9f5a587dc3 Add more examples to wrapping responders guide.
Co-authored-by: RotesWasser <hallo@roteswasser.com>
2021-06-02 18:04:15 -07:00
toshokan
27519a97ea Fix typo in 'Request' docs: nonth -> nth. 2021-06-02 17:43:15 -07:00
Sergio Benitez
0cd8bd2313 Initialize logger earlier to log more errors.
Specifically, errors that occurred _before_ ignite time went unlogged as
no logger was initialized. This commit rectifies the situation.
2021-06-02 17:25:07 -07:00
Sergio Benitez
f8efa64ae2 Expose 'msgpack::from_slice', 'json::from_value'. 2021-06-02 16:59:42 -07:00
Sergio Benitez
74299a9719 Make minor improvements to chat example. 2021-06-02 00:10:34 -07:00
Sergio Benitez
f1ecb79a7e Add fully featured SSE chat example. 2021-06-01 13:47:52 -07:00
Sergio Benitez
a8f6103b99 Introduce Server-Sent Event Streams.
Resolves #33.
2021-06-01 13:47:50 -07:00
Sergio Benitez
8029ea319f Expose 'serde::json::{from_str,from_slice}'. 2021-06-01 13:47:50 -07:00
Jeb Rosen
2076b693b1 Add initial Server-Sent Events implementation. 2021-06-01 13:19:58 -07:00
Sergio Benitez
78352c787d Add 'ContentType::EventStream' known media type.
The value maps to "text/event-stream".
2021-06-01 11:46:47 -07:00
Sergio Benitez
bcd62e5373 Add 'Join' stream combinator extension. 2021-06-01 11:46:17 -07:00
Sergio Benitez
ed3cc13b84 Add internal '__typed_stream' proc-macro.
This resolves syntax ambiguity issues with public typed-stream macros.
Prior to this commit, greedy single-token matching by macro-rules macros
would result in certain tokens at the beginning of the macro input, such
as 'for', inadvertently triggering a '$ty' matching case resulting in
incorrect expansion.
2021-06-01 11:43:51 -07:00
Sergio Benitez
009be32a8c Improve request conversion performance, semantics.
This commit makes the following improvements to core request handling:

  * Absolute target URIs are not rejected. Instead, the path and query
    parts are passed through the application. This resolves an issue
    where certain HTTP/2 requests would be rejected by Rocket.
  * Data is never copied from the request. Previously, Rocket would copy
    and allocate for incoming headers.
  * Non-UTF-8 headers are dropped with a warning instead of being
    lossily, and thus perhaps incorrectly, decoded as UTF-8. The final
    fix is to properly support non-UTF-8 headers, no matter how in the
    minority they are.

Resolves #1498.
2021-06-01 11:36:57 -07:00