@@ -18,7 +18,7 @@ use bytes::Bytes;
18
18
use bytes:: { BufMut , BytesMut } ;
19
19
use http:: HeaderValue ;
20
20
use http:: { header, header:: AsHeaderName , Method , Version } ;
21
- use log:: { debug, error , warn} ;
21
+ use log:: { debug, warn} ;
22
22
use once_cell:: sync:: Lazy ;
23
23
use percent_encoding:: { percent_encode, AsciiSet , CONTROLS } ;
24
24
use pingora_error:: { Error , ErrorType :: * , OrErr , Result } ;
@@ -30,7 +30,7 @@ use tokio::io::{AsyncReadExt, AsyncWriteExt};
30
30
31
31
use super :: body:: { BodyReader , BodyWriter } ;
32
32
use super :: common:: * ;
33
- use crate :: protocols:: http:: { body_buffer:: FixedBuffer , date, error_resp , HttpTask } ;
33
+ use crate :: protocols:: http:: { body_buffer:: FixedBuffer , date, HttpTask } ;
34
34
use crate :: protocols:: { Digest , SocketAddr , Stream } ;
35
35
use crate :: utils:: { BufRef , KVRef } ;
36
36
@@ -895,31 +895,6 @@ impl HttpSession {
895
895
}
896
896
}
897
897
898
- /// Return a error response to the client. This default error response comes with `cache-control: private, no-store`.
899
- /// It has no response body.
900
- pub async fn respond_error ( & mut self , error_status_code : u16 ) {
901
- let ( resp, resp_tmp) = match error_status_code {
902
- /* commmon error responses are pre-generated */
903
- 502 => ( Some ( & * error_resp:: HTTP_502_RESPONSE ) , None ) ,
904
- 400 => ( Some ( & * error_resp:: HTTP_400_RESPONSE ) , None ) ,
905
- _ => (
906
- None ,
907
- Some ( error_resp:: gen_error_response ( error_status_code) ) ,
908
- ) ,
909
- } ;
910
-
911
- let resp = match resp {
912
- Some ( r) => r,
913
- None => resp_tmp. as_ref ( ) . unwrap ( ) ,
914
- } ;
915
-
916
- self . write_response_header_ref ( resp)
917
- . await
918
- . unwrap_or_else ( |e| {
919
- error ! ( "failed to send error response to downstream: {}" , e) ;
920
- } ) ;
921
- }
922
-
923
898
/// Write a `100 Continue` response to the client.
924
899
pub async fn write_continue_response ( & mut self ) -> Result < ( ) > {
925
900
// only send if we haven't already
0 commit comments