File tree Expand file tree Collapse file tree 2 files changed +14
-12
lines changed Expand file tree Collapse file tree 2 files changed +14
-12
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ edition = "2018"
1515url = " 2.1.0"
1616httparse = " 1.3.3"
1717async-std = { version = " 1.5.0" , features = [" unstable" ] }
18- http-types = " 1.0 .0"
18+ http-types = " 1.2 .0"
1919pin-project-lite = " 0.1.1"
2020byte-pool = " 0.2.1"
2121lazy_static = " 1.4.0"
Original file line number Diff line number Diff line change @@ -56,18 +56,20 @@ impl Encoder {
5656 log:: trace!( "> {}" , & val) ;
5757 buf. write_all ( val. as_bytes ( ) ) . await ?;
5858
59- // Insert Host header
60- // Insert host
61- let host = req. url ( ) . host_str ( ) ;
62- let host = host. ok_or_else ( || format_err ! ( "Missing hostname" ) ) ?;
63- let val = if let Some ( port) = req. url ( ) . port ( ) {
64- format ! ( "host: {}:{}\r \n " , host, port)
65- } else {
66- format ! ( "host: {}\r \n " , host)
67- } ;
59+ if req. header ( & http_types:: headers:: HOST ) . is_none ( ) {
60+ // Insert Host header
61+ // Insert host
62+ let host = req. url ( ) . host_str ( ) ;
63+ let host = host. ok_or_else ( || format_err ! ( "Missing hostname" ) ) ?;
64+ let val = if let Some ( port) = req. url ( ) . port ( ) {
65+ format ! ( "host: {}:{}\r \n " , host, port)
66+ } else {
67+ format ! ( "host: {}\r \n " , host)
68+ } ;
6869
69- log:: trace!( "> {}" , & val) ;
70- buf. write_all ( val. as_bytes ( ) ) . await ?;
70+ log:: trace!( "> {}" , & val) ;
71+ buf. write_all ( val. as_bytes ( ) ) . await ?;
72+ }
7173
7274 // Insert Proxy-Connection header when method is CONNECT
7375 if req. method ( ) == Method :: Connect {
You can’t perform that action at this time.
0 commit comments