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 5522 invoked from network); 17 Dec 2020 09:35:11 -0000 Received: from ewsd.inri.net (107.191.116.128) by inbox.vuxu.org with ESMTPUTF8; 17 Dec 2020 09:35:11 -0000 Received: from mail.typed-hole.org ([199.247.9.36]) by ewsd; Thu Dec 17 04:33:13 -0500 2020 Received: from mail.typed-hole.org (localhost [127.0.0.1]) by mail.typed-hole.org (OpenSMTPD) with ESMTP id c4522477 for <9front@9front.org>; Thu, 17 Dec 2020 09:33:06 +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=xya5S1x9 1tUBt9xQvpWGx3OjUAc=; b=0cJ9/Zt+/nBJxrzyk1wB+0v76uMtjoBtXabgozGf 0bYHNKULWL3KjCREoRbwhSszS7wpFrkfINz2nkLwUS0Kc/tTNjP4xo4REipX1XTy kc4qV8bFhT2zFgI8c7+dLZ70+ll/KduZh4lSxwM1G3XbAfltEq6QKFju91QcxFvg 6hjFLaHiiaB4YgLrUY27Y0FAzXzMQ8/eU/WHWUSn6b5dmSXKpcIhITnASyv/ELQi ea7XzS/Xu3Ys/eZ9i+1B95g/PCqezcGAEce3VCkeM353wmCthZ79s+yUa9QpsqtQ AdGDB43w6MNq1jyJeZBUozAlb/+4coSchIr9wNIimHb3aw== 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=bF YGoeUR1t6jKxd3GKn3UlxSNUQ4Bza8O+4YL6CEKMGd41pC7OBvsvUrzKUrD7A7Ne /0SW2Zl9zaqmQCW/T8u44JMoR4/uQOnY7FYtmK5Do/HzQFaUdJ0GqJVRGreEm3Al zOK3hC0GCgfCGFpSHqxX3Dm1iKBwqCz/PgoDFtcXrbk2haCPfKqHeZCof8zwDoOk 3hsx0KWw6Th8i/8GSS34Wkte1yFkFDD9vKpgrIB6muamuXtLQ/601VQt1u8PDNdP 7OIH4Urq7LVmippZs3g4zzTnZiiQ7E/b40/ldxL8gdhQYg+/uEh4e8opNRTRKhbw OTFjFzP4sTvyR1elGwwQ== 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 7b6c2593 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO) for <9front@9front.org>; Thu, 17 Dec 2020 09:33:06 +0000 (UTC) To: 9front@9front.org References: <2b7ef049-b2ea-46ab-9630-d6bdba2000a3@sirjofri.de> From: Julien Blanchard Message-ID: Date: Thu, 17 Dec 2020 10:33:05 +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: compliant dependency cloud Subject: Re: [9front] [PATCH] Update hpost to use -r header like hget Reply-To: 9front@9front.org Precedence: bulk Thanks a lot everyone for the explanations! It allowed me to quite simplify the patch. 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 09:30:35 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 ] headers [ -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 09:30:35 2020 +0000 @@ -38,6 +38,9 @@ .B -m .I action ] [ +.B -r +.I header +] [ .B -u ] .I url