File tree Expand file tree Collapse file tree 3 files changed +8
-8
lines changed Expand file tree Collapse file tree 3 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -125,14 +125,14 @@ where
125125 // Convert our header buf into an httparse instance, and validate.
126126 let status = httparse_res. parse ( & buf) ?;
127127 if status. is_partial ( ) {
128- return Err ( Error :: new_from_str (
128+ return Err ( Error :: from_str (
129129 ErrorKind :: InvalidData ,
130130 "Malformed HTTP head" ,
131131 StatusCode :: BadRequest ,
132132 ) ) ;
133133 }
134134 let code = httparse_res. code . ok_or_else ( || {
135- Error :: new_from_str (
135+ Error :: from_str (
136136 ErrorKind :: InvalidData ,
137137 "No status code found" ,
138138 StatusCode :: BadRequest ,
@@ -141,14 +141,14 @@ where
141141
142142 // Convert httparse headers + body into a `http::Response` type.
143143 let version = httparse_res. version . ok_or_else ( || {
144- Error :: new_from_str (
144+ Error :: from_str (
145145 ErrorKind :: InvalidData ,
146146 "No version found" ,
147147 StatusCode :: BadRequest ,
148148 )
149149 } ) ?;
150150 if version != 1 {
151- return Err ( Error :: new_from_str (
151+ return Err ( Error :: from_str (
152152 ErrorKind :: InvalidData ,
153153 "Unsupported HTTP version" ,
154154 StatusCode :: BadRequest ,
@@ -172,7 +172,7 @@ where
172172
173173 if content_length. is_some ( ) && transfer_encoding. is_some ( ) {
174174 // This is always an error.
175- return Err ( Error :: new_from_str (
175+ return Err ( Error :: from_str (
176176 ErrorKind :: InvalidData ,
177177 "Unexpected Content-Length header" ,
178178 StatusCode :: BadRequest ,
Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ impl HttpDate {
6666}
6767
6868fn err ( msg : & ' static str ) -> Error {
69- Error :: new_from_str ( ErrorKind :: InvalidData , msg, StatusCode :: BadRequest )
69+ Error :: from_str ( ErrorKind :: InvalidData , msg, StatusCode :: BadRequest )
7070}
7171
7272fn parse_imf_fixdate ( s : & [ u8 ] ) -> Result < HttpDate , Error > {
Original file line number Diff line number Diff line change @@ -362,7 +362,7 @@ where
362362 // Convert our header buf into an httparse instance, and validate.
363363 let status = httparse_req. parse ( & buf) ?;
364364
365- let err = |msg| Error :: new_from_str ( ErrorKind :: InvalidData , msg, StatusCode :: BadRequest ) ;
365+ let err = |msg| Error :: from_str ( ErrorKind :: InvalidData , msg, StatusCode :: BadRequest ) ;
366366
367367 if status. is_partial ( ) {
368368 return Err ( err ( "Malformed HTTP head" ) ) ;
@@ -392,7 +392,7 @@ where
392392
393393 if content_length. is_some ( ) && transfer_encoding. is_some ( ) {
394394 // This is always an error.
395- return Err ( Error :: new_from_str (
395+ return Err ( Error :: from_str (
396396 ErrorKind :: InvalidData ,
397397 "Unexpected Content-Length header" ,
398398 StatusCode :: BadRequest ,
You can’t perform that action at this time.
0 commit comments