class Cryload::Request

Overview

One measured HTTP request, including any redirect hops it followed.

The response body is streamed through a caller-owned scratch buffer instead of being materialised as a String. That removes a per-request allocation proportional to the response size and is what makes time-to-first-byte observable at all: the block form of HTTP::Client#exec hands the response over as soon as the status line and headers are parsed.

Defined in:

cryload/request.cr

Constant Summary

DRAIN_BUFFER_SIZE = 32 * 1024
REDIRECT_STATUS_CODES = {301, 302, 303, 307, 308}

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(client : PhasedClient, uri : URI, spec : RequestSpec, headers : HTTP::Headers, buffer : Bytes, scheduled_at : Time::Instant | Nil = nil) #

Class Method Detail

def self.buffer : Bytes #

Instance Method Detail

def connect_ms : Float64 | Nil #

def corrected_ms : Float64 #

def dns_ms : Float64 | Nil #

def response_bytes : Int64 #

def send_delay_ms : Float64 #

def status_code : Int32 #

def tls_ms : Float64 | Nil #

def total_ms : Float64 #

def ttfb_ms : Float64 #