No additional params are required, but you have to do them all in the same call, just like it’s documented.
Whether the requests will be performed concurrently is dependent on the server, i.e. HTTP/2 enabled servers can receive multiple requests at the same time, and HTTP/1.1 servers supporting pipeline as well.
Concurrency is therefore protocol-dependent, and httpx
will not support distributing M requests over N connections on the same pool. If the server you’re requesting to doesn’t fit the criteria above, check Connection Pools.
No. httpx
handles the complexity for you, so you just need to assign HTTPX.plugin(:persistent)
to a variable, and this can be used in any context.
httpx
does maintain per-session connection pools however, meaning that, if you’re using multiple threads, connections to the same origin server will be managed in a thread-safe manner.
You can troubleshoot that by enabling the logs, where information of DNS requests, TLS handshake and connection state transitions will be displayed.
You must disable it in the ALPN negotiation:
HTTPX.with(ssl: { alpn_protocols: %w[http/1.1] }).get("https://example.com")
This library does HTTP only, and will not support other protocols. Ever. There is only one cURL :) .
Next: home