From patchwork Mon Jul 27 18:14:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 1337133 X-Patchwork-Delegate: zajec5@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=W6iCfskE; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=K7n827nY; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BFp1Y2bLCz9sRK for ; Tue, 28 Jul 2020 04:17:21 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=KElaK4WZNhpa8Kdcy+5/b0YCEFfYjakmeUOKDxj+yfY=; b=W6iCfskETuLqOR/Of8r6MGJ5dd Yfa+JUY/z3RM39g6yjXaXttuU3TMdbPJ3YNN2dx/Qr9uuiXwC98y73nyEAqlS+WhI+iKlWJCppUc7 TtZvtYWsexDq9aOxck0ZBJJvA4vovMKq92y5Nvj5yR/oSnjDAtzj6wUFMK4m+XjcvNJfyaxBZZkLP XUcQZLszebOz1lVM95Mp1IEeVfaqP/ZnnY+s1cxu7nMiFOlhr/4iacsBJAy0qChwzuUYheulYugYl UVsTwTk5HDWHdtiROiWI1JXj2g5gErV3Ro23lGUaXd3fSRCaJcajRr1JCSMUlUA8T7EZXmO5/lpkz iRjDE2Sw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k07eK-0005uM-Hq; Mon, 27 Jul 2020 18:14:56 +0000 Received: from mail-lf1-x143.google.com ([2a00:1450:4864:20::143]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k07eG-0005tj-N2 for openwrt-devel@lists.openwrt.org; Mon, 27 Jul 2020 18:14:53 +0000 Received: by mail-lf1-x143.google.com with SMTP id 140so9526193lfi.5 for ; Mon, 27 Jul 2020 11:14:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=1C+Esc2vdDnsZKXeOjc0WZgPSTQ2l//bKcs37kgVk/Y=; b=K7n827nYyVixgPNMD2jAx6t9wG6XK9wzr5KAy8EehTjnwHpBmIXUljdSlaC2FP5R+1 ztfTkhmVKp2STNjrR7VcwHqlth8cEcG8KkCsqTkuGLdSUuJI0k7EZ5Fuey5vLKreE5Tu GYthoaB9Gjd7NjAFOp3A540UjANV6quW3nyw2OZxTIiUSGmNlBn7HoUSp6L828Ih1RDp 7HoTCfbZgDzs5KMLShY8d8XXB+JHRBkc+O2+mXIkVUuYepLHfyLZzZDP8uK5SQDnk4/f FHr8LNF0XqMwVpghkP9FkCR2MmnK6BX/bVysXdzFl9Lj5+owmRAUTpXN+gMJ5efvKKKC BV1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=1C+Esc2vdDnsZKXeOjc0WZgPSTQ2l//bKcs37kgVk/Y=; b=MJ/+Y7ztJklqEtxifm/UaJ4MbEjJnG8MfkP42MYdn9RQ1ROUeziIHyOyGDbWYD0wOq jUKkarpNVzwqlardXtFUFUoR1xYQ+OqwIW6dpwlxmNnh5AhzhEVIBF1maCftIonTnvUl PxHCisma0RwVCIDjM13eJsnqMot3FAB7q5xNWHaQFuxHq45pKQTOZjnsR1VBy0L2FtWB Qqvh/dp6GUuNE/T93F5VLCNf17uq7qC6diqqvyELgEERTz8JQ9BoAh9TODdjGylhSDdi uprF7JZhdkKM9430D1ZH9975SNQQ2elLc0cAN83uXorq8ZQxJUbpvVdESVu7tEPue4XW t7SA== X-Gm-Message-State: AOAM532de6SZ+2L7j8//9MOs2bHGtW7g1g2sQN/lqrNS7BEU5ZFmZiL9 Ld4ifI8wtW1jyg/svoDDgwBozm3S X-Google-Smtp-Source: ABdhPJwRR068CxaZbXyTo5e0J1hjRDi93gwgT6bzUB2j1+3Y+nD78T/eA2OAqpGvWJzTNPFgAqfd2A== X-Received: by 2002:ac2:4c33:: with SMTP id u19mr2234459lfq.154.1595873690716; Mon, 27 Jul 2020 11:14:50 -0700 (PDT) Received: from localhost.localdomain (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by smtp.gmail.com with ESMTPSA id z12sm3199831lfh.61.2020.07.27.11.14.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jul 2020 11:14:50 -0700 (PDT) From: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= To: openwrt-devel@lists.openwrt.org Subject: [PATCH uhttpd rfc] client: really close connection on timeout Date: Mon, 27 Jul 2020 20:14:44 +0200 Message-Id: <20200727181444.28780-1-zajec5@gmail.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200727_141452_788811_92472F8F X-CRM114-Status: GOOD ( 14.55 ) X-Spam-Score: 0.1 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:143 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [zajec5[at]gmail.com] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit [zajec5[at]gmail.com] -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= , Jo-Philipp Wich , Felix Fietkau Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org From: Rafał Miłecki After specified time of network inactivity uhttpd is meant to close connection. It doesn't seem to work thought. After timeout client doesn't receive any more data but connection it still opened. This change fixes that. Signed-off-by: Rafał Miłecki --- While this fixes described problem I'm not sure if calling uh_request_done() is the right thing to do. I need someone with better uhttpd knowledge to review this. --- client.c | 1 + 1 file changed, 1 insertion(+) diff --git a/client.c b/client.c index 2a2393f..e933e63 100644 --- a/client.c +++ b/client.c @@ -96,6 +96,7 @@ static void client_timeout(struct uloop_timeout *timeout) cl->state = CLIENT_STATE_CLOSE; uh_connection_close(cl); + uh_request_done(cl); } static void uh_set_client_timeout(struct client *cl, int timeout)