Trim comments to the non-obvious why
Drop narration, history and restated-code comments across the repo, keep short ones for security boundaries, upstream quirks and ordering constraints, and record the convention in CLAUDE.md. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
+9
-50
@@ -1,49 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
# =============================================================================
|
||||
# edge_test.sh — what the public edge does with a fixed set of requests.
|
||||
#
|
||||
# WHAT IT DOES
|
||||
# Sends each request below to the edge and prints one line per request
|
||||
# (status and Location, or one response header). Two kinds of line:
|
||||
# ok / FAIL the privacy boundary and the gates, which have a fixed right
|
||||
# answer: the /notes/ denials, /py/internal/, every gated
|
||||
# prefix. Any FAIL makes the exit status 1.
|
||||
# show / hdr everything else (redirects, headers, carve-outs, uploads),
|
||||
# whose answer depends on the upstream's data. Compare two runs
|
||||
# instead (below).
|
||||
#
|
||||
# USAGE
|
||||
# caddy/edge_test.sh <base-url> [curl options...]
|
||||
# base-url the www origin, e.g. https://www.example.com
|
||||
# curl options added to every request: --resolve to reach a given
|
||||
# container, -k for dev's internal CA.
|
||||
# Environment, all optional:
|
||||
# EDGE_APEX the apex origin (production only): adds the apex cases.
|
||||
# EDGE_HTTP the plain-http apex origin (production only), e.g.
|
||||
# http://example.com: adds the http -> https case.
|
||||
# EDGE_COOKIE an admin session's Cookie header value: adds the
|
||||
# signed-in cases (each gated prefix must then NOT redirect
|
||||
# to the login).
|
||||
# EDGE_UPLOAD the name of a file under /uploads/ that exists.
|
||||
#
|
||||
# On stpvm, pin the hostname to this machine, or curl goes out over the
|
||||
# internet and back (and hangs):
|
||||
# caddy/edge_test.sh https://www.$DOMAIN --resolve www.$DOMAIN:443:127.0.0.1
|
||||
# Dev stack:
|
||||
# caddy/edge_test.sh https://localhost -k
|
||||
#
|
||||
# COMPARING TWO EDGES
|
||||
# Run it against each and diff the output. This is how Caddy was checked
|
||||
# against nginx before the 2026-11-17 cutover (Caddy on 8443 beside nginx),
|
||||
# and how a big change to caddy/ can be checked against the running edge:
|
||||
# caddy/edge_test.sh https://www.$DOMAIN --resolve www.$DOMAIN:443:127.0.0.1 >before.txt
|
||||
# caddy/edge_test.sh https://www.$DOMAIN:8443 --resolve www.$DOMAIN:8443:127.0.0.1 >after.txt
|
||||
# diff before.txt after.txt
|
||||
# Every remaining difference should be one that was intended.
|
||||
#
|
||||
# NOTHING HERE WRITES. Every request is a GET, apart from one POST to
|
||||
# /py/internal/, which never gets past the edge.
|
||||
# =============================================================================
|
||||
# Probes the edge. ok/FAIL lines (privacy denials and gates) set the exit
|
||||
# status; show/hdr lines depend on data, so diff two runs instead.
|
||||
# caddy/edge_test.sh <www-origin> [curl options...]
|
||||
# e.g. https://www.$DOMAIN --resolve www.$DOMAIN:443:127.0.0.1 (on stpvm)
|
||||
# https://localhost -k (dev)
|
||||
# Optional env: EDGE_APEX, EDGE_HTTP, EDGE_COOKIE (admin session),
|
||||
# EDGE_UPLOAD (an existing upload's name). Read-only: GETs plus one POST that
|
||||
# the edge refuses.
|
||||
set -u
|
||||
|
||||
if [ $# -lt 1 ]; then
|
||||
@@ -57,11 +20,7 @@ FAILED=0
|
||||
# The www host, without scheme or port.
|
||||
BASE_HOST=$(printf '%s' "$BASE" | sed -E 's#^[a-z]+://([^/:]+).*#\1#')
|
||||
|
||||
# "<status> <location>" for one request. Arguments after the URL are extra
|
||||
# curl options (method, headers, --path-as-is). A redirect to the www host is
|
||||
# shown as its path alone: nginx sends an absolute Location built from its
|
||||
# own port, Caddy a relative one, and either way the browser lands on the
|
||||
# same page.
|
||||
# "<status> <location>"; a redirect to www is shown as its path alone.
|
||||
probe() {
|
||||
local url=$1 out
|
||||
shift
|
||||
|
||||
Reference in New Issue
Block a user