1
0
mirror of https://github.com/fafhrd91/actix-web synced 2024-11-27 17:52:56 +01:00

Ensure that awc::ws::WebsocketsRequest sets the Host header (#1070)

* Ensure that awc::ws::WebsocketsRequest sets the Host header before connecting.

* Make sure to check if headers already have a HOST value before setting

* Update CHANGES.md to reflect WebSocket client update.
This commit is contained in:
Eugene Bulkin 2019-09-09 01:27:13 -05:00 committed by Nikolay Kim
parent 8a9fcddb3c
commit 8d61fe0925
2 changed files with 10 additions and 0 deletions

View File

@ -1,5 +1,11 @@
# Changes
## [0.2.5] - 2019-09-06
### Changed
* Ensure that the `Host` header is set when initiating a WebSocket client connection.
## [0.2.4] - 2019-08-13
### Changed

View File

@ -233,6 +233,10 @@ impl WebsocketsRequest {
return Either::A(err(InvalidUrl::UnknownScheme.into()));
}
if !self.head.headers.contains_key(header::HOST) {
self.head.headers.insert(header::HOST, HeaderValue::from_str(uri.host().unwrap()).unwrap());
}
// set cookies
if let Some(ref mut jar) = self.cookies {
let mut cookie = String::new();