From patchwork Thu Mar 1 15:40:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hartikainen, Sami" X-Patchwork-Id: 879916 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=googlegroups.com (client-ip=2607:f8b0:400c:c05::239; helo=mail-vk0-x239.google.com; envelope-from=swupdate+bncbaabbnv64dkakgqehlaghty@googlegroups.com; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=teleste.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.b="EdnfwywL"; dkim-atps=neutral Received: from mail-vk0-x239.google.com (mail-vk0-x239.google.com [IPv6:2607:f8b0:400c:c05::239]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zsc9j4TGXz9s1B for ; Fri, 2 Mar 2018 02:41:44 +1100 (AEDT) Received: by mail-vk0-x239.google.com with SMTP id s62sf3535667vke.4 for ; Thu, 01 Mar 2018 07:41:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1519918903; cv=pass; d=google.com; s=arc-20160816; b=gwcjuq6run70xfu1Mluvqh4DPZQT1kPlv2+9PCyunyDxNLmv1VQmV5Frbl2fkIRHmx y08nZmG44G4wv7GgVHSnbe4+FkdL5/ywGkXdnVCHl7kPTpSl0te6x4KxpR4VgWvp4vHo MHg7uyrphyMlxjTplcqI5q7dL+1nL/0IlnyI6EqatYr3g//+W+rpQtMyH2f6QAex7nG8 nSg2bG534w/tzL4UCPzZmSCbYb23Is9Y56BGKLE+O5qLZ3L4p34JnoYunafd3UORKwMl PaQlmFDZhsFjwt82Kgc7bvLBjxRbfQ4AnrB8kObFOKnFEIq3patuVD/2eRfULSTicERu KAvg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:arc-authentication-results :arc-message-signature:sender:dkim-signature :arc-authentication-results; bh=GMfv25N99Y2jEQn4yEQWBf1f8jI7NNarw6bzb3OvGv8=; b=ipS7zBHMBF9W6JAL+MMoNXFDUqVRtUgWNij0QYEH29E/tCKHIsH5fzZlSeKSizQe1c W/JInqIoKWYcNox3Yr1+KMjdqqYuJ2DG3ayQeln//GW6WGH2yvEB9kVc0TtsrSD2bgQx TyutS+whPcWDYD5UclZkhZGh9kCbRpw35zp+Yb3seCQ1shD76Staq2DTACPjZjpoF7ds LQIZq+G3bU9Y5VRyl/mVbEDG0N/VfGImHn8Lzi8cj68LgKLAGKjn1RCQZnvf0DEoElja j5zipFtzDtPaXtoyP6Gf5hj1loGzFhPpGQ0xCt7f8kr0aoB79CYh7YS2sDCD43cMWSg8 14fw== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@Teleste.onmicrosoft.com header.s=selector1-Teleste-com header.b=i7FQVYi0; spf=pass (google.com: domain of sami.hartikainen@teleste.com designates 104.47.0.56 as permitted sender) smtp.mailfrom=Sami.Hartikainen@teleste.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:spamdiagnosticoutput:spamdiagnosticmetadata :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=GMfv25N99Y2jEQn4yEQWBf1f8jI7NNarw6bzb3OvGv8=; b=EdnfwywL+NIVwosEBdguMUPLT0TkZwj3nEiVJPs0Kh7qi+mKboF3ZuRPiDG3KVDc/p z9GqjKUo6eqNj7HfrLsKfj3i2BIheFH9L9g35ZPGuCvgpBNuptmucqrwL6qOt7QXAUoU QtSbAIu4UC4Cy6piWyCQFdMNV5MII3rvVPw4l8pmVHVgmvfq+q1CNEOb5b7Btn1TdRZC ZnGzQbZURFvipoqZWVLEGXat1gX1/pCp9PwfWGrOPE8R5rq1d/UWXDIu32oURRj5oIVU 0PE7AeJxhamZ8UZ0MKJRG3R4Iyx8UUUqB9Uil5mYJ48TzhdvkoQ12e2A9l6R2ceE2EPV W8Dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:spamdiagnosticoutput :spamdiagnosticmetadata:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=GMfv25N99Y2jEQn4yEQWBf1f8jI7NNarw6bzb3OvGv8=; b=SL2oOoCzTVHfIf2LOxvMfWK4+ZCsFVvl4E10ZZZuF9p6FRsX6w19M8LF64zfpoAO/Z d5nl8ioMQgk3IJajNpyUV4WL7PqMK7JOz7+o/zpIXk/ULxIyIcVHQBntynQ5hITN/YnM IB2u0JENOj224deTy+NFOAJPO4wza90jMGix31jfg3eHlbnkj1HWzmlgr4O5NR3HolcF NEF1NAvDn6XmPwZm1qCctD5+VNtvN3mOsmkEFo31wV1J4zOY9RJ7T0n+jnONN/jcjvxb uGZ/GLjsKg6wcQK7Qp7fFn9tUnMoEK7C+rpBA/i2jxYybkqUnegIZ9pJs8Teimobafgi veAg== Sender: swupdate@googlegroups.com X-Gm-Message-State: APf1xPBdZMoCCTpmdpvXkWKWCq+GsFvEWTYhD2IhIjwi348ZrySbljQ/ qiuzK2SKRbOS8fr419oOato= X-Google-Smtp-Source: AG47ELt96TP1Z/GL+424PHMz/2prJ9OcIEi5KYKs35yVb58SdmcV6i7dRV0TYfmrpvf+BZL4u652Gw== X-Received: by 10.31.2.74 with SMTP id 71mr242431vkc.6.1519918902739; Thu, 01 Mar 2018 07:41:42 -0800 (PST) X-BeenThere: swupdate@googlegroups.com Received: by 10.176.49.77 with SMTP id e13ls813920uam.11.gmail; Thu, 01 Mar 2018 07:41:42 -0800 (PST) X-Received: by 10.176.96.11 with SMTP id j11mr1034860ual.9.1519918902383; Thu, 01 Mar 2018 07:41:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519918902; cv=none; d=google.com; s=arc-20160816; b=Ko06RIo/yVtvwI4THmXWGTpOd7tay0p0vrfc4WT43XnKJ1j0BooUzNwuKOv6HZhYsQ HOk9B2c7+11fyYt61+arIG4ZJp9yi798BpaYbMdzpLlouxxPneZx6Ci3sOVmwjbd8sj6 Ruxz14A2QQso8G56z9jAk+0Pkp56XnQhUfFRQGvFodv5hiAa59aaMspVydXJz9TMk13S 2jkUe1wg4BH5qrqX0kCh/M6MDk20/GoduEcEDGVhLkS2Bl4uEkoA1VumJ3pDgPqRTmVG 5kyOMak9epMySsZoQWCcC2k/lz+lywolb8VUnqtkYsp4aJznrZm6jAHv1+6GqIZ0zKlu rWKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=spamdiagnosticmetadata:spamdiagnosticoutput:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=KNboZL5VpvMYRpekQjm4TLse/VdpFpR+14C+vhlBPFE=; b=ywmgmno5PXWmzJJkzG/nt1p2nKKZqz8Bo1rJXH2JjH4q9lcgbVDS7FQ29ZNDjW0Xxq DWHRKK6H/X1IAQQs2tvoFHbYReL8Gri6qZ42SxHsXHZbHXPCIHbNbZzEPoA/M/vLGG/z iadvY2Lv1CGXNhUsAXVvflvjm1EErTPoaGUbNrnY7SxLFSbXP43Z4lb9ZTb9BSWigf5W fX/HdSBKGWuNHQXlFqdzvZhLj6tpWq2J5R6lMlnM87yZofLOmtYSo0GIPCh3wF5zbC89 0nJjyahS1rfr0x0KeDroKrPXpD6n68Xc9kMsveZ9oXymw306FgVXFnGtFXWIgpKDbN3F oHuw== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@Teleste.onmicrosoft.com header.s=selector1-Teleste-com header.b=i7FQVYi0; spf=pass (google.com: domain of sami.hartikainen@teleste.com designates 104.47.0.56 as permitted sender) smtp.mailfrom=Sami.Hartikainen@teleste.com Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0056.outbound.protection.outlook.com. [104.47.0.56]) by gmr-mx.google.com with ESMTPS id y62si211270vkg.4.2018.03.01.07.41.41 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 01 Mar 2018 07:41:42 -0800 (PST) Received-SPF: pass (google.com: domain of sami.hartikainen@teleste.com designates 104.47.0.56 as permitted sender) client-ip=104.47.0.56; Received: from AM6PR0402CA0020.eurprd04.prod.outlook.com (2603:10a6:209::33) by AM6PR0402MB3526.eurprd04.prod.outlook.com (2603:10a6:209:7::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.548.13; Thu, 1 Mar 2018 15:41:38 +0000 Received: from AM5EUR03FT044.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e08::204) by AM6PR0402CA0020.outlook.office365.com (2603:10a6:209::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.548.13 via Frontend Transport; Thu, 1 Mar 2018 15:41:38 +0000 Received-SPF: Pass (protection.outlook.com: domain of teleste.com designates 212.213.19.238 as permitted sender) receiver=protection.outlook.com; client-ip=212.213.19.238; helo=FRAX.twin.net; Received: from FRAX.twin.net (212.213.19.238) by AM5EUR03FT044.mail.protection.outlook.com (10.152.17.56) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.527.18 via Frontend Transport; Thu, 1 Mar 2018 15:41:37 +0000 Received: from contrix.teleste.com (192.168.150.55) by FRAX.twin.net (10.1.0.45) with Microsoft SMTP Server id 14.2.247.3; Thu, 1 Mar 2018 17:41:21 +0200 Received: by contrix.teleste.com (Postfix, from userid 1001) id 5E2CF73; Thu, 1 Mar 2018 17:41:21 +0200 (EET) From: Sami Hartikainen To: CC: Sami Hartikainen Subject: [swupdate] [PATCH v2] mongoose: Allow WEB API v1 and v2 both be enabled Date: Thu, 1 Mar 2018 17:40:34 +0200 Message-ID: <1519918834-10861-1-git-send-email-sami.hartikainen@teleste.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:212.213.19.238; IPV:NLI; CTRY:FI; EFV:NLI; SFV:NSPM; SFS:(10009020)(376002)(39380400002)(396003)(39850400004)(346002)(2980300002)(438002)(189003)(199004)(478600001)(52956003)(106002)(4326008)(86362001)(305945005)(72206003)(103686004)(51416003)(76176011)(2906002)(69596002)(6666003)(8676002)(2950100002)(6916009)(81166006)(106466001)(2351001)(81156014)(356003)(8936002)(47776003)(16586007)(26005)(50466002)(42186006)(68736007)(316002)(36756003)(6266002)(336011)(59450400001)(186003)(5660300001)(107886003)(53936002)(50226002)(97736004)(48376002)(217873001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR0402MB3526; H:FRAX.twin.net; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; AM5EUR03FT044; 1:vAMXdDmqQ8RtLy8Mg4uWUz3mnELukVlyQgIj1+nBtWia73cgOkHkbpDJKXN7RQ76ZPSt1tCBbJfBjV7G1O9hXzhubvfkj8//yPLjCg1Dx02uJAWNZKR65rxkuMgzmBE/ X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b7aebfb7-2796-4faa-1274-08d57f8aebe9 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(4608076)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603307)(7153060); SRVR:AM6PR0402MB3526; X-Microsoft-Exchange-Diagnostics: 1; AM6PR0402MB3526; 3:92Dt37VTZnmhl1be6b4tguRq3m9EbDsYubh9BWstR7WBOxa//7dumfrOTYUJPAngttk5O1riibfC1W4///zW7l4chlgDt5ZaQWz/3P2pJmTqUHL3A7HCMROOUM1rKUNTfIPaAJLWtVJVbm0MnfNUyH6a7IRGQjUwZDKIjLhBTs7DFhRroTdVRgIuDzd9vxUxY8/xWP5bGA+tx0oV2JIyTX5maSu8m+MQIJFxv5eBlrnrrmuvB222c0XdVlaM392pZJ3eV0vmsINyh+x9lH8457W+v9If8hg/kpuUDEwZoJXNs9AYtjqLztfD7OlFkBySqu779hmwucwHJnGNKwDVODpJD2cdC1zeOSS9lkK5ImU=; 25:ce3+WQs9ZZg0iPy6qQeWgOBEvG+mUOrFO1Y6Y7M4AC6aYQsSCDzFQ9WQF5piNvb1pT9sGXTtb71+ZF/9kWAhMym0cxGkGw1fpaXQ5JOji2mVye/pY7d7STc4+cXmLh337gfVJ0GA2dEzLu/c4mZ2HVNlWz03Wq/DfK09m1J0ikIiNhPOHJWaODhCY/eiv5hjBRaUbBMEeL69iOjt1jN3Y78QYfSgcXL1ldCk6ZUJ39bZ5XvV8C1E3E25dJKjYAsyB7fPrJ3hS6bn/NuXP1HVYWQEUF6tkXf2SOy7K4w+1l0xBPh/Y5tosibAROyfd59QRpORxjZSKq3U2jHH6BgDuw== X-MS-TrafficTypeDiagnostic: AM6PR0402MB3526: X-Microsoft-Exchange-Diagnostics: 1; AM6PR0402MB3526; 31:SNKkvbsAdbi0w0LDQ4aDntzU4WhXRMNZ85aILRClWPVwWlX9fxvt3lwKF+ZHvZE7rhl10CDb5m68UBXP6vYrWRA50AxiKFh7v1lMQrUeVzTLsDtt8bDc271xBOsYRxYoac5Gt3wU4gR+3HDEv+TlhGWXuhF+zRx6JSnRdch9OdzZ2AuV3p0Tcc3bWFZNTGfEByIIYHrgzdl58el4ilqkeIf6RwfHjbmjN46slb+6EYY=; 20:d/+DIHWHGbNduxEzTWn7J/sqibPS8C1+mlMZJbosTdmL8CtDIeAT3BBsJHnXf5zTwCEP6OjvNTbVfwFra+veKfcB5WLvuiF1NbEs/8T/t5+TCrdvp6Ur6TpYhvvtNHQDco4fupIjr8QCQ+Zk0eHVFXUnNfKtV80//z5Rv+ypnDWXeHupdwjL07YoQKTpsrL1eGKyMdHO+QXD3I60JOK916qUOrFCydJXdX1JfP8D6IEOkExUdYY3PHVKKeNsfLwO4DD5lIgyfnv/sL6R+34uqpsSOj993jFMwB/ZVd2xhWSoWc1Iep6bWTanKcHqObgOi4QM4HdkzIA7uBi50BiuMqj8UXIPSO6r9YqyoZi+Tl5c2iBZoMTHH/9yoeBFMeepssZgReu0mD0Fi29k9rXzj+IkGpwVIRJUAmux1c6opSjxB1STr9BzYKplgFltBHYDE/sWMH4KKtl6kX1Pot4SrDUhNMFQw9sx3wYm8D0Deny5QjvP8bOvrXpLkyXfHLNk X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(158342451672863)(21532816269658); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(8121501046)(5005006)(10201501046)(93006095)(93004095)(3002001)(3231220)(944501229)(6041288)(20161123564045)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(6072148)(201708071742011); SRVR:AM6PR0402MB3526; BCL:0; PCL:0; RULEID:; SRVR:AM6PR0402MB3526; X-Microsoft-Exchange-Diagnostics: 1; AM6PR0402MB3526; 4:A+Gk+IOcO9r2RqK0iLMDz4caT01pz+0+srYodozemXwX8E9tt7yAq+1ozOIDNTJWEjUuqMtyAH/GLSqSK0Vlm6cHb9SwI6mDGocrGa4ehJJ/GxywGDAmjjF3AmCeAxdpgBZXhRX6aiM0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D20Lc3aOXCGxbn6fZIRA/j2k6CtlMKmk60FbRVQuEJWh+nmQC34SYFTcXlO9K0av0LNouM4gnAbsulTGLNizp5XefrtkvCzRqBtEbB/sqLTLxAzdrZXwDiTJpW0NQZgKJVAcEhkEwEnfE5KfP+/O9EoDAUOc1BYeYrCVEO5cBmzGJ7HCpyjJ2tUiaVtYvquAP1iP2ww42y8afek5KNj9MvjDgQPw2TTzGeSXP SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Teleste.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Mar 2018 15:41:37.9646 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b7aebfb7-2796-4faa-1274-08d57f8aebe9 X-MS-Exchange-CrossTenant-Id: 0a3a6402-5c43-4939-8e53-47a694177b24 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=0a3a6402-5c43-4939-8e53-47a694177b24; Ip=[212.213.19.238]; Helo=[FRAX.twin.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR0402MB3526 X-Original-Sender: sami.hartikainen@teleste.com X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@Teleste.onmicrosoft.com header.s=selector1-Teleste-com header.b=i7FQVYi0; spf=pass (google.com: domain of sami.hartikainen@teleste.com designates 104.47.0.56 as permitted sender) smtp.mailfrom=Sami.Hartikainen@teleste.com Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , To ease transition, or simply to enable the use of modern clients while still supporting the use of the swuforwarder handler (which only talks API v1), both the v1 and v2 API may be enabled. N.B. Clients for v1 and v2 should not connect at the *same time*, however. This restriction is due to having a simple queue for the status messages, consumed by the first reader. Signed-off-by: Sami Hartikainen --- mongoose/Config.in | 15 ++-- mongoose/mongoose_interface.c | 177 +++++++++++++++++++++++++++--------------- 2 files changed, 121 insertions(+), 71 deletions(-) diff --git a/mongoose/Config.in b/mongoose/Config.in index a001247..6751cf3 100644 --- a/mongoose/Config.in +++ b/mongoose/Config.in @@ -14,27 +14,28 @@ choice config MONGOOSE bool "mongoose" help - Mongoose embeddded web server + Mongoose embedded web server endchoice -choice - prompt "Web Application Interface" - default MONGOOSE_WEB_API_V1 - help - Choose the bootloader +menu "Web Application Interface" config MONGOOSE_WEB_API_V1 bool "Version 1 (deprecated)" + default y help Support for version 1 config MONGOOSE_WEB_API_V2 bool "Version 2" + default y help Support for version 2 -endchoice +comment "Web API v1 or v2 or both required" + depends on !MONGOOSE_WEB_API_V1 && !MONGOOSE_WEB_API_V2 + +endmenu config MONGOOSEIPV6 bool "IPv6 support" diff --git a/mongoose/mongoose_interface.c b/mongoose/mongoose_interface.c index 89a51f3..2bee6fa 100644 --- a/mongoose/mongoose_interface.c +++ b/mongoose/mongoose_interface.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "mongoose.h" @@ -49,6 +50,10 @@ struct file_upload_state { static struct mg_serve_http_opts s_http_server_opts; +#if !defined(CONFIG_MONGOOSE_WEB_API_V1) && !defined(CONFIG_MONGOOSE_WEB_API_V2) +#error "WEB API v1 or v2 or both must be defined" +#endif + #if defined(CONFIG_MONGOOSE_WEB_API_V2) #define enum_string(x) [x] = #x static const char *get_status_string(unsigned int status) @@ -116,16 +121,72 @@ static void upload_handler(struct mg_connection *nc, int ev, void *p) { struct mg_http_multipart_part *mp; struct file_upload_state *fus; + + switch (ev) { + case MG_EV_HTTP_PART_BEGIN: + mp = (struct mg_http_multipart_part *) p; + + fus = (struct file_upload_state *) calloc(1, sizeof(*fus)); + if (fus == NULL) { + mg_http_send_error(nc, 500, "Out of memory"); + break; + } + + fus->fd = ipc_inst_start_ext(SOURCE_WEBSERVER, strlen(mp->file_name), mp->file_name); + if (fus->fd < 0) { + mg_http_send_error(nc, 500, "Failed to queue command"); + free(fus); + break; + } + + mp->user_data = fus; + + break; + + case MG_EV_HTTP_PART_DATA: + mp = (struct mg_http_multipart_part *) p; + fus = (struct file_upload_state *) mp->user_data; + + if (!fus) + break; + + ipc_send_data(fus->fd, (char *) mp->data.p, mp->data.len); + fus->len += mp->data.len; + + break; + + case MG_EV_HTTP_PART_END: + mp = (struct mg_http_multipart_part *) p; + fus = (struct file_upload_state *) mp->user_data; + + if (!fus) + break; + + ipc_end(fus->fd); + + mg_send_response_line(nc, 200, + "Content-Type: text/plain\r\n" + "Connection: close"); + mg_send(nc, "\r\n", 2); + mg_printf(nc, "Ok, %s - %d bytes.\r\n", mp->file_name, (int) fus->len); + nc->flags |= MG_F_SEND_AND_CLOSE; + + mp->user_data = NULL; + free(fus); + break; + } +} + #if defined(CONFIG_MONGOOSE_WEB_API_V1) +static void upload_handler_v1(struct mg_connection *nc, int ev, void *p) +{ struct mg_str *filename, *data; struct http_message *hm; size_t length; char buf[16]; int fd; -#endif switch (ev) { -#if defined(CONFIG_MONGOOSE_WEB_API_V1) case MG_EV_HTTP_REQUEST: hm = (struct http_message *) p; @@ -161,62 +222,13 @@ static void upload_handler(struct mg_connection *nc, int ev, void *p) nc->flags |= MG_F_SEND_AND_CLOSE; break; -#endif - case MG_EV_HTTP_PART_BEGIN: - mp = (struct mg_http_multipart_part *) p; - fus = (struct file_upload_state *) calloc(1, sizeof(*fus)); - if (fus == NULL) { - mg_http_send_error(nc, 500, "Out of memory"); - break; - } - - fus->fd = ipc_inst_start_ext(SOURCE_WEBSERVER, strlen(mp->file_name), mp->file_name); - if (fus->fd < 0) { - mg_http_send_error(nc, 500, "Failed to queue command"); - free(fus); - break; - } - - mp->user_data = fus; - - break; - - case MG_EV_HTTP_PART_DATA: - mp = (struct mg_http_multipart_part *) p; - fus = (struct file_upload_state *) mp->user_data; - - if (!fus) - break; - - ipc_send_data(fus->fd, (char *) mp->data.p, mp->data.len); - fus->len += mp->data.len; - - break; - - case MG_EV_HTTP_PART_END: - mp = (struct mg_http_multipart_part *) p; - fus = (struct file_upload_state *) mp->user_data; - - if (!fus) - break; - - ipc_end(fus->fd); - - mg_send_response_line(nc, 200, - "Content-Type: text/plain\r\n" - "Connection: close"); - mg_send(nc, "\r\n", 2); - mg_printf(nc, "Ok, %s - %d bytes.\r\n", mp->file_name, (int) fus->len); - nc->flags |= MG_F_SEND_AND_CLOSE; - - mp->user_data = NULL; - free(fus); + default: + upload_handler(nc, ev, p); break; } } -#if defined(CONFIG_MONGOOSE_WEB_API_V1) static void recovery_status(struct mg_connection *nc, int ev, void *ev_data) { ipc_message ipc; @@ -306,7 +318,9 @@ static void post_update_cmd(struct mg_connection *nc, int ev, void *ev_data) nc->flags |= MG_F_SEND_AND_CLOSE; } -#elif defined(CONFIG_MONGOOSE_WEB_API_V2) +#endif + +#if defined(CONFIG_MONGOOSE_WEB_API_V2) static void restart_handler(struct mg_connection *nc, int ev, void *ev_data) { struct http_message *hm = (struct http_message *) ev_data; @@ -462,14 +476,54 @@ static void *broadcast_progress_thread(void *data) return NULL; } + +static int websocket_count(struct mg_mgr *mgr) +{ + struct mg_connection *c; + int result = 0; + + for (c = mg_next(mgr, NULL); c != NULL; c = mg_next(mgr, c)) { + if ((c->flags & MG_F_IS_WEBSOCKET)) + result++; + } + + return result; +} #endif static void ev_handler(struct mg_connection *nc, int ev, void *ev_data) { +#if defined(CONFIG_MONGOOSE_WEB_API_V2) + static pthread_t bcast_message_thread_id; + static pthread_t bcast_progress_thread_id; + + switch (ev) { + case MG_EV_WEBSOCKET_HANDSHAKE_DONE: + if (websocket_count(nc->mgr) == 1) { + DEBUG("Creating websocket broadcast message/progress threads\n"); + bcast_message_thread_id = (pthread_t)mg_start_thread(broadcast_message_thread, nc->mgr); + bcast_progress_thread_id = (pthread_t)mg_start_thread(broadcast_progress_thread, nc->mgr); + } + break; + + case MG_EV_CLOSE: + if ((nc->flags & MG_F_IS_WEBSOCKET) + && websocket_count(nc->mgr) == 0) { + DEBUG("Canceling websocket broadcast message/progress threads\n"); + + pthread_cancel(bcast_message_thread_id); + pthread_cancel(bcast_progress_thread_id); + + pthread_join(bcast_message_thread_id, NULL); + pthread_join(bcast_progress_thread_id, NULL); + } + break; + } +#endif + if (ev == MG_EV_HTTP_REQUEST) { mg_serve_http(nc, ev_data, s_http_server_opts); } - } static int mongoose_settings(void *elem, void __attribute__ ((__unused__)) *data) @@ -505,7 +559,6 @@ static int mongoose_settings(void *elem, void __attribute__ ((__unused__)) *dat return 0; } - static struct option long_options[] = { {"listing", no_argument, NULL, 'l'}, {"port", required_argument, NULL, 'p'}, @@ -611,21 +664,17 @@ int start_mongoose(const char *cfgfname, int argc, char *argv[]) } #if defined(CONFIG_MONGOOSE_WEB_API_V1) - mg_register_http_endpoint(nc, "/handle_post_request", MG_CB(upload_handler, NULL)); + mg_register_http_endpoint(nc, "/handle_post_request", MG_CB(upload_handler_v1, NULL)); mg_register_http_endpoint(nc, "/getstatus.json", MG_CB(recovery_status, NULL)); mg_register_http_endpoint(nc, "/rebootTarget", MG_CB(reboot_target, NULL)); mg_register_http_endpoint(nc, "/postUpdateCommand", MG_CB(post_update_cmd, NULL)); -#elif defined(CONFIG_MONGOOSE_WEB_API_V2) - mg_register_http_endpoint(nc, "/restart", restart_handler); #endif +#if defined(CONFIG_MONGOOSE_WEB_API_V2) + mg_register_http_endpoint(nc, "/restart", MG_CB(restart_handler, NULL)); mg_register_http_endpoint(nc, "/upload", MG_CB(upload_handler, NULL)); +#endif mg_set_protocol_http_websocket(nc); -#if defined(CONFIG_MONGOOSE_WEB_API_V2) - mg_start_thread(broadcast_message_thread, &mgr); - mg_start_thread(broadcast_progress_thread, &mgr); -#endif - printf("Mongoose web server version %s with pid %d started on port(s) %s with web root [%s]\n", MG_VERSION, getpid(), s_http_port, s_http_server_opts.document_root);