Commit Graph

38 Commits

Author SHA1 Message Date
Huston Bokinsky 9d7b6f401d Hide continuation frames from application layer.
This commit asserts that continuation frames are an implementation
detail of the websocket layer, and should remain hidden from the
application layer.  That is:
  - a codec should write only frames to the wire, and read only frames from the wire
  - when sending messages, the websocket implementation should break large
    text and binary messages into continuation frames -- the application should
    not have to be aware of this.
  - when receiving messages, the websocket implementation should reconstitute
    continuation frames into their original messages -- the application should
    not have to handle this.
  - the application should only have to send and receive complete websocket messages

Here, the reconstitution of continuation frames into their original messages is
done by the Stream implementation of actix_web_actors::ws::WsStream, by adding
a continuation frame buffer and not issuing a Poll::Ready(Some(Ok)) result until
a complete message has been buffered.  A test in actix_web_actors::tests::test_ws.rs
checks this.

The breaking of large message payloads into sequential continuation frames is
done by the addition of an actix_http::ws::frame_iters module, which introduces
two structs ContinuationBins and ContinuationTexts.  These are iterators over
either single Frame::Binary or Frame::Text frames, if the payloads are small,
or over sequences of Frame::Continuation's with appropriate Items FirstBinary/FirstText,
Continue, and Last.  New tests in actix_http::ws::frame_iters verify this
functionality.
2020-04-19 22:32:28 -07:00
Yuki Okushi e718f65121
Update tests 2020-03-08 16:42:45 +09:00
Yuki Okushi 7ba14fd113 Run rustfmt 2020-02-27 11:10:55 +09:00
Rajasekharan Vengalil 3b860ebdc7 Fix poll_ready call for WebSockets upgrade (#1219)
* Fix poll_ready call for WebSockets upgrade

* Poll upgrade service from H1ServiceHandler too
2019-12-17 13:34:25 +06:00
Nikolay Kim 4937c9f9c2 refactor http-test server 2019-12-12 23:08:38 +06:00
Nikolay Kim b4b3350b3e Add websockets continuation frame support 2019-12-12 14:06:54 +06:00
Nikolay Kim 131c897099 upgrade to actix-net release 2019-12-11 19:20:20 +06:00
Nikolay Kim 1f3ffe38e8 update actix-service dep 2019-12-08 19:25:24 +06:00
Nikolay Kim 205a964d8f upgrade to tokio 0.2 2019-12-05 23:35:43 +06:00
Nikolay Kim f4c01384ec update to latest actix-net 2019-12-02 17:33:11 +06:00
Nikolay Kim 4dc31aac93 use actix_rt::test for test setup 2019-11-26 11:25:50 +06:00
Nikolay Kim 1ffa7d18d3 drop unpin constraint 2019-11-21 16:02:17 +06:00
Nikolay Kim 687884fb94 update test-server tests 2019-11-21 16:02:17 +06:00
Nikolay Kim a6a2d2f444 update ssl impls 2019-11-21 16:02:17 +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
Nikolay Kim 63ddd30ee4 on_connect result isnt added to request extensions for http2 requests #1009 2019-09-01 13:15:02 +06:00
Marat Safin cb19ebfe0c add rustls support for actix-http and awc (#998)
* add rustls support for actix-http and awc

* fix features conflict

* remove unnecessary duplication

* test server with rust-tls

* fix

* test rustls

* awc rustls test

* format

* tests

* fix dependencies

* fixes and add changes

* remove test-server and Cargo.toml dev-dependencies changes

* cargo fmt
2019-07-31 13:02:56 -07:00
Nikolay Kim 666756bfbe body helpers 2019-06-01 17:57:25 +06:00
Nicolas Gotchac a614be7cb5 Don't DISCONNECT from stream when reader is empty (#870)
* Don't DISCONNECT from stream when reader is empty

* Fix chunked transfer: poll_request before closing stream + Test
2019-05-29 20:37:42 +04:00
Nikolay Kim df08baf67f update actix-net dependencies 2019-05-12 08:34:51 -07:00
Nikolay Kim 2e19f572ee add tests for camel case headers rendering 2019-04-24 11:27:57 -07:00
Nikolay Kim a116c4c2c7 Expose peer addr via Request::peer_addr() and RequestHead::peer_addr 2019-04-16 09:54:02 -07:00
Nikolay Kim d115b3b3ed ws verifyciation takes RequestHead; add SendError utility service 2019-04-11 14:00:32 -07:00
Nikolay Kim 561f83d044 add upgrade service support to h1 dispatcher 2019-04-08 17:51:14 -07:00
Nikolay Kim bc58dbb2f5 add async expect service test 2019-04-08 11:19:56 -07:00
Nikolay Kim a7fdac1043 fix expect service registration and tests 2019-04-08 10:31:29 -07:00
Nikolay Kim 3872d3ba5a refactor h1 dispatcher 2019-04-06 08:12:58 -07:00
Nikolay Kim fbedaec661 add expect: 100-continue support #141 2019-04-05 16:46:44 -07:00
Nikolay Kim 1e2bd68e83 Render error and return as response body 2019-04-03 19:55:19 -07:00
Nikolay Kim db1f7651a3 more patch cratesio 2019-04-02 14:47:59 -07:00
Nikolay Kim bca31eb7ad remove Deref 2019-04-02 13:35:01 -07:00
Nikolay Kim ce8294740e fix tests with disabled features 2019-03-31 17:04:34 -07:00
Nikolay Kim d846328f36 fork cookie crate 2019-03-29 21:13:39 -07:00
Nikolay Kim 193f8fb2d9 update tests 2019-03-29 18:51:07 -07:00
Nikolay Kim c126713f40 add rustls support to HttpServer 2019-03-29 16:28:32 -07:00
Nikolay Kim a2c9ff3a33 back to development 2019-03-28 14:10:03 -07:00
Nikolay Kim c59937784e add client websockets support 2019-03-27 18:53:19 -07:00
Nikolay Kim c7ad677804 Merge actix-http project 2019-03-26 11:54:35 -07:00