From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, RCVD_IN_DNSWL_NONE autolearn=no autolearn_force=no version=3.4.4 Received: (qmail 26895 invoked from network); 15 Dec 2020 18:03:09 -0000 Received: from ewsd.inri.net (107.191.116.128) by inbox.vuxu.org with ESMTPUTF8; 15 Dec 2020 18:03:09 -0000 Received: from mail.typed-hole.org ([199.247.9.36]) by ewsd; Tue Dec 15 13:02:37 -0500 2020 Received: from mail.typed-hole.org (localhost [127.0.0.1]) by mail.typed-hole.org (OpenSMTPD) with ESMTP id 33d6a38d for <9front@9front.org>; Tue, 15 Dec 2020 18:02:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=typed-hole.org; h=to:from :subject:message-id:date:mime-version:content-type :content-transfer-encoding; s=20190925; bh=jliE8OhZ5HtPdAby7hL+9 fBR58g=; b=EiVdJ5/JUPHDZCARGV3GJ58S6tzvZmJlplAQyD/kcGOFNftQLfhJZ P0B/V8/KPfmxuY8EBP4wke6x6+C74MVMV5wGUIwNb0YN9U3yiqjpZf48zA2Bd+cN avvaqRjiMxoK8UZoj19Xhl+xWCDVBvf1Hmuu5L5MedOUo395X/2ZAxU+MufXkSa2 7tcR56/hwPcfL7IjwRBewFrQ5+j8lXf+1eWp8tNVLFMEFQeGLX6QkHbWcCHcf4++ sQl01cWCSJaozZiFyeGjPa72hzJ5SiZMxIaE/Jukfby7YFAJKjN1S7XezD6ko5tD gj4bG37yPL5NhIf3pKW1HUQi1HeVE18Vw== DomainKey-Signature: a=rsa-sha1; c=nofws; d=typed-hole.org; h=to:from :subject:message-id:date:mime-version:content-type :content-transfer-encoding; q=dns; s=20190925; b=yLSqj08wIA+yj8p 3DS6rsgXsaCJvO1a4tH32R7dW6IFeFauczVnWzd3dDd9sEd7LIKMvdHhlgLKcBRL 4+yScKMqg13HF9ysYMe6+DfDe0odQ3Lxx/CnfbeEUqUbYMjBkQBuUwSKwoXr0FIw txMgansEu6Kh/LGFMa3wKKnT46rZAN4NyzS1HcSXlx5ixhlSXXwif+0CFyxl6ppB pfaCJ5A8dHs1l8ap7eHhefPrw7T/Cq2/gaQht1mgjr04nLgSGK8qp7YZWEozaq4z 0ciOJBhsLu/7ftM3CXNm2i1cXNt3bPBv8gLrP/49iaMFg0jna5VnYBUjgfvttwSf g8kRv7g== Received: from [192.168.0.11] (87-231-19-8.rev.numericable.fr [87.231.19.8]) by mail.typed-hole.org (OpenSMTPD) with ESMTPSA id ef1cef16 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO) for <9front@9front.org>; Tue, 15 Dec 2020 18:02:30 +0000 (UTC) To: 9front@9front.org From: Julien Blanchard Message-ID: <5bae97d5-c808-7faf-c0f3-2dfcdfabbfa1@typed-hole.org> Date: Tue, 15 Dec 2020 19:02:29 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: progressive just-in-time lifecycle AJAX over ActivityPub deep-learning replication Subject: [9front] [PATCH] Update hpost to use -r header like hget Reply-To: 9front@9front.org Precedence: bulk Hello, This is a small update to hpost which allows the use of a -r header option just like in hget. I had the need when trying to push a file to an API which also needed an authorization header. It's the first time I write some not trivial rc script so maybe there is a better way to add this option. After quite some testing it looks like it works at least :) Cheers, julienxx diff -r ac35c963f8e2 rc/bin/hpost --- a/rc/bin/hpost Sun Dec 13 20:23:03 2020 +0100 +++ b/rc/bin/hpost Tue Dec 15 17:45:26 2020 +0000 @@ -1,12 +1,13 @@ #!/bin/rc rfork e url=() +header=() at=() # text fields af=() # file fields l=() fn usage { - echo 'usage: hpost [ -l ] [ -[gpm] action ] [ -u ] url [ field:value | field@file ... ]' >[1=2] + echo 'usage: hpost [ -l ] [ -[gpm] action ] [ -r ] header [ -u ] url [ field:value | field@file ... ]' >[1=2] exit usage } @@ -14,6 +15,7 @@ switch($1){ case -l; l=($l $1) case -u; shift; url=$1 + case -r; shift; header=$1 case -g; shift; action=$1; method=mget case -p; shift; action=$1; method=mpost case -m; shift; action=$1; method=multi @@ -95,7 +97,10 @@ } if(! ~ $action ''){ - hget=(hget $l) + if(~ $header '') + hget=(hget $l) + if not + hget=(hget -r $header $l) $method exit } diff -r ac35c963f8e2 sys/man/1/hget --- a/sys/man/1/hget Sun Dec 13 20:23:03 2020 +0100 +++ b/sys/man/1/hget Tue Dec 15 17:45:26 2020 +0000 @@ -38,6 +38,9 @@ .B -m .I action ] [ +.B -r +.I header +] [ .B -u ] .I url