Commit Graph
502 Commits
Author SHA1 Message Date
Ofek LevandGitHub 7d024e292b Fix link (#732) 2021-10-20 10:33:01 -04:00
Derek StricklandandGitHub 3f9ab801f7 feat(build): Support prost's include_file option (#774) 2021-10-20 10:11:01 -04:00
88008191fc compression: handle compression flag but no header (#763)
Co-authored-by: Quentin Perez <[email protected]>
Co-authored-by: Lucio Franco <[email protected]>
2021-10-20 10:02:52 -04:00
Lucio FrancoandGitHub 4054d61e14 fix(tonic): Status code to set correct source on unkown error (#799) 2021-10-19 11:52:59 -04:00
c1fe31c1a3 health, reflection: make rustfmt dependency optional (#785)
Co-authored-by: Lucio Franco <[email protected]>
2021-10-19 11:22:34 -04:00
Eliza WeismanandGitHub 09805ece45 feat: Update prost and friends to 0.9 (#791) 2021-10-19 10:59:28 -04:00
Lucio FrancoandGitHub 4604042934 Add streaming example w/ client disconnect (#782) 2021-10-07 17:04:26 -04:00
Mihai Claudiu ToaderandGitHub 5c1bb90ce8 fix(tonic): fix extensions disappearing during streaming requests
Fixes #770
2021-09-30 12:56:12 +02:00
Jerboas86andGitHub ddab65ede9 docs: fix typo (#760)
in in <--> in
2021-09-08 18:43:10 +02:00
Nicholas ConnorandGitHub b30b1a1e25 Fix README.md links (#756) 2021-09-02 21:23:18 +02:00
Sönke HahnandGitHub a7f9cf2afa Fix typo in docs (#753) 2021-09-01 08:29:08 +02:00
David PedersenandGitHub 65df87ad6c chore: Prepare tonic v0.5.2 (#738)
So as highlighted by
https://github.com/hyperium/tonic/issues/730#issuecomment-895635088 it
turns out the new `Interceptor` trait required changes to tonic-build as
well, which I forgot to publish yesterday. Didn't see it because it wasn't
clear from the commit message.

So this bumps tonic _and_ tonic-build to 0.5.2 so we can release both.
There are no code changes.
2021-08-10 15:35:36 +02:00
David PedersenandGitHub efe0865d26 chore: Prepare tonic v0.5.1 and tonic-health 0.4.1 (#737) 2021-08-09 17:20:36 +02:00
David PedersenandGitHub 4e578b5046 doc(tonic): add more interceptor examples (#736)
Some have asked how to use the new `Interceptor` trait to create named
interceptors. This updates the client example to show how to do that.
2021-08-09 16:42:15 +02:00
Yotam OfekandGitHub 8c8f4d1251 feat(tonic): add Interceptor trait (#713)
* Expose `Interceptor` trait.

* Revert changes to public API surface.

* Rename types, add deprecated alias for old names.
2021-07-27 11:11:51 -04:00
Lucio FrancoandGitHub 0e33a0241e feat(transport): Add Connected impl for DuplexStream (#722) 2021-07-13 15:39:42 -04:00
Blake WilloughbyandGitHub 6ee638d940 feat(health): Expose grpc_health_v1 file descriptor set (#620) 2021-07-13 15:35:35 -04:00
David PedersenandGitHub 99fdc98d41 chore: Prepare tonic-build v0.5.1 (#720) 2021-07-13 20:17:58 +02:00
David PedersenandGitHub 380d81dd86 fix(build): allow services to be named Service (#709)
Fixes https://github.com/hyperium/tonic/issues/676
2021-07-12 16:47:45 +02:00
David PedersenandGitHub 167e8cb5b2 fix(build): remove unnecessary Debug constraint for client streams (#719)
This was accidentally committed as part of
https://github.com/hyperium/tonic/pull/692.

Fixes https://github.com/hyperium/tonic/issues/718
2021-07-12 16:41:09 +02:00
Conner BryanandGitHub 0a06603659 derive Clone for RouterService (#714) 2021-07-11 15:37:07 +02:00
David PedersenandGitHub 4b0ece6d28 chore: fix clippy lints (#707) 2021-07-09 18:23:55 +02:00
David PedersenandGitHub 5aa8ae1fec feat(examples): add grpc-web example (#710)
Creates a server using tonic-web and a client that uses a regular
`hyper::Client` and issues a regular HTTP/1.1 request.
2021-07-09 18:02:43 +02:00
Lucio Franco 5bb1a029a1 Fix tonic-types and health versions 2021-07-08 15:57:25 -04:00
040e3a4811 chore: Prepare v0.5 release (#706)
* bump tonic version to 0.5

* Update changelog for 0.5

* Update CHANGELOG.md

Co-authored-by: David Pedersen <[email protected]>

* address comments

Co-authored-by: David Pedersen <[email protected]>
2021-07-08 15:53:14 -04:00
David PedersenandGitHub acdb3273bb chore: update prost, and related crates, to 0.8 (#703)
* chore: update prost, and related crates, to 0.8

Updates prost, prost-derive, prost-build, and prost-types to 0.8.

* Update the last few places
2021-07-08 15:02:02 -04:00
Conner BryanandGitHub a948a8f884 feat(build): support adding attributes to clients and servers (#684) 2021-07-08 15:01:28 -04:00
David PedersenandGitHub 89df3380dd doc(tonic): mention tower-http's tracing middleware (#705)
Fixes https://github.com/hyperium/tonic/issues/654
2021-07-08 17:50:27 +02:00
Lucio FrancoandGitHub 2346d99f6e example: Add mocked io example (#677)
* example: Add mocked io example

* fix mock example

* Remove uniex bound for mock impl
2021-07-08 10:45:04 -04:00
David PedersenandGitHub 6711b80674 fix(tonic): don't remove reserved headers in interceptor (#701)
`InterceptedService` would previously use `tonic::Request::into_http`
which removes reserved headers. That mean inner middleware in the stack
wouldn't be able to see those headers, which could result in errors.

Fixes https://github.com/hyperium/tonic/issues/700
2021-07-08 10:30:46 -04:00
David PedersenandGitHub 0583cff80f feat(codec): compression support (#692)
* Initial compression support

* Support configuring compression on `Server`

* Minor clean up

* Test that compression is actually happening

* Clean up some todos

* channels compressing requests

* Move compression to be on the codecs

* Test sending compressed request to server that doesn't support it

* Clean up a bit

* Compress server streams

* Compress client streams

* Bidirectional streaming compression

* Handle receiving unsupported encoding

* Clean up

* Add note to future self

* Support disabling compression for individual responses

* Add docs

* Add compression examples

* Disable compression behind feature flag

* Add some docs

* Make flate2 optional dependency

* Fix docs wording

* Format

* Reply with which encodings are supported

* Convert tests to use mocked io

* Fix lints

* Use separate counters

* Don't make a long stream

* Address review feedback
2021-07-02 11:25:03 -04:00
Lucio Franco 7677ad6476 Fix connect with connector lazy 2021-07-01 18:31:39 +00:00
Lucio FrancoandGitHub 2a46ff5c96 feat(transport): Add connect_with_connector_lazy (#696)
Closes #695
2021-07-01 14:13:41 -04:00
Lucio FrancoandGitHub 737ace393d fix(codec): Fix streaming reponses w/ many status (#689)
Closes #681
2021-07-01 10:25:43 -04:00
2b60a00614 feat(transport): add connect timeout to Endpoint (#662)
Pulls in [hyper-timeout] which has a connector that can have a timeout
applied. I did consider vendoring hyper-timeout since its a fairly small
crate. I guess we can always do that later since its not exposed
publicly.

I would also like to add a test but I'm not sure about the best way of
testing this.

Fixes https://github.com/hyperium/tonic/issues/498

[hyper-timeout]: https://github.com/hjr3/hyper-timeout

Co-authored-by: Lucio Franco <[email protected]>
2021-07-01 10:23:22 -04:00
Tom DyasandGitHub b90bb7bbc0 feat(tonic): add h2::Error as a source for Status (#612)
## Motivation

A gRPC server may send a HTTP/2 GOAWAY frame with NO_ERROR status to gracefully shutdown a connection. This appears to Tonic users as a `tonic::Status` with `Code::Internal` and the message set to `h2 protocol error: protocol error: not a result of an error`.

The only way to currently detect this case and differentiate it from other internal errors (e.g., an application-level internal error) is to match on the message. A client may want to differentiate these cases because it may only want to alert on the application-level internal error and not on the transient transport-level issue. (Indeed, this is the use case for which I'm envisioning using this change.)

Matching on a message is not as robust, however, as matching on an `h2::Error` and its reason code. (The message could change for example if a future version of Tonic decided to vary the message. This would break any users that matched on the previous version of the message.)

## Solution

Store the `h2::Error` used when creating a `tonic::Status` from a `h2::Error` and provide it as the `source` for purposes of `std::error::Error`. This will allow users to downcast it and match on the original `h2::Reason`.
2021-06-23 08:34:07 +02:00
David PedersenandGitHub 12815d0a1d feat(tonic): expose setting for http2_adaptive_window (#657)
Fixes https://github.com/hyperium/tonic/issues/358
2021-06-21 12:42:52 -04:00
Szymon GibałaandGitHub 2ba0889553 tonic: propagate call to poll_ready in InterceptedService (#685)
Fixes: #678
2021-06-19 16:51:20 +02:00
Juan AlvarezandGitHub 4e0d2fc598 chore(tonic-web): add crate metadata and README (#675) 2021-06-04 16:26:15 -05:00
Juan AlvarezandGitHub 8084f4ea26 chore(tonic-web): include crate in top-level workspace (#648)
This PR adds the tonic-web crate to tonic's workspace members. 
Unit and integration tests should now run as part of CI runs.
2021-06-03 11:48:53 -05:00
David PedersenandGitHub 3e95553c57 doc: mention Well Known Types in README (#661)
Fixes https://github.com/hyperium/tonic/issues/447
2021-06-02 16:59:09 +02:00
David PedersenandGitHub e82f0b0399 build: generate root crate paths correctly (#623)
We shouldn't append `proto_path` (`super` by default) if the path starts
with `crate::`.

Fixes https://github.com/hyperium/tonic/issues/548
2021-06-02 16:58:43 +02:00
Ken PowersandGitHub 0fa391eca4 Use dark mode for docs logo (#613) 2021-06-02 10:37:49 -04:00
gmorerandGitHub e1993877c4 fix(web): fix compilation (#670)
Make tonic::body::empty_body public and use it instead of the old and non existant anymore BoxBody::empty()
2021-06-02 13:59:11 +02:00
David PedersenandGitHub 9cc14b79fb fix(codec): improve error message for invalid compression flag (#663)
* fix(codec): improve error message for invalid compression flag

Fixes https://github.com/hyperium/tonic/issues/492

* Update tonic/src/codec/decode.rs
2021-05-28 13:28:02 +02:00
David PedersenandGitHub e5e311853b feat(transport): provide generic access to connect info (#647) 2021-05-28 13:27:37 +02:00
David PedersenandGitHub 31a34681c7 fix(tonic): don't include error's cause in Display impl (#633)
At Embark we have a little helper function that converts a `&dyn
std::error::Error` into a `String` by walking the full chain of sources
(with `std::error::Error::source`) and joining them into a `String`.

We use that where we log errors to get as much information as possible
about whats causing an error. Works particularly well with anyhow's
`.context()` method.

However since `tonic::transport::Error` include its cause in their
`Display` impl we get the sources more than once.

As the cause can already be obtained through `std::error::Error::source`
no information should be lost by doing this.

Fixes https://github.com/hyperium/tonic/issues/632
2021-05-27 22:53:43 +02:00
David PedersenandGitHub 9478fac979 fix(build): fix with_interceptor not building on Rust 1.51 (#669)
Fixes https://github.com/hyperium/tonic/issues/666
2021-05-27 15:47:42 +02:00
Josh TriplettandGitHub 32173dc7f6 feat(transport): Add a tls-webpki-roots feature to add trust roots from webpki-roots (#660) 2021-05-24 10:35:05 -04:00
David PedersenandGitHub 4d2667d1cb feat(tonic): make it easier to add tower middleware to servers (#651) 2021-05-19 09:19:58 +02:00