Commit Graph

95 Commits

Author SHA1 Message Date
Alexey Galakhov 564f10a20a
Merge pull request #363 from shotover/master
Subprotocol header
2024-05-10 14:14:32 +02:00
Bartel Sielski 60c50cdea2
handshake(server): Make 'create_response_with_body' function more generic
This makes using it possible when the request and response body types differ.

Signed-off-by: bartel <bartel.sielski@gmail.com>
2024-04-23 16:45:36 +02:00
n4n5 b44721662d
Merge remote-tracking branch 'newone/master' 2024-03-08 15:35:34 +01:00
Alex Butler 0f6e6517e6 Fix FrameHeader::format write & other lints 2023-12-02 00:01:17 +01:00
Alexey Galakhov 2e5029284b Add checking for header sanity
Co-authored-by: Daniel Abramov <inetcrack2@gmail.com>
2023-09-23 02:16:09 +02:00
conorbros a2ec84b822 subprotocol 2023-06-27 16:40:52 +10:00
Mark Doyle 9533c02280 return correct protocol error when missing http version 2023-06-12 13:19:13 +01:00
Daniel Abramov 87e9f576af Make `cargo fmt` happy 2023-04-12 16:09:09 +02:00
Daniel Abramov 42b8797e8b Revert "Add `permessage-deflate` support"
This reverts commit edb2377540.

See https://github.com/snapview/tungstenite-rs/pull/328#issuecomment-1480349206
2023-03-23 00:15:53 +01:00
kazk edb2377540 Add `permessage-deflate` support 2023-03-18 12:36:01 +01:00
Sebastian Dröge c6769e3dae Switch from base64 0.20 to data-encoding 2
base64 0.21 deprecated the simple API and requires quite a bit more code
for the simple usage here, while data-encoding provides exactly the API
needed and is also actively maintained.
2023-01-15 17:08:18 +01:00
ssrlive 3fc7fb412c
Mark some functions as public (#315)
Fixes #315.

Co-authored-by: Daniel Abramov <inetcrack2@gmail.com>
2022-12-02 15:35:22 +01:00
Yang Hau 984ad9d6c7 fix typos 2022-11-22 20:23:59 +08:00
Josiah Bull 1c657d4c6a
feat: switched response type from Vec<u8> to Option<Vec<u8>> to allow returning of differentiation of no body from empty body. 2022-10-19 12:30:46 +13:00
Josiah Bull 36ab770059
feat: error type returns `Vec<u8>` instead of `Option<String>` 2022-10-19 12:30:29 +13:00
Josiah Bull 4a7beaa897
feat: error responses return body upon non 101 status code
modified `client::Response` type to contain `String` instead of `()` to achieve this.
2022-10-19 12:29:45 +13:00
n3oney 80d0547fab
fix: uppercase origin header 2022-06-18 23:31:42 +02:00
kangalioo fa70a370c8 Downgrade MSRV to 1.51 2022-03-19 23:46:51 +01:00
Daniel Abramov d9a1ab2cb2
Merge pull request #266 from teozkr/chore/rust-1.56
Downgrade MSRV to 1.56
2022-02-21 15:38:44 +01:00
Daniel Abramov 2171c997f5 test: add a unit test for invalid `http::Request`
This is to make sure that we don't panic anymore in such cases:
https://github.com/snapview/tungstenite-rs/pull/267
2022-02-21 15:37:13 +01:00
Sebastian Dröge 1a48959adc `HeaderName::from_static` requires all-lowercase HTTP2 compatible header names
and was passed header names with uppercase characters instead, which
made it panic.
2022-02-21 16:21:52 +02:00
Teo Klestrup Röijezon d21c7b53ca Downgrade MSRV to 1.56 2022-02-21 13:04:36 +01:00
Daniel Abramov d661f57224 client: overhaul of the request generation 2022-02-04 13:42:55 +01:00
Daniel Abramov 68541e4095
Merge pull request #227 from LYF1999/master
fix: write some header twice
2021-11-03 19:00:29 +01:00
Florian Uekermann 3e45100f5d
replace unwrap with ? 2021-10-23 00:03:09 +02:00
Daniel Abramov 6c4d2bab04 Fix newly introduced clippy warnings 2021-10-19 22:43:30 +02:00
yifei 9f563561a4 fix: return err if try to overwrite standard hedaer 2021-08-20 00:35:42 +08:00
Daniel Abramov 2787031c2f Replace `InputBuffer` with a faster alternative
We're also deprecating the usage of `input_buffer` crate, see:
https://github.com/snapview/input_buffer/issues/6#issuecomment-870548303
2021-07-05 18:38:06 +02:00
Maarten de Vries 96612748d1 Expose `handshake::derive_accept_key` as public API. 2021-02-06 18:41:58 +01:00
WiredSound 3e485ddb96 Rename UrlErrorType to just UrlError, implement using thiserror 2021-01-09 21:31:03 +00:00
WiredSound 98377cf3dd Rename ProtocolErrorType to just ProtocolError, implement using thiserror 2021-01-09 21:23:03 +00:00
WiredSound 652a6b776e Rename CapacityErrorType to just CapacityError, implement using thiserror 2021-01-09 21:12:33 +00:00
WiredSound 0b34bee94f Add capacity error types 2021-01-09 20:38:34 +00:00
WiredSound aaebb432f0 Fix clippy warnings 2021-01-09 20:38:34 +00:00
WiredSound 6f846da0e3 Add protocol error types 2021-01-09 20:38:30 +00:00
WiredSound 34c6e63d87 Add specific URL error types 2021-01-09 20:30:54 +00:00
Dominik Nakamura 82e09ea025
Remove remaining dynamic dispatch usage 2021-01-02 16:45:50 +09:00
Austaras 4d70f63cbf
Add a custom response builder (#158)
* add custom reponse builder

* change names and shorten implemtation

* Re-format the code

Co-authored-by: Daniel Abramov <dabramov@snapview.de>
2020-12-30 17:35:10 +01:00
Constantin Nickel 8417078ef3 Update to bytes 1.0 2020-12-23 09:37:43 +01:00
Daniel Abramov 96d9eb75e5 chore: apply `fmt` to the whole project 2020-11-17 12:40:52 +01:00
Daniel Abramov a8e06d2b39 clean up http error handling 2020-11-16 19:49:17 +01:00
Redrield 60f7b0f024 Fix some code-review issues
* Replace Redirection error with a general Http error that owns the
response
* Make the default client connect function iterative instead of
recursive
* Add a limit to the amount of redirects a client will attempt to
perform
2020-11-16 18:13:39 +01:00
Redrield 6bce14fa26 Add facilities to allow clients to follow HTTP 3xx redirects
* The connect() function defined in this crate will automatically follow
redirecting responses.
* Adds Error::Redirection, which is a special case of Error::Http that
extracts the redirection target from the response headers, and stores it
in the error object. Client implementations that build upon tungstenite
can use this to implement redirecting.
* A catch-all solution for redirects is not possible due to the
abstraction transforming socket types to Read + Write, implementations
that use the client_* methods need to handle redirections themselves.
2020-11-16 18:13:39 +01:00
Horki 88ff5f371f matches!: use macros; remove unused imports 2020-10-23 00:51:48 +02:00
Redrield bcf2b22d9e
Deduplicate the reason line in HTTP responses
The impl of Display for StatusCode already includes the canonical reason
if it exists. The current implementation duplicates this (e.g. the
status line will read "101 Switching Protocols Switching Protocols", or
"400 Bad Request Bad Request".
2020-09-12 22:41:39 -04:00
Sebastian Dröge 849f248a94 Update to sha-1 0.9 2020-07-28 09:34:31 +03:00
kids300 fb83e8c791 rm to_string 2020-05-08 16:26:45 +08:00
Yan 16a33df195 fix ws subportocol lowercase header 2020-05-08 15:58:55 +08:00
Daniel Abramov 0c429cba94 chore: remove deprecated `description()`
Fixes #111
2020-03-28 20:04:08 +01:00
macpp 0bfc217cfc allow firefox to connect 2020-02-01 22:52:41 +01:00