mirror of
https://github.com/actix/actix-web.git
synced 2024-12-23 00:26:34 +00:00
Write non-80 port in HOST of client's request (#451)
This commit is contained in:
parent
954f1a0b0f
commit
9c80d3aa77
2 changed files with 10 additions and 2 deletions
|
@ -7,7 +7,7 @@
|
|||
* Added `HttpServer::maxconn()` and `HttpServer::maxconnrate()`,
|
||||
accept backpressure #250
|
||||
|
||||
* Allow to customize connection handshake process via `HttpServer::listen_with()`
|
||||
* Allow to customize connection handshake process via `HttpServer::listen_with()`
|
||||
and `HttpServer::bind_with()` methods
|
||||
|
||||
### Fixed
|
||||
|
@ -19,6 +19,7 @@
|
|||
|
||||
* Fix adding multiple response headers #446
|
||||
|
||||
* Client includes port in HOST header when it is not default(e.g. not 80 and 443). #448
|
||||
|
||||
## [0.7.3] - 2018-08-01
|
||||
|
||||
|
|
|
@ -629,7 +629,14 @@ impl ClientRequestBuilder {
|
|||
if let Some(parts) = parts(&mut self.request, &self.err) {
|
||||
if let Some(host) = parts.uri.host() {
|
||||
if !parts.headers.contains_key(header::HOST) {
|
||||
match host.try_into() {
|
||||
let mut wrt = BytesMut::with_capacity(host.len() + 5).writer();
|
||||
|
||||
let _ = match parts.uri.port() {
|
||||
None | Some(80) | Some(443) => write!(wrt, "{}", host),
|
||||
Some(port) => write!(wrt, "{}:{}", host, port),
|
||||
};
|
||||
|
||||
match wrt.get_mut().take().freeze().try_into() {
|
||||
Ok(value) => {
|
||||
parts.headers.insert(header::HOST, value);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue