From patchwork Wed Sep 23 10:43:27 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: 1369829 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=1LulPdBi; 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=c3C3Hbpa; 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 4BxFFY2NFKz9sS8 for ; Wed, 23 Sep 2020 20:45:37 +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=J/eQssqIVtQBIAKfqANxu/2Fy8qZLKhRsqo/X8TtFNE=; b=1LulPdBiWNXVwPMAILIqIANMTA rly1pwMudnAhjnfJMDMQ4DGn2ysqqyx3DVMYFEqjGJIYcs9A3wEIaoByqlE18MJkUzNGtWhzCPbyz ELadmoWitzmn7g+oL4YcnHCfHkqxc8ouZ1XiQog+obSOirtOdf5YXLPcCe7VzlhoeZDaQBqPehxna gKaX0EUFkjdnItgsENB3MmHT0rpc8Euh2I48C1n/oR6mQBKwSktEfC5Vni6IXLG3ZU/uMCO+jC9pj jIAe9WPr1ieMPU/GzdFtdrTDm+qSxU/qKj1y/CHE15YeIHlF6/E31C30EJ58I777/HwZDzwfkZ1zU PmjHI/oA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kL2Fc-0008BD-Kq; Wed, 23 Sep 2020 10:43:52 +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 1kL2FZ-0008AP-VE for openwrt-devel@lists.openwrt.org; Wed, 23 Sep 2020 10:43:50 +0000 Received: by mail-lf1-x143.google.com with SMTP id z19so21556533lfr.4 for ; Wed, 23 Sep 2020 03:43:47 -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=dQKR+osQpdG+TS+SL7BMFuSKtRyms0O9+H6sAma/ST8=; b=c3C3HbpaYmbUr5qfsO2rZYwZS+tZ9nWxsO8DvAuIubSF5O7uGGtdYK8K6j8EB8ftDr e3a8jdQTFNykJIGfrznxqG1LrzOF6dllEb7FMaT+DzyGnucDjh2kJkYIVoCMkFtQg7T7 SRYgc7O4mkXXRxamQbNUZBpwtzomuTCxFgHWTojl/a2jHDJAAEYsnRkSoTZHZemMoxAh B4HQD8wg1mopm66rmdDAfAAA/xFijOsJYbY5yGQviR5ZhzpzkElXCcDHt6XZLOmJjNgn tGXCdlssBPax81Yp/7a6brTi8bHNNn/iQEiPfTTbyJobmOpAYXUe20vhqZQEJYv/cIoI m1Ig== 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=dQKR+osQpdG+TS+SL7BMFuSKtRyms0O9+H6sAma/ST8=; b=k3EGlOU2JvaEznckRw+qddZKvvdU2X38ol5WqIs9l6tr/oKjdeymXrx9IjPYw2cje3 3vhLlfkDaBoYKuUek5jUI9reISu6flgILDsd2Su9Lwg6vNVVrDN7pit5xJDq/rBeKliq xcH+FmfVMRngC46FlKlDzujt5vLtJuPRWIgRgKZcwKvyKTBgA34yyhcpasWXcQo2Byak PvGkYX9vHO7Ag6mLNhVbgDcfQTNG0fdqmQcLfFchlzO64tOPUCMQHWkJJDrRMOwcdWMa 08wZMN8dB/AOUy3eZ+yvWCWfLJ+olCmsgsgz8VnFqmcUc4B7iliJ0SGyJPiRfys4/bd/ 0KkQ== X-Gm-Message-State: AOAM533HQBssywooDcZz2nkDNuiUqvriAOeSBG1HI56REHhAVE+JNrjC CkyD0qPh80njk9qAo/4FaGFrk09GVGI= X-Google-Smtp-Source: ABdhPJzsVmrfDuCiQxRYSzUHzF1x3V7E+f1oMccrEnyiV+0wT0skmSjGf8K59HFWm6hT+6O1hcUhpA== X-Received: by 2002:ac2:54ab:: with SMTP id w11mr3005903lfk.180.1600857826490; Wed, 23 Sep 2020 03:43:46 -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 h25sm4635994lfl.273.2020.09.23.03.43.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Sep 2020 03:43:45 -0700 (PDT) From: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= To: openwrt-devel@lists.openwrt.org Subject: [PATCH uhttpd] client: really close connection on timeout Date: Wed, 23 Sep 2020 12:43:27 +0200 Message-Id: <20200923104327.14812-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-20200923_064350_040784_BCFC4D13 X-CRM114-Status: GOOD ( 12.90 ) 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.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit [zajec5[at]gmail.com] -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.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 -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from 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 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 --- V1: Set cl->request.connection_close and then call uh_request_done(). With this change: 1. uh_request_done() will take care of calling uh_connection_close() 2. uh_request_done() won't set state back to the CLIENT_STATE_INIT --- client.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client.c b/client.c index 2a2393f..b5736e4 100644 --- a/client.c +++ b/client.c @@ -95,7 +95,8 @@ static void client_timeout(struct uloop_timeout *timeout) struct client *cl = container_of(timeout, struct client, timeout); cl->state = CLIENT_STATE_CLOSE; - uh_connection_close(cl); + cl->request.connection_close = true; + uh_request_done(cl); } static void uh_set_client_timeout(struct client *cl, int timeout)