Read misc.httpmethod, misc.protocol and misc.port from their IANA registries #26

Merged
lilleman merged 16 commits from iana-network-tables into main 2026-09-20 00:50:35 +02:00
3 changed files with 16 additions and 6 deletions
Showing only changes of commit 4472c8d92b - Show all commits
+4 -3
View File
@@ -173,9 +173,10 @@ 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, not the `misc.httpmethod` is the nine methods the HTTP core specification defines; the
WebDAV extensions the register also holds, and its `safe` and `idempotent` are `true` register's other entries, WebDAV and DeltaV among them, do not ship. Its `safe` and
or `false`, so a Go `bool` reads them. `misc.protocol` carries a `number` and a `name`, `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` carries a `number` and a `name`,
the keyword itself where the register spells none out, and selects by either spelling. the keyword itself where the register spells none out, and selects by either spelling.
`misc.port` is the TCP assignments, rendering the number a port field holds with the `misc.port` is the TCP assignments, rendering the number a port field holds with the
IANA `service` beside it, and selecting by number alone. A draw spans the whole IANA `service` beside it, and selecting by number alone. A draw spans the whole
+6 -3
View File
@@ -4,9 +4,9 @@
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 the HTTP core specification for it, RFC 9110
section 9.3 or RFC 5789, which is the nine a request carries; the WebDAV and DeltaV section 9.3 or RFC 5789, which is the nine a request carries; the register's other
extensions the register also holds do not. The register's `yes` and `no` ship as `true` entries do not. The register's `yes` and `no` ship as `true` and `false`, which a
and `false`, which a consumer's boolean reads. consumer's boolean reads.
""" """
import argparse import argparse
import csv import csv
@@ -24,6 +24,7 @@ CACHE = Path(__file__).resolve().parent / "cache"
COLUMNS = ["idempotent", "method", "safe"] COLUMNS = ["idempotent", "method", "safe"]
CORE = re.compile(r"\[RFC9110, Section 9\.3\.|\[RFC5789, Section 2\]") CORE = re.compile(r"\[RFC9110, Section 9\.3\.|\[RFC5789, Section 2\]")
BOOLEAN = {"yes": "true", "no": "false"} BOOLEAN = {"yes": "true", "no": "false"}
SELECTOR = '[]{}"|' # mirrors inSelector in table.go
EXPECTED = 9 EXPECTED = 9
@@ -32,6 +33,8 @@ def rows(text):
method = (r["Method Name"] or "").strip() method = (r["Method Name"] or "").strip()
if not CORE.search(r["Reference"] or ""): if not CORE.search(r["Reference"] or ""):
continue continue
if set(method) & set(SELECTOR):
sys.exit(f"{method}: a method holding one of {SELECTOR} is one a selector cannot spell")
answers = {} answers = {}
for column in ("Safe", "Idempotent"): for column in ("Safe", "Idempotent"):
answer = (r[column] or "").strip() answer = (r[column] or "").strip()
+6
View File
@@ -103,10 +103,16 @@ by a `data-import/` script, as README goal 10 asks.
- Add `{base64url(n)}` for JWT shapes. - Add `{base64url(n)}` for JWT shapes.
- Add a `unix` layout to `date()` once something needs it. - Add a `unix` layout to `date()` once something needs it.
### Library and CLI
- Name a spelling that works when a row selector misses: `misc.protocol[tcp]`, - Name a spelling that works when a row selector misses: `misc.protocol[tcp]`,
`misc.httpmethod[get]` and `misc.territory[se]` all answer "no row … has key or name" `misc.httpmethod[get]` and `misc.territory[se]` all answer "no row … has key or name"
and stop there, where a case-insensitive match could name the row that exists, and a and stop there, where a case-insensitive match could name the row that exists, and a
table with no `name` column could say it selects by key alone. table with no `name` column could say it selects by key alone.
- Let a table column carry a `datatype`, so `--format json` writes
`"safe": true` and `--format sql` a boolean rather than the text `'true'`. Today only
a JSON field takes one, so `misc.httpmethod`'s booleans are typed in Go and text
everywhere else. It reserves a field name, so it is a fence and a major.
### Open questions to settle ### Open questions to settle