9front - general discussion about 9front
 help / color / mirror / Atom feed
From: estevan.cps@gmail.com
To: 9front@9front.org
Subject: Re: [9front] [PATCH] Update hpost to use -r header like hget
Date: Wed, 16 Dec 2020 19:54:38 +0000	[thread overview]
Message-ID: <6BAA5569E9ABF35DB2A737153B02C8A6@gmail.com> (raw)
In-Reply-To: <b13de105-af36-76fd-af65-e697264ae3f7@typed-hole.org>

Hello,

> I had issues with just expanding the headers using -r^headers. It 
> generates an hget command like (just an echo before line 98):
> 
> hget -rX-Foo: Lol -rAuthorization: Bearer Token -r Content-Type: 
> multipart/form-data; boundary=HJBOUNDARY -b https://httpbin.org -P /post

The output from that echo is likely misleading, "-rX-Foo: Lol", for example, has a space in it but is passed as a single argument to the program; you'd probably be better off testing that sort of stuff with something that shows arguments separately (unless you're aware of the implications of echoing it and don't care); the following could be helpful:

#!/bin/rc

for(i in `{seq 0 $#*})
	echo $i: $*($i)

> where a valid hget command would be:
> hget -r 'X-Foo: Lol' -r 'Authorization: Bearer Token' -r 'Content-Type: 
> multipart/form-data; boundary=HJBOUNDARY' -b https://httpbin.org -P /post

That's rather inconsistent with, i.e. how arg(2) would parse flags though; (unless I'm overlooking something probably really simple) it probably should handle the argument to the flag whether it is in the same "argv-argument" or not. That can probably be achieved by rewriting hget (and hpost, for that matter) to use something like getflags(8), but that would probably require a patch to getflags to handle "variadic flag arguments" (so multiple -r flags would add the contents to a list instead of overwriting them in turn like it would do now). Could probably sketch something a little bit later (maybe someone has something to add as well?).

Hope that's helpful,

--
Tevo


  parent reply	other threads:[~2020-12-16 19:55 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-15 18:02 Julien Blanchard
2020-12-15 18:42 ` ori
2020-12-16 18:16   ` Julien Blanchard
2020-12-16 18:51     ` sirjofri
2020-12-16 19:50       ` ori
2020-12-16 21:34         ` sirjofri
2020-12-16 21:52           ` ori
2020-12-16 22:55             ` sirjofri
2020-12-16 23:13               ` Steve Simon
2020-12-17  9:33                 ` Julien Blanchard
2020-12-17 10:30                   ` Alex Musolino
2020-12-17 11:23                     ` Julien Blanchard
2020-12-18  4:35                       ` ori
2020-12-16 19:54     ` estevan.cps [this message]
2020-12-18  2:25 ` magma698hfsp273p9f

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6BAA5569E9ABF35DB2A737153B02C8A6@gmail.com \
    --to=estevan.cps@gmail.com \
    --cc=9front@9front.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).