File tree 2 files changed +14
-12
lines changed
2 files changed +14
-12
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ edition = "2018"
15
15
url = " 2.1.0"
16
16
httparse = " 1.3.3"
17
17
async-std = { version = " 1.5.0" , features = [" unstable" ] }
18
- http-types = " 1.0 .0"
18
+ http-types = " 1.2 .0"
19
19
pin-project-lite = " 0.1.1"
20
20
byte-pool = " 0.2.1"
21
21
lazy_static = " 1.4.0"
Original file line number Diff line number Diff line change @@ -56,18 +56,20 @@ impl Encoder {
56
56
log:: trace!( "> {}" , & val) ;
57
57
buf. write_all ( val. as_bytes ( ) ) . await ?;
58
58
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
+ } ;
68
69
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
+ }
71
73
72
74
// Insert Proxy-Connection header when method is CONNECT
73
75
if req. method ( ) == Method :: Connect {
You can’t perform that action at this time.
0 commit comments