Skip to content

Commit f1e09f9

Browse files
use better status code
1 parent ae56405 commit f1e09f9

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

src/date.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ impl HttpDate {
6666
}
6767

6868
fn err(msg: &'static str) -> Error {
69-
Error::new_from_str(ErrorKind::InvalidData, msg, StatusCode::InternalServerError)
69+
Error::new_from_str(ErrorKind::InvalidData, msg, StatusCode::BadRequest)
7070
}
7171

7272
fn parse_imf_fixdate(s: &[u8]) -> Result<HttpDate, Error> {

src/server.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,8 +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 =
366-
|msg| Error::new_from_str(ErrorKind::InvalidData, msg, StatusCode::InternalServerError);
365+
let err = |msg| Error::new_from_str(ErrorKind::InvalidData, msg, StatusCode::BadRequest);
367366

368367
if status.is_partial() {
369368
return Err(err("Malformed HTTP head"));

0 commit comments

Comments
 (0)