all repos — red-anatomia @ main

red-anatomia

src/collectors/protocol.ts (view raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
import type { Observations } from '../core/types.js';

export function coletarProtocolo(obs: Observations): void {
  const altSvc = obs.headers['alt-svc'];
  const http3Anunciado = !!altSvc && /(^|[,\s])h3(-\d+)?=/.test(altSvc);

  obs.protocolo = {
    http2: obs.protocolo?.http2 ?? false,
    http3Anunciado,
    altSvc: altSvc || obs.protocolo?.altSvc,
  };
}