From ac7537caa0e42f28a11edd40406fe3147c5d9aa3 Mon Sep 17 00:00:00 2001 From: Marco Ippolito Date: Mon, 29 Jan 2024 15:55:23 +0100 Subject: [PATCH] feat: support http method query (#265) --- src/llhttp/constants.ts | 3 +++ test/request/method.md | 42 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/src/llhttp/constants.ts b/src/llhttp/constants.ts index 00fc5239..8cb55eb5 100644 --- a/src/llhttp/constants.ts +++ b/src/llhttp/constants.ts @@ -135,6 +135,8 @@ export enum METHODS { RECORD = 44, /* RAOP */ FLUSH = 45, + /* DRAFT https://www.ietf.org/archive/id/draft-ietf-httpbis-safe-method-w-body-02.html */ + QUERY = 46, } export const METHODS_HTTP = [ @@ -175,6 +177,7 @@ export const METHODS_HTTP = [ // TODO(indutny): should we allow it with HTTP? METHODS.SOURCE, + METHODS.QUERY, ]; export const METHODS_ICE = [ diff --git a/test/request/method.md b/test/request/method.md index dce262e6..47225018 100644 --- a/test/request/method.md +++ b/test/request/method.md @@ -448,3 +448,45 @@ off=11 len=3 span[version]="1.1" off=14 version complete off=24 error code=23 reason="Pause on PRI/Upgrade" ``` + +### QUERY request + + +```http +QUERY /contacts HTTP/1.1 +Host: example.org +Content-Type: example/query +Accept: text/csv +Content-Length: 41 + +select surname, givenname, email limit 10 +``` + +```log +off=0 message begin +off=0 len=5 span[method]="QUERY" +off=5 method complete +off=6 len=9 span[url]="/contacts" +off=16 url complete +off=21 len=3 span[version]="1.1" +off=24 version complete +off=26 len=4 span[header_field]="Host" +off=31 header_field complete +off=32 len=11 span[header_value]="example.org" +off=45 header_value complete +off=45 len=12 span[header_field]="Content-Type" +off=58 header_field complete +off=59 len=13 span[header_value]="example/query" +off=74 header_value complete +off=74 len=6 span[header_field]="Accept" +off=81 header_field complete +off=82 len=8 span[header_value]="text/csv" +off=92 header_value complete +off=92 len=14 span[header_field]="Content-Length" +off=107 header_field complete +off=108 len=2 span[header_value]="41" +off=112 header_value complete +off=114 headers complete method=46 v=1/1 flags=20 content_length=41 +off=114 len=41 span[body]="select surname, givenname, email limit 10" +off=155 message complete +```