Skip to main content

Crate rsurl

Crate rsurl 

Source
Expand description

rsurl — a pure-Rust implementation of curl.

Top-level entry points:

  • HTTP/HTTPS — get, request, or Request / Response directly.
  • Any supported scheme — transfer, which dispatches to the right protocol backend and returns the payload as raw bytes.

Re-exports§

pub use crate::multi::EasyId;
pub use crate::multi::Multi;
pub use crate::net::Client;
pub use crate::websocket::WebSocket;
pub use crate::websocket::WsClose;
pub use crate::websocket::WsEvent;
pub use crate::websocket::WsFrame;
pub use crate::websocket::WsMessage;
pub use crate::websocket::WsOpcode;
pub use crate::websocket::WsReader;
pub use crate::websocket::WsShutdown;
pub use crate::websocket::WsWriter;

Modules§

aio
Experimental async HTTP client over the sans-IO stack.
bittorrent
BitTorrent support: load metadata from a .torrent file or magnet: link, discover peers (HTTP/UDP trackers, DHT), exchange pieces over the peer wire protocol, verify and write data, and optionally seed.
dict
DICT protocol (RFC 2229).
ffi
C ABI for rsurl.
file
file:// URL support (RFC 8089, formerly RFC 1738).
ftp
FTP and FTPS support.
gopher
Gopher and Gopher-over-TLS support (RFC 1436 + the TLS extension).
http2
HTTP/2 support (RFC 9113), with HPACK header compression (RFC 7541).
http3
HTTP/3 support (RFC 9114), with QPACK (RFC 9204) over QUIC (RFC 9000).
imap
IMAP and IMAPS support.
ldap
LDAP and LDAPS support.
mqtt
MQTT and MQTTS support.
multi
Concurrent multi-transfer driver — a thread-backed analogue of curl’s “multi” interface.
net
Pluggable network transport.
pool
Process-wide idle-connection pool for HTTP/1.1.
pop3
POP3 and POP3S support.
resume
Shared partial-download format for resumable transfers.
rtsp
RTSP support (RFC 7826, also RFC 2326 for RTSP/1.0).
ssh
SSH transports: SFTP (sftp://) and SCP (scp://), download and upload.
tftp
TFTP support (RFC 1350, plus RFC 2347 option extension, RFC 2348 blksize, RFC 2349 timeout/tsize).
tls
TLS support, with a pluggable backend.
websocket
WebSocket support (RFC 6455).

Structs§

BodyReader
A streaming reader over an HTTP response body, returned by Request::send_reader. Implements std::io::Read; the head (status + headers) is available up front via BodyReader::head and the accessor methods.
CancelToken
A clonable cancellation handle. Clones share one underlying state, so cancelling any clone cancels them all.
Cookie
One parsed cookie. expires is a Unix epoch second; None means a session cookie (lives only for this rsurl invocation, never persisted).
CookieJar
Bag of cookies. Cheap to clone in tests; threaded by &mut through the redirect chain in crate::Request::send_with_jar.
ProxyConfig
Where to route HTTP(S) traffic through. Parsed from a curl-style proxy URL — typically http://user:pass@host:port. Only http:// proxies are supported in this milestone; TLS-to-proxy (https://) and SOCKS are rejected with Error::UnsupportedScheme.
Request
An HTTP request being constructed.
Response
A complete HTTP response.
ResponseHead
The status line + headers of a response, delivered before the body in the streaming API (Request::send_streaming). A browser uses this to apply policy and choose a parser before any body byte arrives.
Timing
Per-phase wall-clock timings for --write-out (%{time_connect} etc.), each measured from the start of the (final) request attempt.
TlsInfo
Negotiated TLS parameters for an HTTPS response — what argus-security needs for the security indicator and headless CDP SecurityDetails.
Url
Minimal parsed URL. Only the fields we need for the protocols we speak.

Enums§

Error
Errors that can occur during a rsurl request.
HttpVersionPref
Preference for which HTTP version to use over HTTPS. The HTTPS dispatcher picks this up. HTTP/2 is selected via ALPN at TLS-handshake time; if the server doesn’t agree (Auto) we transparently fall back to HTTP/1.1. HTTP/3 runs over a wholly separate QUIC/UDP path (see crate::http3).
Priority
A request priority hint (à la fetch’s priority). Currently applied as the issuance order within send_multiplexed — higher-priority requests get their HEADERS on the wire first. HTTP/2 PRIORITY-frame weights and preconnect/pool-sizing controls are not yet wired.
SameSite
The SameSite attribute of a cookie (RFC 6265bis §5.2). rsurl parses and exposes it but does not enforce it — same-site is a browser policy the caller (e.g. Argus) applies, not a CLI transfer concern.

Functions§

get
Perform an HTTP GET against url and return the full response.
request
Perform an arbitrary HTTP request. Convenience wrapper over Request.
send_multiplexed
Issue several HTTP/2 requests concurrently over a single connection using true stream multiplexing, returning one result per request in input order.
send_multiplexed_traced
As send_multiplexed, but writes the protocol trace (the -v * > < lines, interleaved per stream) to trace. Pass &mut std::io::sink() for no trace — or just call send_multiplexed.
transfer
Run the default operation for the URL’s scheme and return its payload.
transfer_url
Same as transfer but starts from an already-parsed URL.

Type Aliases§

Result
Crate-wide result alias.