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.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,NICE_REPLY_A,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 17936 invoked from network); 17 Dec 2020 11:25:33 -0000 Received: from ewsd.inri.net (107.191.116.128) by inbox.vuxu.org with ESMTPUTF8; 17 Dec 2020 11:25:33 -0000 Received: from mail.typed-hole.org ([199.247.9.36]) by ewsd; Thu Dec 17 06:23:34 -0500 2020 Received: from mail.typed-hole.org (localhost [127.0.0.1]) by mail.typed-hole.org (OpenSMTPD) with ESMTP id cb7e27ea for <9front@9front.org>; Thu, 17 Dec 2020 11:23:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=typed-hole.org; h=subject :to:references:from:message-id:date:mime-version:in-reply-to :content-type:content-transfer-encoding; s=20190925; bh=QpYBVK5F 8GROe5SRCz1JmCw1OHk=; b=XnN9JGsD1VVZ9aKYnc0tsSBghd1LnOQX3E6XpMAQ HJXCycoAsRn7zO/LZCmXPgdTk6As6LY50tRUrHBMzn+wtDxvW0jNEUSGuIPZyn7O yKJhUmB7SFDY0Syrr7BquhbZPW3pQRzaeRCDAvklb6GiPserhvubktZHEwxxYG4T aJyQXKrqfHJVxQhA3EOVv27Kv+qAiy5ug9wld0GAwqdtRaexrGJBEovQsa0DZgRE mOHAu8l9BCQsLP6ZtVYBS41mcTewjaVg43wup8BFPxgnkeNfiEL5/d/oyTtMSapq KkrpAWSoGvlsvcB03SO4r3pjNHqoM43soIhsAbwr5sLpzw== DomainKey-Signature: a=rsa-sha1; c=nofws; d=typed-hole.org; h=subject:to :references:from:message-id:date:mime-version:in-reply-to :content-type:content-transfer-encoding; q=dns; s=20190925; b=ar 1tJ6ZHM1TubxqJZQp2MIGb6EBwn6jBr3szCdflrO42yO4fCQjhArmI7a81pWiLmt piDikXAGfeu9EwGGueCyr/BDUPWgd0o37cGMWdmh1yjbXmyADiIptHWq2q+C1oWJ LdZp7hCO4SieRn+oc9MCSv/yzfXyfdwRAYFton7bOo93TMxlu3xhFoiVd/zAx9RL HNY19VPlZ0M2/oJPBzJTwinTSEz7RLm9QLvooP6ANAhld5XIvPWnAEiBNhB7HD/E nsWwBYuvNdlaGUoHLTH1CfWWO0utFu0R361VGC0MqM3PoNdNy17TJRu5EIPs1aID t9ze4n4fAWobGrqmBKyA== 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 54ea04da (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO) for <9front@9front.org>; Thu, 17 Dec 2020 11:23:27 +0000 (UTC) To: 9front@9front.org References: From: Julien Blanchard Message-ID: <86bfe558-a375-62d0-5116-94f0189b93d9@typed-hole.org> Date: Thu, 17 Dec 2020 12:23:27 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: 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: overflow-preventing progressive service content-driven controller Subject: Re: [9front] [PATCH] Update hpost to use -r header like hget Reply-To: 9front@9front.org Precedence: bulk On 17/12/2020 11:30, Alex Musolino wrote: >> fn usage { >> - echo 'usage: hpost [ -l ] [ -[gpm] action ] [ -u ] url [ field:value | >> field@file ... ]' >[1=2] >> + echo 'usage: hpost [ -l ] [ -[gpm] action ] [ -r ] headers [ -u ] url >> [ field:value | field@file ... ]' >[1=2] >> exit usage >> } > > I think this bit should be: > > 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 > } > > This matches the man page and the usage string from hget(1). Also, it > wouldn't hurt to amend the man page to mention that the -r option can > be repeated. > Good idea, here's the updated diff: diff -r ac35c963f8e2 rc/bin/hpost --- a/rc/bin/hpost Sun Dec 13 20:23:03 2020 +0100 +++ b/rc/bin/hpost Thu Dec 17 11:21:32 2020 +0000 @@ -1,12 +1,15 @@ #!/bin/rc rfork e url=() +headers=() +action=() +method=() 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 +17,7 @@ switch($1){ case -l; l=($l $1) case -u; shift; url=$1 + case -r; shift; headers=($headers -r $1) case -g; shift; action=$1; method=mget case -p; shift; action=$1; method=mpost case -m; shift; action=$1; method=multi @@ -94,8 +98,9 @@ menc $"f | $hget -r 'Content-Type: multipart/form-data; boundary='$"f -b $url -P $action } + if(! ~ $action ''){ - hget=(hget $l) + hget=(hget $headers $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 Thu Dec 17 11:21:32 2020 +0000 @@ -38,6 +38,9 @@ .B -m .I action ] [ +.B -r +.I header +] [ .B -u ] .I url @@ -119,6 +122,9 @@ .B -r sends an arbitrary HTTP .IR header . +The +.B -r +flag can be repeated to send multiple headers. .PP Option .B -m