mirror of
https://github.com/morluto/rea.git
synced 2026-11-16 03:33:25 +00:00
Project bounded JSON diagnostics using shared URI roles and source spans. Keep complete parser input unchanged and compute safe diagnostics lazily. Preserve byte facts, error classification, path data and cleanup ownership. Reuse JSON escape-coordinate mapping with IDA diagnostics. Fixes #7812 Assisted-by: Reimu (gensokyo-skills:reimu-incident-triage) Assisted-by: Kogasa (gensokyo-skills:kogasa-surprise-testing) Assisted-by: Yukari (gensokyo-skills:yukari-boundary-analysis)
24 lines
788 B
TypeScript
24 lines
788 B
TypeScript
import {
|
|
parseRecordedTransportUrl,
|
|
type RecordedTransportUrl,
|
|
} from "../domain/recordedTransportUrl.js";
|
|
|
|
/** Wireshark URI facts. HTTP/2 :path is a path, not an absolute URI. */
|
|
export const PCAP_HTTP_URI_FIELDS = {
|
|
"http.request.full_uri": "full-uri",
|
|
"http.request.uri": "request-target",
|
|
"http2.request.full_uri": "full-uri",
|
|
} as const;
|
|
|
|
export type PcapHttpUriRole =
|
|
(typeof PCAP_HTTP_URI_FIELDS)[keyof typeof PCAP_HTTP_URI_FIELDS];
|
|
|
|
/** Origin-form targets retain path semantics, including a leading double slash. */
|
|
export const parsePcapHttpUri = (
|
|
value: string,
|
|
role: PcapHttpUriRole,
|
|
): RecordedTransportUrl =>
|
|
role === "request-target" && value.startsWith("/")
|
|
? { origin: null, path: null, credentials: null }
|
|
: parseRecordedTransportUrl(value);
|