From 88add854ff7e1246fd94acd6edb2863435b2caa5 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Fri, 8 Aug 2014 23:11:58 +0900 Subject: [PATCH] nghttpx: Treat malformed request as PROTOCOL_ERROR --- src/shrpx_http2_upstream.cc | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/shrpx_http2_upstream.cc b/src/shrpx_http2_upstream.cc index a835ea2a..d639a3a8 100644 --- a/src/shrpx_http2_upstream.cc +++ b/src/shrpx_http2_upstream.cc @@ -314,9 +314,7 @@ int on_request_headers(Http2Upstream *upstream, } if(!http2::check_http2_request_headers(nva)) { - if(upstream->error_reply(downstream, 400) != 0) { - upstream->rst_stream(downstream, NGHTTP2_PROTOCOL_ERROR); - } + upstream->rst_stream(downstream, NGHTTP2_PROTOCOL_ERROR); return 0; } @@ -336,9 +334,7 @@ int on_request_headers(Http2Upstream *upstream, // Here we strictly require :authority header field. if(scheme || path || !having_authority) { - if(upstream->error_reply(downstream, 400) != 0) { - upstream->rst_stream(downstream, NGHTTP2_PROTOCOL_ERROR); - } + upstream->rst_stream(downstream, NGHTTP2_PROTOCOL_ERROR); return 0; } @@ -351,9 +347,7 @@ int on_request_headers(Http2Upstream *upstream, (!get_config()->http2_proxy && !having_authority && !having_host) || !http2::non_empty_value(path)) { - if(upstream->error_reply(downstream, 400) != 0) { - upstream->rst_stream(downstream, NGHTTP2_PROTOCOL_ERROR); - } + upstream->rst_stream(downstream, NGHTTP2_PROTOCOL_ERROR); return 0; }