Then I'd use something like https://curlconverter.com/ to convert it into request code of the language I'm using.
In a way curl is like the "intermediate representation" that we can use to translate into anything.
I also use the browser's 'copy as curl' function quite frequently as it's so convenient, having all auth and encoding headers set to _definitely_ work (instead of messing around with handmade, multi-line curl command lines)
> We do not transmit or record the curl commands you enter or what they're converted to. This is a static website (hosted on GitHub Pages) and the conversion happens entirely in your browser using JavaScript.
It would be nice if more sites offered themselves as PWAs that worked when you set "throttling" to "offline" in the dev menu, so that you could ensure that no data is leaving the browser when working with sensitive info.
Eg an HTTP request should have a client header, but they're typically not relevant to what you're trying to do.
curl is like an HTTP request that specifies only the parts you care about. It's brief, and having access to bash makes it easy to express something like "set this field to a timestamp".
HTTP is more flexible than "Copy as cURL". There are things that can be done with HTTP that cannot be done with cURL.
See: https://github.com/curlconverter/curlconverter.github.io/blo...
[1] https://github.com/dotnet/Open-XML-SDK/releases/tag/v2.5
You'd simply run:
CURL url: "https://example.com" method: 'post
in an interactive system, that can either represent your shell, or your application code. We need --libcurl because UNIX is not an interactive environment, so there is an enormous abyss between runtime and compile time.(Syntax in this example from a Smalltalk-like environment I have been designing, should be understandable enough)
---
1: "An operating system is a collection of things that don't fit in a language. There shouldn't be one." — Dan Ingalls, 1981
Invoke-WebRequest -Method 'Get' -Uri 'https://example.com'
And the response is a typed object:That you can pipe properly by piping objects not strings, e.g. :
Invoke-WebRequest -Method 'Get' -Uri 'https://example.com' | Select-Object -ExpandProperty Headers
Outputs: Key Value
--- -----
Age 438810
Vary Accept-Encoding
X-Cache HIT
Content-Length 1256
Cache-Control max-age=604800
Content-Type text/html; charset=UTF-8
Date Mon, 29 Jan 2024 15:08:42 GMT
Expires Mon, 05 Feb 2024 15:08:42 GMT
ETag "3147526947+ident"
Last-Modified Thu, 17 Oct 2019 07:18:26 GMT
Server ECS (nyb/1D15)Too bad we're stuck with UNIX/POSIX model - you could even take this idea of exported data structures and have the terminal represent data in the preferred users format instead of having tools like jq.
curl https://ifconfig.me --libcurl ip_fetcher.c
# Output: your ip address, and a file ip_fetcher.c
gcc -o ip_fetcher ip_fetcher.c -lcurl
# Output: no errors, just a file ip_fetcher
./ip_fetcher
# Output: your ip address
(I'm sure most people are saying "no duh" right now, but I'm probably not the only one on here who doesn't write C code every day!) $ curl https://ifconfig.me --libcurl ip_fetcher.c
$ make LDFLAGS=-lcurl ip_fetcher
$ ./ip_fetcher
(I just find make a heck of a lot easier than running direct cc commands)We use libcurl for the super reliability and top features (HTTP/3 for instance) and we've added little features like:
- requests chaining,
- capturing and passing data from a response to another request,
- response tests (JSONPath, XPath, etc...)
There is nice syntax sugar for requesting REST/SOAP/GraphQL APIs but, at the core, it's just libcurl! Using verbose option, you can grep the curl commands for instance. (I'm one of the maintainers)
[1]: https://hurl.dev
Thanks for your work
It was a multi-day process and every time like two days in I'd hit some snag.
But yes, perhaps as a follow-up, we would need to ask for
1. a speed-up of the process or
2. find a way to look up and redistribute existing conversion flows
They are deterministic tools which does what you want in a battle tested way, and will let me sleep well at night, which is an underappreciated feature of mature programs.
So 'quinino' might work here.
curl-as-librucl https://www.example.comso this isn't a new trend...
Possibly via the Eclipse extension: https://marketplace.eclipse.org/content/bytecode-outline
Rust-evangelism aside, I guess one can run the program under ltrace to achieve almost the same result.
Assuming (as usual) that the code generation is solid because of curl’s reputation: why not trust it? It would be pretty bad if the generator could emit memory-unsafe code. (I don’t know.)
It’s the consumer of this tool and all the code around it that will get written I don’t trust.
Fair point about memory allocations in C, but often alt languages rely on other people's code which you'd implicitly trust to do the same thing. So then it becomes an argument of testing and trust. All the same, you trust strangers code or you write your own.
Stabilisers for some, but definitely not others.
—-libcurl example.py