1
0
mirror of https://github.com/fafhrd91/actix-web synced 2024-11-24 00:21:08 +01:00
Commit Graph

548 Commits

Author SHA1 Message Date
Rob Ede
996f1d7eae
bump msrv in ci and readme 2020-05-13 01:57:37 +01:00
Rob Ede
879cad9422
allow parent data containers to be accessed from child scopes 2020-05-09 00:31:26 +01:00
Yuki Okushi
b6b3481c6f
web: Bump up to 3.0.0-alpha.2 2020-05-08 06:46:13 +09:00
Rob Ede
45e2e40140
set data container on default service calls
closes #1450
2020-04-14 02:33:19 +01:00
Tore Pettersen
0ad02ee0e0
Add convenience functions for testing (#1401)
* Add convenience functions for testing

* Fix remarks from PR and add tests

* Add unpin to read_json_body

* Update changelog
2020-04-06 04:12:44 +09:00
Stephen Eckels
aaff68bf05
Change NormalizePath to append trailing slash (#1433)
* Change NormalizePath to append trailing slash

* add tests

* Update CHANGES.md

Co-authored-by: Yuki Okushi <huyuumi.dev@gmail.com>
2020-04-05 03:26:40 +09:00
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
0152cedc5d
Update changelog 2020-03-12 03:24:15 +09:00
Yuki Okushi
9d661dc4f3 Update changelog 2020-03-04 15:20:14 +09:00
Yuki Okushi
b213c07799
Merge branch 'master' into feat/helper-function-for-trace-method 2020-02-25 12:36:20 +09:00
Matt Gathu
d143c44130
Update the ChangeLog 2020-02-23 09:33:28 +01:00
Yuki Okushi
1b77963aac actix-web: update time to 0.2.7 2020-02-23 07:08:22 +09:00
kevinpoitra
e634e64847 Upgrade time to 0.2.5 (#1254)
* Use `OffsetDateTime` instead of `PrimitiveDateTime`

* Parse time strings with `PrimitiveDateTime::parse` instead of `OffsetDateTime::parse`

* Remove unused `time` dependency from actix-multipart

* Fix a few errors with time related tests from the `time` upgrade

* Implement logic to convert a RFC 850 two-digit year into a full length year, and organize time parsing related functions

* Upgrade `time` to 0.2.2

* Correctly parse C's asctime time format using time 0.2's new format patterns

* Update CHANGES.md

* Use `time` without any of its deprecated functions

* Enforce a UTC time offset when converting an `OffsetDateTime` into a Header value

* Use the more readable version of `Duration::seconds(0)`, `Duration::zero()`

* Remove unneeded conversion of time::Duration to std::time::Duration

* Use `OffsetDateTime::as_seconds_f64` instead of manually calculating the amount of seconds from nanoseconds

* Replace a few additional instances of `Duration::seconds(0)` with `Duration::zero()`

* Truncate any nanoseconds from a supplied `Duration` within `Cookie::set_max_age` to ensure two Cookies with the same amount whole seconds equate to one another

* Fix the actix-http:🍪:do_not_panic_on_large_max_ages test

* Convert `Cookie::max_age` and `Cookie::expires` examples to `time` 0.2

Mainly minor  changes. Type inference can be used alongside the new
`time::parse` method, such that the type doesn't need to be specified.
This will be useful if a refactoring takes place that changes the type.
There are also new macros, which are used where possible.

One change that is not immediately obvious, in `HttpDate`, there was an
unnecessary conditional. As the time crate allows for negative durations
(and can perform arithmetic with such), the if/else can be removed
entirely.

Time v0.2.3 also has some bug fixes, which is why I am not using a more
general v0.2 in Cargo.toml.

v0.2.3 has been yanked, as it was backwards imcompatible. This version
reverts the breaking change, while still supporting rustc back to
1.34.0.

* Add missing `time::offset` macro import

* Fix type confusion when using `time::parse` followed by `using_offset`

* Update `time` to 0.2.5

* Update CHANGES.md

Co-authored-by: Jacob Pratt <the.z.cuber@gmail.com>
2020-01-28 20:44:22 +09:00
Kai Ren
cdba30d45f Skip empty chucks for BodyStream and SizedStream (#1308)
* Skip empty chucks for BodyStream and SizedStream when streaming response (#1267)

* Fix tests to fail on previous implementation

Co-authored-by: Yuki Okushi <huyuumi.dev@gmail.com>
2020-01-28 18:28:09 +09:00
linkmauve
abb462ef85 Replace sha1 dependency with sha-1 (#1258)
* Replace sha1 dependency with sha-1

This other crate is being maintained, and it offers better performances
when using the `asm` feature (especially [on
AArch64](https://github.com/RustCrypto/hashes/pull/97)).

* Update CHANGES.md with the sha-1 migration

* Add a test for hash_key()
2020-01-11 02:34:31 +09:00
Nikolay Kim
642ae161c0 prep actix-web release 2019-12-25 20:21:00 +04:00
Nikolay Kim
f86ce0390e allow to specify multi pattern for resources 2019-12-25 20:14:44 +04:00
Nikolay Kim
7882f545e5 Allow to gracefully stop test server via TestServer::stop() 2019-12-25 12:10:48 +04:00
Nikolay Kim
6a0cd2dced Rename HttpServer::start() to HttpServer::run() 2019-12-22 17:12:22 +04:00
Nikolay Kim
e5a50f423d Make web::Data deref to Arc<T> #1214 2019-12-20 17:45:35 +06:00
Nikolay Kim
8b8a9a995d bump ver 2019-12-20 17:36:48 +06:00
Nikolay Kim
c877840c07 rename App::register_data to App::app_data and HttpRequest::app_data returns Option<&T> instead of Option<&Data<T>> 2019-12-20 17:13:09 +06:00
Nikolay Kim
20248daeda Allow to set peer_addr for TestRequest #1074 2019-12-20 16:11:51 +06:00
Nikolay Kim
a08d8dab70 AppConfig::secure() is always false. #1202 2019-12-20 16:04:51 +06:00
Nikolay Kim
01613f334b Move BodyEncoding to dev module #1220 2019-12-16 17:22:26 +06:00
Nikolay Kim
b0aa9395da prep actix-web alpha.6 release 2019-12-15 22:51:14 +06:00
Nikolay Kim
8881c13e60 update changes 2019-12-13 12:16:43 +06:00
Nikolay Kim
42258ee289 deps 2019-12-08 20:22:39 +06:00
Nikolay Kim
8df33f7a81 remove HttpServer::run() as it is not useful with async/await 2019-12-08 00:06:04 +06:00
Nikolay Kim
6c226e47bd prepare actix-web-actors release 2019-12-07 20:10:36 +06:00
Vlad Frolov
8c3f58db9d Allow comma-separated websocket subprotocols without spaces (#1172)
* Allow comma-separated websocket subprotocols without spaces

* [CHANGES] Added an entry to CHANGES.md
2019-12-07 20:08:06 +06:00
Nikolay Kim
1729a52f8b prepare alpha.3 release 2019-12-07 13:00:03 +06:00
Nikolay Kim
205a964d8f upgrade to tokio 0.2 2019-12-05 23:35:43 +06:00
Nikolay Kim
c1c44a7dd6 upgrade derive_more 2019-11-25 17:59:14 +06:00
Jim Blandy
c5907747ad Remove implementation of Responder for (). Fixes #1108.
Rationale:

- In Rust, one can omit a semicolon after a function's final expression to make
  its value the function's return value. It's common for people to include a
  semicolon after the last expression by mistake - common enough that the Rust
  compiler suggests removing the semicolon when there's a type mismatch between
  the function's signature and body. By implementing Responder for (), Actix makes
  this common mistake a silent error in handler functions.

- Functions returning an empty body should return HTTP status 204 ("No Content"),
  so the current Responder impl for (), which returns status 200 ("OK"), is not
  really what one wants anyway.

- It's not much of a burden to ask handlers to explicitly return
  `HttpResponse::Ok()` if that is what they want; all the examples in the
  documentation do this already.
2019-11-23 21:10:02 +06:00
Nikolay Kim
0212c618c6 prepare actix-web release 2019-11-14 08:55:37 +06:00
Nikolay Kim
885ff7396e prepare actox-http release 2019-11-06 10:35:13 -08:00
Hung-I Wang
edcde67076 Fix escaping/encoding problems in Content-Disposition header (#1151)
* Fix filename encoding in Content-Disposition of acitx_files::NamedFile

* Add more comments on how to use Content-Disposition header properly & Fix some trivial problems

* Improve Content-Disposition filename(*) parameters of actix_files::NamedFile

* Tweak Content-Disposition parse to accept empty param value in quoted-string

* Fix typos in comments in .../content_disposition.rs (pointed out by @JohnTitor)

* Update CHANGES.md

* Update CHANGES.md again
2019-11-06 06:08:37 -08:00
Anton Lazarev
ace98e3a1e support Host guards when Host header is unset (#1129) 2019-10-15 05:05:54 +06:00
Igor Aleksanov
f81ae37677 Add From<Payload> for crate::dev::Payload (#1110)
* Add From<Payload> for crate::dev::Payload

* Make dev::Payload field of Payload public and add into_inner method

* Add changelog entry
2019-10-01 14:05:38 +06:00
Nikolay Kim
4f3e97fff8 prepare actix-web release 2019-09-25 15:39:09 +06:00
karlri
c659c33919 Feature uds: Add listen_uds to ServerBuilder (#1085)
Allows using an existing Unix Listener instead of binding to a path.
Useful for when running as a daemon under systemd.

Change-Id: I54a0e78c321d8b7a9ded381083217af590e9a7fa
2019-09-25 15:16:51 +06:00
Nikolay Kim
d9af8f66ba Use actix-testing for testing utils 2019-09-25 10:28:41 +06:00
Jim Blandy
58c7065f08 Implement register_data method on Resource and Scope. (#1094)
* Implement `register_data` method on `Resource` and `Scope`.

* Split Scope::register_data tests out from Scope::data tests.

* CHANGES.md: Mention {Scope,Resource}::register_data.
2019-09-18 06:36:39 +06:00
Jos van den Oever
32a1c36597 Make UrlencodedError::Overflow more informative (#1089) 2019-09-17 06:58:04 +06:00
Nikolay Kim
a32573bb58 Allow to re-construct ServiceRequest from HttpRequest and Payload #1088 2019-09-13 11:56:24 +06:00
Ronald Chan
5e8f1c338c fix h2 not using error response (#1080)
* fix h2 not using error response

* add fix change log

* fix h2 service error tests
2019-09-09 16:24:57 +06:00
κeen
8a9fcddb3c Condition middleware (#1075)
* add condition middleware

* write tests

* update changes

* Update src/middleware/condition.rs

Co-Authored-By: Yuki Okushi <huyuumi.dev@gmail.com>

* Update src/middleware/condition.rs

Co-Authored-By: Yuki Okushi <huyuumi.dev@gmail.com>

* Update src/middleware/condition.rs

Co-Authored-By: Yuki Okushi <huyuumi.dev@gmail.com>

* Update src/middleware/condition.rs

Co-Authored-By: Yuki Okushi <huyuumi.dev@gmail.com>
2019-09-09 12:26:38 +06:00
Nikolay Kim
bae29897d6 prep actix-web release 2019-08-29 09:36:16 +06:00
Nikolay Kim
98bf8ab098 enable rust-tls feature for actix_web::client #1045 2019-08-28 21:40:24 +06:00
Leland Jansen
c193137905 actix_web::test::TestRequest::set_form (#1058) 2019-08-28 21:32:17 +06:00
Erlend Langseth
a07cdd6533 Data::into_inner 2019-08-27 17:25:25 +01:00
Nikolay Kim
b1cb72d088 update url crate 2019-08-13 11:03:24 -07:00
Nikolay Kim
55179d6ab2 update dependencies 2019-08-13 10:48:11 -07:00
jesskfulwood
b0b462581b update CHANGES.md for Form impl Responder 2019-07-20 14:46:46 +01:00
jesskfullwood
c808364c07 make Query payload public (#991) 2019-07-19 15:47:44 +06:00
Nikolay Kim
cccd829656 update changes 2019-07-19 11:07:52 +06:00
Nikolay Kim
6b7df6b242 prep actix-web release 2019-07-18 17:51:51 +06:00
Nikolay Kim
fbdda8acb1 Unix domain sockets (HttpServer::bind_uds) #92 2019-07-18 17:24:12 +06:00
Rotem Yaari
d03296237e Log error results in Logger middleware (closes #938) (#984)
* Log error results in Logger middleware (closes #938)

* Log internal server errors with an ERROR log level

* Logger middleware: don't log 500 internal server errors, as Actix now logs them always

* Changelog
2019-07-18 14:31:18 +06:00
Nikolay Kim
c01611d8b5 prepare actix-web release 2019-07-17 12:07:12 +06:00
Nikolay Kim
c65dbaf88e expose app's ResourceMap via resource_map method 2019-07-17 11:33:05 +06:00
Nikolay Kim
c45728ac01 prep test server release 2019-07-16 10:21:52 +06:00
Andrea Corradi
6f71409355 Add DELETE, PATCH, OPTIONS methods to TestServerRunner (#973) 2019-07-16 10:19:28 +06:00
messense
b1143168e5 Impl Responder for (T, StatusCode) where T: Responder (#954) 2019-07-11 14:42:58 +06:00
messense
dbab55dd6b Bump rand crate version to 0.7 (#951) 2019-07-01 09:37:03 +06:00
Nikolay Kim
b77ed193f7 prepare actix-web release 2019-06-28 14:41:56 +06:00
Nikolay Kim
af9fb5d190 Support asynchronous data factories #850 2019-06-28 10:43:52 +06:00
messense
313ac48765 Use encoding_rs crate instead of unmaintained encoding crate (#922)
* Use encoding_rs crate instead of unmaintained encoding crate

* Update changelog
2019-06-18 12:43:25 +06:00
Nikolay Kim
546a8a58db remove cors and identity middlewares 2019-06-17 12:33:00 +06:00
Nikolay Kim
acda1c075a prepare actix-web release 2019-06-17 12:23:30 +06:00
Nikolay Kim
d293ae2a69 fix nested resource map registration #915 2019-06-15 22:12:20 +06:00
Nikolay Kim
cd323f2ff1 Move cors middleware to actix-cors crate 2019-06-15 09:34:16 +06:00
Nikolay Kim
e7ba67e1a8 rename PathPayloadError and test for path config 2019-06-12 17:02:45 +06:00
Nikolay Kim
7450ae37a7 Re-apply patch from #637 #894 2019-06-12 16:45:05 +06:00
Nikolay Kim
2ffda29f9b Allow to test an app that uses async actors #897 2019-06-12 16:15:06 +06:00
Nikolay Kim
ff724e239d move identity service separate crate 2019-06-12 15:52:48 +06:00
Bob
ee769832cf get_identity from HttpMessage (#908)
* get_identity from HttpMessage

* more doc for RequestIdentity
2019-06-12 09:26:46 +06:00
Nikolay Kim
ae64475d98 test-server release 2019-06-05 08:27:25 +06:00
Nikolay Kim
a771540b16 prepare actix-web-codegen release 2019-06-04 22:33:43 +06:00
Glade Miller
cf217d35a8 Added HEAD, CONNECT, OPTIONS and TRACE to the codegen (#886)
* Added HEAD, CONNECT, OPTIONS and TRACE to the codegen

* Add new macros to use statement

* Add patch to supported codegen http methods

* Update CHANGES.md

Added head, options, trace, connect and patch codegen changes to CHANGES.md
2019-06-04 22:30:43 +06:00
Nikolay Kim
0e138e111f add external resource support on scope level 2019-06-03 23:41:32 +06:00
Mohab Usama
f1764bba43 Fix Logger time format (use rfc3339) (#867)
* Fix Logger time format (use rfc3339)

* Update change log
2019-05-31 12:09:21 +04:00
Vlad Frolov
801cc2ed5d Cleaned unnecessary Option<_> around ServerBuilder in server.rs/HttpServer (#863) 2019-05-23 05:21:02 -07:00
Nikolay Kim
ded1e86e7e Add ServiceRequest::set_payload() method 2019-05-22 21:25:51 -07:00
Nikolay Kim
12842871fe Clear http requests pool on app service drop #860 2019-05-22 11:18:33 -07:00
Harry Stern
5826f39dbe Add set_json method to TestRequest (#851)
- Takes a type which implements serde::Serialize, serializes it to JSON,
and sets it as the payload. The content-type is also set to JSON.
2019-05-18 19:36:28 -07:00
Nikolay Kim
0dda4b06ea prepare release 2019-05-18 10:49:59 -07:00
Nikolay Kim
e8c8626878 update deps 2019-05-18 09:54:23 -07:00
Miles Granger
4b215e0839 Support Query<T>::from_query() (#846) 2019-05-17 13:10:46 -07:00
Nikolay Kim
e1ff3bf8fa fix resource match with params #841 2019-05-15 10:31:40 -07:00
Davide Di Carlo
bba90d7f22 Query config (#839)
* add QueryConfig

* expose QueryConfig in web module

* fmt

* use associated type for QueryConfig

* update CHANGES.md
2019-05-14 13:54:30 -07:00
Davide Di Carlo
6c3d8b8738 Make JsonConfig send (#830)
* replace Rc with Arc

* add Send trait requirement for Fn in JsonConfig error handler

* add Sync trait requirement for Fn in JsonConfig error handler

* use associated type inside JsonConfig

* fix lint: members in the impl has the same order in the trait

* Update CHANGES.md
2019-05-12 20:04:08 -07:00
Nikolay Kim
1ca58e876b prepare beta4 release 2019-05-12 10:49:21 -07:00
Nikolay Kim
45c05978b0 Allow to set/override app data on scope level 2019-05-12 09:42:05 -07:00
Nikolay Kim
4066375737
Update CHANGES.md 2019-05-10 14:45:30 -07:00
Nikolay Kim
fa78da8156 unify route and app data, it allows to provide global extractor config #775 2019-05-04 19:43:49 -07:00
Nikolay Kim
01cfcf3b75 update changes 2019-05-04 08:42:27 -07:00
Nikolay Kim
6b34909537 Fix NormalizePath middleware impl #806 2019-05-01 12:40:56 -07:00
Nikolay Kim
d2c1791067 add async handler test with blocking call 2019-04-29 09:45:37 -07:00
Nikolay Kim
f4b4875cb1 Add helper function for executing futures test::block_fn() 2019-04-29 09:34:14 -07:00
Nikolay Kim
29a841529f Allow to construct Data instances to avoid double Arc for Send + Sync types. 2019-04-29 09:26:12 -07:00
Nikolay Kim
cba78e06ae update changes 2019-04-24 15:42:34 -07:00
Nikolay Kim
3b3dbb4f40 add raw services support 2019-04-24 15:29:15 -07:00
Nikolay Kim
5426413cb6 update dependencies 2019-04-24 13:00:30 -07:00
Nikolay Kim
679d1cd513 allow to override responder's status code and headers 2019-04-24 10:25:46 -07:00
Nikolay Kim
898ef57080 Fix async web::Data factory handling 2019-04-23 21:21:49 -07:00
Nikolay Kim
3532602299 Added support for remainder match (i.e /path/{tail}*) 2019-04-22 21:22:17 -07:00
Nikolay Kim
48bee55087 .to_async() handler can return Responder type #792 2019-04-22 14:22:08 -07:00
Nikolay Kim
7e480ab2f7 beta.1 release 2019-04-20 21:16:51 -07:00
Nikolay Kim
891f857547 update changes 2019-04-20 11:18:04 -07:00
Nikolay Kim
7292d0b696 drop chrono and use i64 for max age 2019-04-19 17:23:17 -07:00
Nikolay Kim
aa255298ef make ServiceRequest::from_parts private, as it is not safe to create from parts 2019-04-18 16:03:13 -07:00
Nikolay Kim
420d3064c5 Add .peer_addr() #744 2019-04-16 10:11:38 -07:00
Nikolay Kim
7a28b32f6d Rename test::call_success to test::call_service 2019-04-15 07:44:07 -07:00
Nikolay Kim
09cdf1e302 Rename RouterConfig to ServiceConfig 2019-04-15 07:32:49 -07:00
Nikolay Kim
f9078d41cd add test::read_response; fix TestRequest::app_data() 2019-04-14 19:52:12 -07:00
Nikolay Kim
d7040dc303 alpha.6 release 2019-04-14 08:09:32 -07:00
Nikolay Kim
5bd5651faa Allow to use any service as default service 2019-04-13 22:25:00 -07:00
Nikolay Kim
ee33f52736 make extractor config type explicit 2019-04-13 16:35:25 -07:00
Nikolay Kim
4f30fa9d46 Remove generic type for request payload, always use default 2019-04-13 14:50:54 -07:00
Nikolay Kim
1f2b15397d prepare alpha5 release 2019-04-12 14:00:45 -07:00
Nikolay Kim
7801fcb993 update migration 2019-04-10 20:47:28 -07:00
Nikolay Kim
9d82d4dfb9 Fix body propagation in Response::from_error. #760 2019-04-10 12:43:31 -07:00
Nikolay Kim
53da55aa3c alpha4 release 2019-04-07 23:42:05 -07:00
Nikolay Kim
75b213a6f0 refactor FromRequest trait 2019-04-07 14:43:07 -07:00
Haze
7d6085ddbd Add %U (URLPath) for logger (#752)
* Add %R (Route) for logger

* Requested Updates (Route => URLPath, %R => %U)
2019-04-03 17:41:42 -07:00
Nikolay Kim
cef3dc3586 added app_data() method 2019-04-03 15:25:52 -07:00
Nikolay Kim
237bfba1ed add App::configure() - allow to offload app configuration to different methods 2019-04-03 15:09:31 -07:00
Nikolay Kim
e738361e09 move multipart support to separate crate 2019-04-03 12:28:58 -07:00
Nikolay Kim
442f5057dd alpha.3 release 2019-04-02 21:49:31 -07:00
Nikolay Kim
bca31eb7ad remove Deref 2019-04-02 13:35:01 -07:00
Nikolay Kim
34695f4bce rename test methods; update tests 2019-03-31 20:43:00 -07:00
Nikolay Kim
457b75c995 update api docs; move web to submodule 2019-03-30 10:04:38 -07:00
Nikolay Kim
a20b9fd354 prepare aplha2 release 2019-03-29 22:06:14 -07:00
Nikolay Kim
709475b2bb multipart::Field renamed to MultipartField 2019-03-29 11:59:38 -07:00
Nikolay Kim
9c198a0d29 alpha.1 release 2019-03-28 13:46:26 -07:00
Nikolay Kim
b95e99a09e update changes 2019-03-24 16:17:59 -07:00
Nikolay Kim
1e069bb843 Merge branch '1.0' 2019-03-23 10:16:32 -07:00
Jannik Keye
bf8262196f feat: enable use of patch as request method (#718) 2019-03-14 11:36:10 +03:00
David McGuire
cc7f6b5eef Fix preflight CORS header compliance; refactor previous patch. (#717) 2019-03-11 07:26:54 +03:00
Stephen Ellis
ceca96da28 Added HTTP Authentication for Client (#540) 2019-03-06 12:56:12 +03:00
Douman
42f030d3f4 Ensure that Content-Length zero is specified in empty request 2019-03-05 08:37:15 +03:00
Nikolay Kim
2d7293aaf8 copy actix-web2 2019-03-01 22:51:32 -08:00
Douman
80d4cbe301 Add change notes for new HttpResponseBuilder 2019-02-27 21:37:20 +03:00
cuebyte
c695358bcb Ignored the If-Modified-Since if If-None-Match is specified (#680) (#692) 2019-02-09 00:33:00 +03:00
wildarch
9968afe4a6 Use NamedFile with an existing File (#670) 2019-01-28 08:07:28 +03:00
Douman
1fbb52ad3b 0.7.18 Bump 2019-01-10 17:05:18 +03:00
Julian Tescher
e5cdd22720 Fix test server listener thread leak (#655) 2019-01-08 10:42:22 -08:00
Douman
4f2e970732 Tidy up CHANGES.md 2019-01-08 10:49:03 +03:00