PycURL HEAD Timings Measure the Whole Proxy Route
Reduce response-body traffic when timing a proxy request without confusing cumulative TTFB with the proxy’s own processing delay.
A HEAD request can reduce response-body traffic when comparing proxies. On an existing PycURL handle already configured with the destination, proxy and timeouts:
handle.setopt(pycurl.NOBODY, True)
handle.perform()
ttfb = handle.getinfo(pycurl.STARTTRANSFER_TIME)
prepared = handle.getinfo(pycurl.PRETRANSFER_TIME)
Read these values after a successful transfer and before closing the handle. NOBODY selects HEAD for HTTP; it does not remove the request headers, proxy negotiation or TLS traffic.
STARTTRANSFER_TIME is elapsed time from the transfer’s start to its first response byte. It includes preparation and server processing, so it is a measurement of this route and destination rather than the proxy’s isolated delay. PRETRANSFER_TIME covers protocol preparation; subtracting it still leaves work beyond the proxy itself.
Keep the destination, redirect policy and connection-reuse conditions consistent across comparisons. Redirect timings accumulate. A fresh connection and a reused tunnel answer different performance questions.
HEAD can also behave differently from GET. Use it for a lightweight reachability or timing observation, then validate the actual method separately when selecting a route for an application.