From fc6d0643710f4fec2abb5a2008041da70855151e Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sat, 25 Jun 2022 11:22:06 +0900 Subject: [PATCH] No need to check pseudo header lws No need to check pseudo header lws because it is guaranteed not to have leading white spaces. --- lib/nghttp2_http.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/lib/nghttp2_http.c b/lib/nghttp2_http.c index 0ce3631f..71491f0e 100644 --- a/lib/nghttp2_http.c +++ b/lib/nghttp2_http.c @@ -73,22 +73,9 @@ static int64_t parse_uint(const uint8_t *s, size_t len) { return n; } -static int lws(const uint8_t *s, size_t n) { - size_t i; - for (i = 0; i < n; ++i) { - if (s[i] != ' ' && s[i] != '\t') { - return 0; - } - } - return 1; -} - static int check_pseudo_header(nghttp2_stream *stream, const nghttp2_hd_nv *nv, uint32_t flag) { - if (stream->http_flags & flag) { - return 0; - } - if (lws(nv->value->base, nv->value->len)) { + if ((stream->http_flags & flag) || nv->value->len == 0) { return 0; } stream->http_flags = stream->http_flags | flag;