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
125
125
// Convert our header buf into an httparse instance, and validate.
126
126
let status = httparse_res. parse ( & buf) ?;
127
127
if status. is_partial ( ) {
128
- return Err ( Error :: new_from_str (
128
+ return Err ( Error :: from_str (
129
129
ErrorKind :: InvalidData ,
130
130
"Malformed HTTP head" ,
131
131
StatusCode :: BadRequest ,
132
132
) ) ;
133
133
}
134
134
let code = httparse_res. code . ok_or_else ( || {
135
- Error :: new_from_str (
135
+ Error :: from_str (
136
136
ErrorKind :: InvalidData ,
137
137
"No status code found" ,
138
138
StatusCode :: BadRequest ,
@@ -141,14 +141,14 @@ where
141
141
142
142
// Convert httparse headers + body into a `http::Response` type.
143
143
let version = httparse_res. version . ok_or_else ( || {
144
- Error :: new_from_str (
144
+ Error :: from_str (
145
145
ErrorKind :: InvalidData ,
146
146
"No version found" ,
147
147
StatusCode :: BadRequest ,
148
148
)
149
149
} ) ?;
150
150
if version != 1 {
151
- return Err ( Error :: new_from_str (
151
+ return Err ( Error :: from_str (
152
152
ErrorKind :: InvalidData ,
153
153
"Unsupported HTTP version" ,
154
154
StatusCode :: BadRequest ,
@@ -172,7 +172,7 @@ where
172
172
173
173
if content_length. is_some ( ) && transfer_encoding. is_some ( ) {
174
174
// This is always an error.
175
- return Err ( Error :: new_from_str (
175
+ return Err ( Error :: from_str (
176
176
ErrorKind :: InvalidData ,
177
177
"Unexpected Content-Length header" ,
178
178
StatusCode :: BadRequest ,
Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ impl HttpDate {
66
66
}
67
67
68
68
fn err ( msg : & ' static str ) -> Error {
69
- Error :: new_from_str ( ErrorKind :: InvalidData , msg, StatusCode :: BadRequest )
69
+ Error :: from_str ( ErrorKind :: InvalidData , msg, StatusCode :: BadRequest )
70
70
}
71
71
72
72
fn parse_imf_fixdate ( s : & [ u8 ] ) -> Result < HttpDate , Error > {
Original file line number Diff line number Diff line change @@ -362,7 +362,7 @@ where
362
362
// Convert our header buf into an httparse instance, and validate.
363
363
let status = httparse_req. parse ( & buf) ?;
364
364
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 ) ;
366
366
367
367
if status. is_partial ( ) {
368
368
return Err ( err ( "Malformed HTTP head" ) ) ;
@@ -392,7 +392,7 @@ where
392
392
393
393
if content_length. is_some ( ) && transfer_encoding. is_some ( ) {
394
394
// This is always an error.
395
- return Err ( Error :: new_from_str (
395
+ return Err ( Error :: from_str (
396
396
ErrorKind :: InvalidData ,
397
397
"Unexpected Content-Length header" ,
398
398
StatusCode :: BadRequest ,
You can’t perform that action at this time.
0 commit comments