PluginProbe
404 Solution / trunk
404 Solution vtrunk
4.3.5 4.3.4 4.3.3 4.3.2 4.3.1 4.3.0 4.2.0 4.1.19 4.1.18 4.1.17 4.1.16 4.1.15 4.1.13 4.1.12 4.1.11 4.1.10 4.1.9 4.1.8 4.1.7 4.1.6 4.1.5 4.1.4 4.1.3 trunk 2.30.0 All 109 releases
404-solution / includes / diagnostics / CanaryLadderStep.php

CanaryLadderStep.php in 404 Solution trunk, at includes/diagnostics/CanaryLadderStep.php

48 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if (!defined('ABSPATH')) {
4 exit;
5 }
6
7 /**
8 * Identity and dispatch order for the adaptive AJAX canary ladder.
9 *
10 * The static-asset probe is a receipt-only browser step. Every other value
11 * appears in DISPATCHED in the exact order accepted by the server endpoint.
12 */
13 final class ABJ_404_Solution_CanaryLadderStep {
14
15 /** Browser-only probe that is legal on receipts but never dispatched. */
16 const STATIC_ASSET = 'static_asset';
17 const CONCURRENT_CONTROL = 'concurrent_control';
18 const BASELINE_CONTROL = 'baseline_control';
19 const AUTH_ONLY = 'auth_only';
20 const POST_LIMITER = 'post_limiter';
21 const SUMMARY = 'summary';
22 const SIZE_TARGET = 'size_target';
23 const SIZE_PROBE = 'size_probe';
24 const INERT = 'inert';
25 const COMPRESS_ON = 'compress_on';
26 const COMPRESS_OFF = 'compress_off';
27 const STREAM = 'stream';
28 const INTERPRET = 'interpret';
29
30 /** Every server-dispatched step. The browser-only static asset is excluded. */
31 const DISPATCHED = array(
32 self::CONCURRENT_CONTROL, self::BASELINE_CONTROL, self::AUTH_ONLY,
33 self::POST_LIMITER, self::SUMMARY, self::SIZE_TARGET, self::SIZE_PROBE,
34 self::INERT, self::COMPRESS_ON, self::COMPRESS_OFF, self::STREAM,
35 self::INTERPRET,
36 );
37
38 /**
39 * Convert an untrusted request value to a dispatchable step ID.
40 *
41 * @param mixed $raw
42 */
43 public static function normalize($raw): string {
44 $candidate = is_scalar($raw) ? (string)$raw : '';
45 return in_array($candidate, self::DISPATCHED, true) ? $candidate : '';
46 }
47 }
48