Compare commits

..

2 Commits

Author SHA1 Message Date
lilleman 5083b79730 Credit RFC 5789 for PATCH, which RFC 9110 does not define
Tests / vet + fmt + tests (pull_request) Successful in 1m21s
Tests / Gitea release from CHANGELOG.md (pull_request) Has been skipped
2026-09-20 00:45:23 +02:00
lilleman b3ead0ca5e Check every method's booleans on every seed, where the old guard checked none 2026-09-20 00:45:23 +02:00
4 changed files with 13 additions and 9 deletions
+1 -1
View File
@@ -44,7 +44,7 @@ replacement, and each removed path, column or flag.
`device` and `os` columns. `misc.car` keeps its makes and models in a `make` and a `device` and `os` columns. `misc.car` keeps its makes and models in a `make` and a
`model` column. `model` column.
- `misc.httpmethod`, `misc.protocol` and `misc.port` are IANA's registries as tables. - `misc.httpmethod`, `misc.protocol` and `misc.port` are IANA's registries as tables.
`misc.httpmethod` is the nine methods the HTTP core specification defines, carrying `misc.httpmethod` is the eight methods RFC 9110 defines and PATCH, carrying
`safe` and `idempotent` as `true` or `false`; `misc.protocol` the keyword, its `safe` and `idempotent` as `true` or `false`; `misc.protocol` the keyword, its
`number` and its `name`, selectable by either; `misc.port` renders a TCP port number, `number` and its `name`, selectable by either; `misc.port` renders a TCP port number,
with the IANA `service` name beside it, keeping the first service the registry with the IANA `service` name beside it, keeping the first service the registry
+2 -2
View File
@@ -173,8 +173,8 @@ select a row; `car` and `useragent` carry no key or name, so they are drawn from
than selected in. than selected in.
`misc.httpmethod`, `misc.protocol` and `misc.port` are IANA's registries. `misc.httpmethod`, `misc.protocol` and `misc.port` are IANA's registries.
`misc.httpmethod` is the nine methods the HTTP core specification defines; the `misc.httpmethod` is the eight methods RFC 9110 defines and PATCH; the register's
register's other entries, WebDAV and DeltaV among them, do not ship. Its `safe` and other entries, WebDAV and DeltaV among them, do not ship. Its `safe` and
`idempotent` are `true` or `false`, so a Go `bool` reads them, though `--format json` `idempotent` are `true` or `false`, so a Go `bool` reads them, though `--format json`
and `sql` write them as text, a table column carrying no datatype. `misc.protocol` and `sql` write them as text, a table column carrying no datatype. `misc.protocol`
carries a `number` and a `name`, the keyword itself where the register spells none out, carries a `number` and a `name`, the keyword itself where the register spells none out,
+3 -4
View File
@@ -3,9 +3,8 @@
data-import/httpmethod.py [--source URL_OR_FILE] [--cache DIR] [--out FILE] data-import/httpmethod.py [--source URL_OR_FILE] [--cache DIR] [--out FILE]
A method ships when the register cites the HTTP core specification for it, RFC 9110 A method ships when the register cites RFC 9110 section 9.3 or RFC 5789 for it, which
section 9.3 or RFC 5789, which is the nine a request carries; the register's other is the eight HTTP defines and PATCH; the register's other entries do not. The register's `yes` and `no` ship as `true` and `false`, which a
entries do not. The register's `yes` and `no` ship as `true` and `false`, which a
consumer's boolean reads. consumer's boolean reads.
""" """
import argparse import argparse
@@ -52,7 +51,7 @@ def main():
a = p.parse_args() a = p.parse_args()
table = sorted(rows(source.fetch(a.source, a.cache, "http-methods.csv").decode("utf-8")), key=lambda r: r["method"]) table = sorted(rows(source.fetch(a.source, a.cache, "http-methods.csv").decode("utf-8")), key=lambda r: r["method"])
if len(table) != EXPECTED: if len(table) != EXPECTED:
sys.exit(f"{len(table)} methods cite the core specification, not {EXPECTED}; the register's Reference column has moved") sys.exit(f"{len(table)} methods cite RFC 9110 section 9.3 or RFC 5789, not {EXPECTED}; the register's Reference column has moved")
tsv.write(a.out, COLUMNS, table) tsv.write(a.out, COLUMNS, table)
+7 -2
View File
@@ -762,8 +762,13 @@ func TestShippedTables(t *testing.T) {
if err := newGenerator(t, "data", WithSeed(1)).FakeStruct(&row); err != nil { if err := newGenerator(t, "data", WithSeed(1)).FakeStruct(&row); err != nil {
t.Fatalf("FakeStruct into a bool = %v, want the register's yes and no shipped as true and false", err) t.Fatalf("FakeStruct into a bool = %v, want the register's yes and no shipped as true and false", err)
} }
if row.Method == "GET" && !(row.Safe && row.Idempotent) { want, named := map[string][2]bool{
t.Fatalf("GET drew safe=%v idempotent=%v", row.Safe, row.Idempotent) "CONNECT": {false, false}, "DELETE": {false, true}, "GET": {true, true},
"HEAD": {true, true}, "OPTIONS": {true, true}, "PATCH": {false, false},
"POST": {false, false}, "PUT": {false, true}, "TRACE": {true, true},
}[row.Method]
if !named || row.Safe != want[0] || row.Idempotent != want[1] {
t.Fatalf("%s drew safe=%v idempotent=%v", row.Method, row.Safe, row.Idempotent)
} }
zones := map[string]int{} zones := map[string]int{}
for i := 0; i < 2000; i++ { for i := 0; i < 2000; i++ {