diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2015-01-06 13:39:00 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2015-01-06 13:39:00 +0000 |
commit | 5869fada8e0ff79cc6f3d4c4d91217b595cb01e1 (patch) | |
tree | c8f978ffa93d6a059fb3ac0aedbd9618878a10d6 /usr.sbin | |
parent | 9dddce030eb87a866b16bd155ed927c34dec06d8 (diff) |
Return "400 Bad Request" instead of "500 Internal Server Error" for
unknown/invalid HTTP requests.
From Fabian Raetz at gmail
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/httpd/server_http.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.sbin/httpd/server_http.c b/usr.sbin/httpd/server_http.c index d83c7b4556a..c9abfdca32b 100644 --- a/usr.sbin/httpd/server_http.c +++ b/usr.sbin/httpd/server_http.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server_http.c,v 1.59 2015/01/04 22:23:58 chrisz Exp $ */ +/* $OpenBSD: server_http.c,v 1.60 2015/01/06 13:38:59 reyk Exp $ */ /* * Copyright (c) 2006 - 2014 Reyk Floeter <reyk@openbsd.org> @@ -214,8 +214,10 @@ server_read_http(struct bufferevent *bev, void *arg) */ if (clt->clt_line == 1) { if ((desc->http_method = server_httpmethod_byname(key)) - == HTTP_METHOD_NONE) - goto fail; + == HTTP_METHOD_NONE) { + server_abort_http(clt, 400, "malformed"); + goto abort; + } /* * Decode request path and query |