From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-3.9 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id A592C211BD for ; Sat, 1 Dec 2018 13:31:28 +0000 (UTC) From: Eric Wong To: kcar-public@bogomips.org Subject: [PATCH 10/11] always set non-negative Content-Length for requests Date: Sat, 1 Dec 2018 13:31:24 +0000 Message-Id: <20181201133125.5524-11-e@80x24.org> In-Reply-To: <20181201133125.5524-1-e@80x24.org> References: <20181201133125.5524-1-e@80x24.org> List-Id: Negative len.content is used to denote chunked responses on #body_bytes_left, but we don't use that for request parsing. --- ext/kcar/kcar.rl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ext/kcar/kcar.rl b/ext/kcar/kcar.rl index c85eb3c..336af55 100644 --- a/ext/kcar/kcar.rl +++ b/ext/kcar/kcar.rl @@ -199,6 +199,8 @@ static void finalize_header(struct http_parser *hp, VALUE hdr) rb_raise(eParserError, "Content-Length set with chunked encoding"); else hp->len.chunk = 0; + } else if (hp->len.content < 0) { + hp->len.content = 0; } if (!hp->has_query)