Would it be useful if #curl provided a default random variable?
Exploring this little idea here. Good? Bad?
github.com/curl/curl/pull/1381…
curl: offer a default 'random' variable by bagder · Pull Request #13813 · curl/curl
... and two new output functions: uuid and hex The variable holds a 128 bit semi-random value. Output it like {{random:hex}} to get it all as a 32 byte hex sequuence {{random:uuid}} shows it as a ...GitHub
Dr. Quadragon ❌
in reply to daniel:// stenberg:// • • •What's wrong with this?
```
uuid=$(uuidgen)
curl -x POST -h "$uuid" example.com
```
Example Domain
example.comdaniel:// stenberg://
in reply to Dr. Quadragon ❌ • • •@drq I suppose one answer could be:
$ uuidgen
bash: uuidgen: command not found
iliazeus
in reply to daniel:// stenberg:// • • •tokudan
in reply to daniel:// stenberg:// • • •Or am I misunderstanding this part?
daniel:// stenberg://
in reply to tokudan • • •tokudan
in reply to daniel:// stenberg:// • • •Stefan Eissing
in reply to daniel:// stenberg:// • • •@tokudan In the test cases, I use a url query param for request id using url globbing. That works fine in a test server, as it only has one client.
To correlate against a real server, you‘d need a more unique id, as it may serve many clients, either parallel or over time. (for parallel, timestamps in logs are of little help)
The proposed random would help when used together with the XFER_ID to make a likely globally unique request id.
petur 🔵😶
in reply to daniel:// stenberg:// • • •xkcd.com/221/
Random Number
xkcdiliazeus
in reply to daniel:// stenberg:// • • •I think that there either should be proper variable support a la Postman or other tools, or none at all.
Like, the next thing a user would probably want is to use two _different_ random variables (so no "holds fixed content"), but use both twice (so just returning different values each time won't satisfy this either).
Or a user (assuming the same HTTP API testing use case) would probably want to preserve these values in a sort-of session - to send several requests with the same random user id, for example.
daniel:// stenberg://
in reply to iliazeus • • •iliazeus
in reply to daniel:// stenberg:// • • •oof, sorry, should've read the man page before posting. In my defense, curl does _a lot_ of thing, and I don't know most of it.
I would still argue against the "holds fixed content" part - as far as I understood, you will be able to do --variable 'id={{random}}' to achieve that, and supporting several different random values in a request is still a useful thing.
daniel:// stenberg://
in reply to iliazeus • • •iliazeus
in reply to daniel:// stenberg:// • • •Michael Boelen
in reply to daniel:// stenberg:// • • •Helio Loureiro
in reply to daniel:// stenberg:// • • •yuki - queen of the snow
in reply to Helio Loureiro • • •daniel:// stenberg://
in reply to yuki - queen of the snow • • •Helio Loureiro
in reply to daniel:// stenberg:// • • •Thibault D.
in reply to daniel:// stenberg:// • • •