From patchwork Mon Oct 11 11:21:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 1539246 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.a=rsa-sha256 header.s=20210112 header.b=Kfh939Fp; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:4864:20::139; helo=mail-lf1-x139.google.com; envelope-from=swupdate+bncbcxploxj6ikrb6v4scfqmgqeftpqzfa@googlegroups.com; receiver=) Received: from mail-lf1-x139.google.com (mail-lf1-x139.google.com [IPv6:2a00:1450:4864:20::139]) (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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4HSbxV3D2Mz9sRN for ; Mon, 11 Oct 2021 22:22:38 +1100 (AEDT) Received: by mail-lf1-x139.google.com with SMTP id bq35-20020a056512152300b003fd45087a72sf12473078lfb.9 for ; Mon, 11 Oct 2021 04:22:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1633951354; cv=pass; d=google.com; s=arc-20160816; b=BFsIRbzL7RYfJsmFlEa4ZoAMsfbVfPobltc6AdUCFSFZ53tJKJE+qzOUp6Hy//sweB ARDikVa5ie+mS7f6X8eUucGRBtFFbLdwT4BwbkR+XlK5CJ7uABd0XENLKW2HmU8ngOOU gzgyXaqDgPJoK5Lry9WTAtGKksjc4bBKadp0OZbQ5YMVYoeD95+48Wu4nr89kuLTzN/s +sVlCAKXxQm4Zi/TGiwRxPdkleYKWlRvhXz2xH171/jDO2kLlkUcuFq0DMtKzvQ6pyfd oqL1CX8DcCwyFgNCmHnQSDvMX1/pRjJv8JWz+atnzqePicotOE6UJzX5R/VBCdEo2RcZ QVEg== 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:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:dkim-signature; bh=wfH4uno3ngDroq8txFuzGFMoaa7DwcxRv0PW8dG0UaY=; b=RW8oQ6ayszlOjb8YU32Dz2hxqP7BTgF6YhBjuiF8fsq1QdwfJqH68imzRFUDl3nXj8 bxI/Romnc60XGquPtaCXHf4Cq6GzWWtaXmKyuWn9Hym4HM/fnoO8AlMADnx8SoGB/ttT a0+0Q7xUo3ef6Ab4UEioZR/iSHYX2kDdRJwKW4dzULiX4z3kOqxbZKcmOWLaBw7P+mIB ltT7728bXj2Pm0JvCbCFRlU6Cd9D/mDzDWIDLC5W6/OddpHp1B9gOgn11pWI1/8fu6Y0 IXcy+lY5owb6pHXLQvXbcTfJdu3iM2qXSWlwpskHNIE8cjITzqYbGESedo+FOHrPcynl 13yA== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=neutral (google.com: 2001:a60:0:28:0:1:25:1 is neither permitted nor denied by domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=wfH4uno3ngDroq8txFuzGFMoaa7DwcxRv0PW8dG0UaY=; b=Kfh939Fpw0GHy33/q4i2LGg+rfv+Wq39dlE9VpaKRsZvQgS9X/5XYsU2Evoc510o9b HZRWEHWbhFjDr2ECMhpLXKh2Bpxg1mVEVb6FSrZFSBKZk17NO5KpJ0Mv5D5LmAttvWHV AOTrlpR+PLU897Zuw+u3RD+OOBZSVJAdqJwRGWlkxqbQo2K2YyLRfZS6vuwsKG3R1etA 3XS/TnIR016wD9A2w/Y+/sgen6uqNe03GKAg6bDFuO8akdPRszGo7MguSwF0JBgUjOtg ECCKIoErYZbkMcgYHmCzeIcgL3KPcelpuBWFCQVhd21+N9bEQtMTDYs3MiFgIDcYwFct 4V8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=sender:x-gm-message-state:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version: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=wfH4uno3ngDroq8txFuzGFMoaa7DwcxRv0PW8dG0UaY=; b=64Wg6iWopzPtLqyLEDm9/ioaMIJTPSimKDaomQUS1JJzBp5R1f0U3/cE4CJoohQEt1 rd8pdotmt7A5Fu4TFvwwFTgUL59wMmD+DHMqYYYpJIlDflIOx9Yakij/ApZLjZ3IkQ9d jB82YfZragpXevQFX2LgjmZDlUSL8f3y0xgmkf9yQq7Nw87YdYKTDQWQ2GmH4MK8OXrG I59cq4g8DPbrtjLOmzTHXwhmuWflh+1UG3SqXYb1IA4U+2eoaVlDXdJqBZaADKu1Mio6 gcvP+sgDk93Idzy1TnWfJMtK8ukDHGTD6Hoo/VS5diz/ZFZAJniJQoTjE3JGxANmPrFO rW4A== Sender: swupdate@googlegroups.com X-Gm-Message-State: AOAM532y70WzeAXD/gVWdRt2T+aoCp2ToUEk4jG4LZSfSG7mWSVI8/Lq We7fDqD2Os2OBhUKeFR1rU0= X-Google-Smtp-Source: ABdhPJw77gF7znBpr9jRumuk+ENFlid/wrTQ5gO4VWUNso+4FdPX1sG+TmDG9mAgGzc16mPypBo+Wg== X-Received: by 2002:a05:6512:3da8:: with SMTP id k40mr26597250lfv.44.1633951354358; Mon, 11 Oct 2021 04:22:34 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a05:6512:3994:: with SMTP id j20ls91921lfu.3.gmail; Mon, 11 Oct 2021 04:22:33 -0700 (PDT) X-Received: by 2002:a19:c70b:: with SMTP id x11mr27836347lff.57.1633951353626; Mon, 11 Oct 2021 04:22:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633951353; cv=none; d=google.com; s=arc-20160816; b=kqOYTNbAv5vLmBs1qvyVObvd3uSYYcD+bWoCBjtWr5NA0ZrVXiGOB5y8mscmg5YBdp jaCQWv+SMfjJgH2nbZYNbO4wSgfAYfdaQa9qk2q5YAl4aMJWlMf0+MEx9zP3UW6xOXy8 afJ/BKj5OfJEGoa4NJBnVUszVbcPGH3c3aQX/QbNXdNmaodK7o2w4CjALdIbtCD89eI6 WV1/0Ptn6zxEl/Ra+g1d4LNJGR5ZpH7bNF9Y35m2rsh5/GLDDq3B8VRoEekVt2TwWVzF 96ADGNQONBmlwnoEypECqU6+OkHJYB84YRiHGcvKY8ZchrTVp0gnV3b6zYwtesRt2UIH oyJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=vQdv0Rc/SPqsHn5WbhAd8UHcHGrHPFGBAejLvH6aLN8=; b=ZYBqwDowXkxcbis39b/1OIp6lBq3KswBRfoz/PLZCWqFsMUvwcUCfluioLVBCOCBCj 7Bk8SMsOTeg735I8I/gryJYwq8nyFs1tREv2/NuytwjMNZcblbMz9SB65pgvXOUlPy68 gS9TqN9gKqhFTWKWS5w4qvH3IJAJhMD5QClYQgCOtlt9yERiVwDq7q4T7wu89KtK3A8n nG6gvkjO1gH+8kIPB08hHy7QDEPAtFiKH0BWhil8FUsk7kMW859LOvBo/45fEhyIEXjS /aiR6NWPADSqNGSDy4564e3b7zL6jWln5kB7fBWtAlqMySeC7j5SSOuYdZoJ9YBj+p/L tz6g== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=neutral (google.com: 2001:a60:0:28:0:1:25:1 is neither permitted nor denied by domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de Received: from mail-out.m-online.net (mail-out.m-online.net. [2001:a60:0:28:0:1:25:1]) by gmr-mx.google.com with ESMTPS id v25si484401lfr.1.2021.10.11.04.22.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Oct 2021 04:22:33 -0700 (PDT) Received-SPF: neutral (google.com: 2001:a60:0:28:0:1:25:1 is neither permitted nor denied by domain of sbabic@denx.de) client-ip=2001:a60:0:28:0:1:25:1; Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 4HSbxP17P4z1sByw; Mon, 11 Oct 2021 13:22:33 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 4HSbxP0xhpz1qqkD; Mon, 11 Oct 2021 13:22:33 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id bx57dsHL54Fz; Mon, 11 Oct 2021 13:22:32 +0200 (CEST) Received: from babic.homelinux.org (host-88-217-136-221.customer.m-online.net [88.217.136.221]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPS; Mon, 11 Oct 2021 13:22:32 +0200 (CEST) Received: from localhost (mail.babic.homelinux.org [127.0.0.1]) by babic.homelinux.org (Postfix) with ESMTP id DCDEF4540BF1; Mon, 11 Oct 2021 13:22:31 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at babic.homelinux.org Received: from babic.homelinux.org ([127.0.0.1]) by localhost (mail.babic.homelinux.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fNIbTJZhAnM5; Mon, 11 Oct 2021 13:22:29 +0200 (CEST) Received: from paperino.fritz.box (paperino.fritz.box [192.168.178.48]) by babic.homelinux.org (Postfix) with ESMTP id 04E18454272C; Mon, 11 Oct 2021 13:22:06 +0200 (CEST) From: Stefano Babic To: swupdate@googlegroups.com Cc: Stefano Babic Subject: [swupdate] [PATCH 18/29] channel_curl: add the possibility to request a range Date: Mon, 11 Oct 2021 13:21:45 +0200 Message-Id: <20211011112156.44192-19-sbabic@denx.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211011112156.44192-1-sbabic@denx.de> References: <20211011112156.44192-1-sbabic@denx.de> MIME-Version: 1.0 X-Original-Sender: sbabic@denx.de X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 2001:a60:0:28:0:1:25:1 is neither permitted nor denied by domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de 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: , This allow to set a range request for a file to be downloaded. Signed-off-by: Stefano Babic --- corelib/channel_curl.c | 9 +++++++++ include/channel_curl.h | 1 + 2 files changed, 10 insertions(+) diff --git a/corelib/channel_curl.c b/corelib/channel_curl.c index abe252c..bed631b 100644 --- a/corelib/channel_curl.c +++ b/corelib/channel_curl.c @@ -757,6 +757,15 @@ channel_op_res_t channel_set_options(channel_t *this, channel_data_t *channel_da } } + if (channel_data->range) { + if (curl_easy_setopt(channel_curl->handle, CURLOPT_RANGE, + channel_data->range) != CURLE_OK) { + ERROR("Bytes Range could not be set."); + result = CHANNEL_EINIT; + goto cleanup; + } + } + cleanup: return result; } diff --git a/include/channel_curl.h b/include/channel_curl.h index 7d1e892..4409dca 100644 --- a/include/channel_curl.h +++ b/include/channel_curl.h @@ -79,5 +79,6 @@ typedef struct { struct dict *headers_to_send; struct dict *received_headers; unsigned int max_download_speed; + char *range; /* Range request for get_file in any */ void *user; } channel_data_t;