mirror of
https://github.com/actix/actix-web.git
synced 2025-02-01 03:42:21 +00: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:
parent
8a9fcddb3c
commit
8d61fe0925
2 changed files with 10 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue