class-preload-transport.php

Bounded transport policy for Cron cache warmup requests.

Source includes/Scheduler/class-preload-transport.php1 min readPart of Performance Optimisation

includes/Scheduler/class-preload-transport.php

Bounded transport policy for Cron cache warmup requests.

Namespace: PerformanceOptimise\\Inc · Lines: 171

Class Preload_Transport

Validates and fetches same-host preload targets without implicit redirects.

Source: includes/Scheduler/class-preload-transport.php, line 20

class Preload_Transport

Tags: @since NEXT

Constants

ConstantVisibilityValueLine
MAX_REDIRECTSpublic526

publicstatic get()

public static function get(string $url, int=5 $timeout, int=3 $max_redirects)

Fetch a validated same-host target with explicit redirect handling.

ParameterTypeDefaultDescription
$urlstring—Target URL.
$timeoutint=5—Request timeout in seconds.
$max_redirectsint=3—Maximum redirects allowed.

Return: array|\\WP_Error — Final response or a fail-closed error.

Source: includes/Scheduler/class-preload-transport.php, line 36

publicstatic is_allowed_url()

public static function is_allowed_url(string $url): bool

Check the initial URL and redirect target policy.

ParameterTypeDefaultDescription
$urlstring—Candidate URL.

Return: bool — Whether the target is safe for same-host preload transport.

Source: includes/Scheduler/class-preload-transport.php, line 85

privatestatic resolve_redirect()

private static function resolve_redirect(string $base, string $location): string

Resolve a relative or absolute redirect location against the current URL.

ParameterTypeDefaultDescription
$basestring—Current request URL.
$locationstring—Redirect location header.

Return: string — Absolute candidate URL.

Source: includes/Scheduler/class-preload-transport.php, line 129