Should I use curl-crystal or net/http ?
waghanza opened this issue · 5 comments
Hi,
I want to open a debate (no troll
plz) to answer a simple question
- should I use
curl-crystal
or built-innet/http
?
I want to focus on security / performance, no matter who coding is difficult.
Regards,
PS : @blocknotes sorry if it's not the right place to ask this
curl-crystal is not concurrent, it blocks crystal main thread, so it hard to run multiple requests at the same time (or even use it with http server or something). Surely builtin lib is much better, because allowed big concurrency (but it quite limited, no proxy, no socks, no redirects, no sessions, no some more features that curl have). For concurrency with curl-crystal i use: https://github.com/kostya/curl-downloader#example-with-thread_pool-to-execute-request-in-the-background-and-not-to-lock-crystal-main-thread, but it quite hack, and have problems with segfaults.
to summarize, curl-crystal
is performant and recommanded if, and only if you do not need concurrency.
to be factual, I want to create a CLI to (so no need of concurrency), so curl-crystal
is well chosen, in this use case, right ?
if you have only one request per time and no background things, so this lib if fine. i create simple wrapper for this lib: https://github.com/kostya/curl-downloader