includes/Scheduler/class-preload-transport.php
Bounded transport policy for Cron cache warmup requests.
Class Preload_Transport
Validates and fetches same-host preload targets without implicit redirects.
class Preload_TransportConstants
| Constant | Visibility | Value | Line |
|---|---|---|---|
MAX_REDIRECTS | public | 5 | 26 |
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. Parameter Type Default Description $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.
publicstatic is_allowed_url()
public static function is_allowed_url(string $url): boolCheck the initial URL and redirect target policy. Parameter Type Default Description $urlstring— Candidate URL.
Return: bool — Whether the target is safe for same-host preload transport.
privatestatic resolve_redirect()
private static function resolve_redirect(string $base, string $location): stringResolve a relative or absolute redirect location against the current URL. Parameter Type Default Description $basestring— Current request URL. $locationstring— Redirect location header.
Return: string — Absolute candidate URL.