1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-06-02 13:29:24 +00:00
Commit graph

92 commits

Author SHA1 Message Date
Otavio Salvador 146ae4da18 Implement std::error::Error for our custom errors
For allowing a more ergonomic use and better integration on the
ecosystem, this adds the `std::error::Error` `impl` for our custom
errors.

We intent to drop this hand made code once `derive_more` finishes the
addition of the Error derive support[1]. Until that is available, we
need to live with that.

1. https://github.com/JelteF/derive_more/issues/92

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
2020-03-18 00:22:18 -03:00
Yuki Okushi f27dd19093 Fix Clippy warnings 2020-02-27 12:39:04 +09:00
Yuki Okushi 7ba14fd113 Run rustfmt 2020-02-27 11:10:55 +09:00
Maxim Vorobjov 48ef4d7a26
Add actix-http support for actix error messages (#1379)
* Moved actix-http for actix from actix crate

* remove resolver feature

* renamed actix feature to actor

* fixed doc attr for actors, add documentation
2020-02-27 09:34:49 +09:00
Daniel YU 245f96868a
impl downcast_ref for MessageBody (#1287)
Co-authored-by: Yuki Okushi <huyuumi.dev@gmail.com>
2020-02-21 13:31:51 +09:00
Aaron Hill 3033f187d2
Enforce safety of downcast_ref at compile time. (#1326)
* Enforce safety of `downcast_ref` at compile time.

The safety of `downcast_ref` requires that `__private_get_type_id__` not
be overriden by callers, since the returned `TypeId` is used to check if
the cast is safe. However, all trait methods in Rust are public, so
users can override `__private_get_type_id__` despite it being
`#[doc(hidden)]`.

This commit makes `__private_get_type_id__` return a type with a private
constructor, ensuring that the only possible implementation is the
default implementation. A more detailed explanation is provided in the
comments added to the file.

Note that the standard library was affected by this type of issue with
the `Error::type_id` function: see https://blog.rust-lang.org/2019/05/14/Rust-1.34.2.html#whats-in-1.34.2-stable

Co-authored-by: Yuki Okushi <huyuumi.dev@gmail.com>
2020-01-30 23:43:35 +09:00
Nikolay Kim 1d12ba9d5f Replace brotli with brotli2 #1224 2019-12-20 13:50:07 +06:00
Andrii Radyk 30dcaf9da0 fix deprecated Error::description (#1218) 2019-12-16 07:43:19 +06:00
Nikolay Kim c1deaaeb2f cleanup imports 2019-12-13 11:24:57 +06:00
Nikolay Kim 4937c9f9c2 refactor http-test server 2019-12-12 23:08:38 +06:00
0x1793d1 1b8d747937 Fix extra line feed (#1209) 2019-12-12 07:05:39 +06:00
Nikolay Kim 4a8a9ef405 update tests and clippy warnings 2019-12-08 12:31:16 +06:00
Nikolay Kim 6c9f9fff73 clippy warnings 2019-12-08 00:46:51 +06:00
Nikolay Kim 0ba125444a Add impl ResponseBuilder for Error 2019-12-07 21:41:34 +06:00
Nikolay Kim 205a964d8f upgrade to tokio 0.2 2019-12-05 23:35:43 +06:00
Nikolay Kim 14075ebf7f use released versions of actix-net 2019-12-02 23:33:39 +06:00
Nikolay Kim f73f97353b refactor ResponseError trait 2019-11-26 16:07:39 +06:00
Nikolay Kim 4dc31aac93 use actix_rt::test for test setup 2019-11-26 11:25:50 +06:00
Nikolay Kim 69cadcdedb migrate actix-files 2019-11-21 16:02:17 +06:00
Nikolay Kim 1ffa7d18d3 drop unpin constraint 2019-11-21 16:02:17 +06:00
Nikolay Kim 8cba1170e6 make actix-http compile with std::future 2019-11-21 16:02:17 +06:00
SuperHacker-liuan f089cf185b Let ResponseError render w/ 'text/plain; charset=utf-8' header (#1118) (#1119)
* Let ResponseError render w/ 'text/plain; charset=utf-8' header (#1118)

Trait ResponseError originally render Error messages with header
`text/plain` , which causes browsers (i.e. Firefox 70.0) with
Non-English locale unable to render UTF-8 responses with non-English
characters correctly. i.e. emoji.

This fix solved this problem by specifying the charset of `text/plain`
as utf-8, which is the default charset in rust.

Before actix-web consider to support other charsets, this hotfix is
 enough.

Test case:

fn test() -> Result<String, actix_web::Error> {
    Err(actix_web::error::ErrorForbidden("😋test"))
}

* Update actix-http/CHANGES.md for #1118
2019-10-07 10:56:24 +06:00
nWacky 7c9f9afc46 Add ability to use Infallible as HttpResponse error type (#1093)
* Add `std::convert::Infallible` implementantion for `ResponseError`

* Add from `std::convert::Infallible` to `Error`

* Remove `ResponseError` implementantion for `Infallible`

* Remove useless docs

* Better comment

* Update changelog

* Update actix_http::changelog
2019-09-17 06:57:38 +06:00
Yuki Okushi 23d768a77b
Add explicit dyns (#1041)
* Add explicit `dyn`s

* Remove unnecessary lines
2019-08-17 02:45:44 +09:00
Sven-Hendrik Haase 81ab37f235 Fix two dyn warnings (#1015) 2019-07-29 08:10:33 +04:00
Nikolay Kim 9c3789cbd0 revert DateServiceInner changes 2019-07-18 17:37:41 +06:00
Armin Ronacher 29098f8397 Add support for downcasting response errors (#986)
* Add support for downcasting response errors

* Added test for error casting
2019-07-18 17:25:50 +06:00
Nikolay Kim 2a2d7f5768 nightly clippy warnings 2019-07-17 15:53:51 +06:00
Otavio Salvador 6e00eef63a awc: Fix typo on ResponseError documentation (#815)
* awc: Fix typo on ResponseError documentation

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>

* http: Fix typo on ResponseError documentation

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>

* http: Expand type names for openssl related errors documentation

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
2019-05-03 14:30:00 -07:00
Nikolay Kim 94d7a7f873 custom future for SendError service 2019-04-11 15:12:23 -07:00
Nikolay Kim 9d82d4dfb9 Fix body propagation in Response::from_error. #760 2019-04-10 12:43:31 -07:00
Nikolay Kim 561f83d044 add upgrade service support to h1 dispatcher 2019-04-08 17:51:14 -07:00
Nikolay Kim fbedaec661 add expect: 100-continue support #141 2019-04-05 16:46:44 -07:00
Nikolay Kim 1f5c0f50f9 Add minimal std::error::Error impl for Error 2019-04-04 13:23:38 -07:00
Nikolay Kim 1e2bd68e83 Render error and return as response body 2019-04-03 19:55:19 -07:00
Nikolay Kim d846328f36 fork cookie crate 2019-03-29 21:13:39 -07:00
Nikolay Kim 19a0b8046b remove actix reference 2019-03-29 11:13:36 -07:00
Nikolay Kim 5795850bbb decompress payload in cpu threadpool 2019-03-28 11:08:24 -07:00
Nikolay Kim e84c95968f reuse PayloadBuffer from actix-http 2019-03-28 05:34:33 -07:00
Nikolay Kim 4309d9b88c port multipart support 2019-03-28 05:04:39 -07:00
Nikolay Kim fb9c94c3e0 remove Backtrace from error 2019-03-27 09:31:07 -07:00
Nikolay Kim c7ad677804 Merge actix-http project 2019-03-26 11:54:35 -07:00