@@ -21,12 +21,9 @@ static FORWARD_REQUEST_HEADERS_TO_REMOVE: [header::HeaderName; 3] = [
21
21
header:: EXPECT ,
22
22
] ;
23
23
24
- static FORWARD_RESPONSE_HEADERS_TO_REMOVE : [ header:: HeaderName ; 2 ] = [
24
+ static FORWARD_RESPONSE_HEADERS_TO_REMOVE : [ header:: HeaderName ; 1 ] = [
25
25
// Connection settings (keepalived) must not be resend
26
26
header:: CONNECTION ,
27
- // Encryption changes the length of the content
28
- // and we use chunk transfert-encoding
29
- header:: CONTENT_LENGTH ,
30
27
] ;
31
28
32
29
static FETCH_REQUEST_HEADERS_TO_REMOVE : [ header:: HeaderName ; 1 ] = [
@@ -91,27 +88,26 @@ async fn forward(
91
88
) )
92
89
} ;
93
90
94
- forwarded_req
91
+ let mut res = forwarded_req
95
92
. send_stream ( stream_to_send)
96
93
. await
97
- . map_err ( Error :: from)
98
- . map ( |res| {
99
- if res. status ( ) . is_client_error ( ) || res. status ( ) . is_server_error ( ) {
100
- error ! ( "forward error {:?} {:?}" , req, res) ;
101
- }
94
+ . map_err ( Error :: from) ?;
102
95
103
- let mut client_resp = HttpResponse :: build ( res. status ( ) ) ;
96
+ if res. status ( ) . is_client_error ( ) || res. status ( ) . is_server_error ( ) {
97
+ error ! ( "forward error {:?} {:?}" , req, res) ;
98
+ }
104
99
105
- for ( header_name, header_value) in res
106
- . headers ( )
107
- . iter ( )
108
- . filter ( |( h, _) | !FORWARD_RESPONSE_HEADERS_TO_REMOVE . contains ( & h) )
109
- {
110
- client_resp. header ( header_name. clone ( ) , header_value. clone ( ) ) ;
111
- }
100
+ let mut client_resp = HttpResponse :: build ( res. status ( ) ) ;
112
101
113
- client_resp. streaming ( res)
114
- } )
102
+ for ( header_name, header_value) in res
103
+ . headers ( )
104
+ . iter ( )
105
+ . filter ( |( h, _) | !FORWARD_RESPONSE_HEADERS_TO_REMOVE . contains ( & h) )
106
+ {
107
+ client_resp. header ( header_name. clone ( ) , header_value. clone ( ) ) ;
108
+ }
109
+
110
+ Ok ( client_resp. body ( res. body ( ) . await ?) )
115
111
}
116
112
117
113
async fn fetch (
0 commit comments