FA-6631 / HTTP redirects / Open access
Redirect rewriting preserves methods for 307 and 308 · case 01
Redirect rewriting preserves methods for 307 and 308.
ROOT CAUSE
The faulty implementation uses `'GET' if status in (301,302,303,307,308) else method` for the redirect-rewrite decision.
VERIFIED REPAIR
Apply the explicit redirect-rewrite contract, including the tested boundary and negative cases.
Unsuccessful approach: The attempted repair uses `'GET' if status == 303 else method` and still violates a separate fixture.
Case contract
Redirect rewriting preserves methods for 307 and 308: return the result specified by the explicit input/output boundary fixtures.
Why this case matters
This deterministic http redirects model isolates the redirect-rewrite policy at a network component boundary.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import ipaddress
import re
from urllib.parse import urlsplit, urljoin
N = 1
observations = []
def solve(status, method):
return 'GET' if status in (301,302,303,307,308) else method
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve(307, 'POST'), 'POST')", "check('fixture 2', solve(302, 'POST'), 'GET')", "check('fixture 3', solve(303, 'HEAD'), 'HEAD')", "check('fixture 4', solve(308, 'PUT'), 'PUT')"]
for _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:
exec(_line)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| fixture 2 | GET | GET | Passed |
| fixture 3 | GET | HEAD | Failed |
| fixture 4 | GET | PUT | Failed |
| fixture 1 | GET | POST | Failed |
SHA-256 / b99806aabfce9395e6fee2abe3f7e913e49f7197fee947520a9d828c0b79d8fd
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import ipaddress
import re
from urllib.parse import urlsplit, urljoin
N = 1
observations = []
def solve(status, method):
return 'GET' if status == 303 else method
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve(307, 'POST'), 'POST')", "check('fixture 2', solve(302, 'POST'), 'GET')", "check('fixture 3', solve(303, 'HEAD'), 'HEAD')", "check('fixture 4', solve(308, 'PUT'), 'PUT')"]
for _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:
exec(_line)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| fixture 2 | POST | GET | Failed |
| fixture 3 | GET | HEAD | Failed |
| fixture 4 | PUT | PUT | Passed |
| fixture 1 | POST | POST | Passed |
SHA-256 / e668ac09e1c8339c199dc68ca03ca2c5b938b2e28d33729464e3de1674e32d2d
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
import ipaddress
import re
from urllib.parse import urlsplit, urljoin
N = 1
observations = []
def solve(status, method):
return 'GET' if (status == 303 and method != 'HEAD') or (status in (301,302) and method == 'POST') else method
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve(307, 'POST'), 'POST')", "check('fixture 2', solve(302, 'POST'), 'GET')", "check('fixture 3', solve(303, 'HEAD'), 'HEAD')", "check('fixture 4', solve(308, 'PUT'), 'PUT')"]
for _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:
exec(_line)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| fixture 2 | GET | GET | Passed |
| fixture 3 | HEAD | HEAD | Passed |
| fixture 4 | PUT | PUT | Passed |
| fixture 1 | POST | POST | Passed |
SHA-256 / 06d38cf866d0f36251e1cce5c0e9bc86a3a76cf9f9bd9088a687a5cf5b4eb002
Verification & scope
Bounded deterministic policy model over validated inputs; not a complete protocol stack or an interoperability claim. The five variants rotate the same explicit fixture set. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.
Observations recorded using Python 3.12.14 at 2026-09-29T14:38:03.801405+00:00.
Case digest / 556a25f248e166cdba8d3ed610fca24ec9ed3b1e5717a37952c719c8c7e577c6