This article details building an uptime checker in Rust, explaining why the author switched from reqwest to raw hyper. The author argues that uptime probers are unique HTTP clients needing detailed insights, not performance optimizations. A key lesson is disabling connection pooling, as it hides essential connection and TLS handshake times. The article advocates for embedding timing data directly within error types rather than having a single, uninformative error. This approach allows for precise identification of failure points like DNS, TCP, or TLS.A critical security measure discussed is blocking Server-Side Request Forgery (SSRF) by filtering resolved IP addresses, not just hostnames, to prevent access to internal or sensitive cloud metadata endpoints. The author also emphasizes avoiding string-based error parsing, instead downcasting to specific error types to provide accurate and actionable failure reasons. This allows for distinct user-facing messages for issues like expired certificates versus hostname mismatches. Ultimately, while reqwest is recommended for general applications, raw hyper is justified when the request itself is the product, requiring granular control over every aspect. The author notes this detailed probing is the core value of their uptime monitoring service, Uptimepage.
reqwestto rawhyper. The author argues that uptime probers are unique HTTP clients needing detailed insights, not performance optimizations. A key lesson is disabling connection pooling, as it hides essential connection and TLS handshake times. The article advocates for embedding timing data directly within error types rather than having a single, uninformative error. This approach allows for precise identification of failure points like DNS, TCP, or TLS.A critical security measure discussed is blocking Server-Side Request Forgery (SSRF) by filtering resolved IP addresses, not just hostnames, to prevent access to internal or sensitive cloud metadata endpoints. The author also emphasizes avoiding string-based error parsing, instead downcasting to specific error types to provide accurate and actionable failure reasons. This allows for distinct user-facing messages for issues like expired certificates versus hostname mismatches. Ultimately, whilereqwestis recommended for general applications, rawhyperis justified when the request itself is the product, requiring granular control over every aspect. The author notes this detailed probing is the core value of their uptime monitoring service, Uptimepage.