Skip to content

Commit e875c8a

Browse files
committed
constants: add | to list of allowed URL chars
The vertical bar character `|` wasn't ported from http-parser during rewrite. This commit introduces it back. See: https://github.com/nodejs/http-parser/blob/5c17dad400e45c5a442a63f250fff2638d144682/http_parser.c#L275 See: nodejs/node#27584
1 parent a732487 commit e875c8a

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

src/llhttp/constants.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ export const STRICT_URL_CHAR: CharList = ([
153153
':', ';', '<', '=', '>',
154154
'@', '[', '\\', ']', '^', '_',
155155
'`',
156-
'{', '}', '~',
156+
'{', '|', '}', '~',
157157
] as CharList).concat(ALPHANUM);
158158

159159
export const URL_CHAR: CharList = STRICT_URL_CHAR

test/request/uri.md

+20
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,26 @@ off=51 headers complete method=1 v=1/1 flags=0 content_length=0
6767
off=51 message complete
6868
```
6969

70+
## Query URL with vertical bar character
71+
72+
It should be allowed to have vertical bar symbol in URI: `|`.
73+
74+
See: https://github.com/nodejs/node/issues/27584
75+
76+
<!-- meta={"type": "request"} -->
77+
```http
78+
GET /test.cgi?query=| HTTP/1.1
79+
80+
81+
```
82+
83+
```log
84+
off=0 message begin
85+
off=4 len=17 span[url]="/test.cgi?query=|"
86+
off=34 headers complete method=1 v=1/1 flags=0 content_length=0
87+
off=34 message complete
88+
```
89+
7090
## `host:port` terminated by a space
7191

7292
<!-- meta={"type": "request"} -->

0 commit comments

Comments
 (0)