Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
  • Loading branch information
indutny committed May 6, 2019
commit e875c8a41192cb5f40754ad473c7fa159df65aa3
2 changes: 1 addition & 1 deletion src/llhttp/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export const STRICT_URL_CHAR: CharList = ([
':', ';', '<', '=', '>',
'@', '[', '\\', ']', '^', '_',
'`',
'{', '}', '~',
'{', '|', '}', '~',
] as CharList).concat(ALPHANUM);

export const URL_CHAR: CharList = STRICT_URL_CHAR
Expand Down
20 changes: 20 additions & 0 deletions test/request/uri.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,26 @@ off=51 headers complete method=1 v=1/1 flags=0 content_length=0
off=51 message complete
```

## Query URL with vertical bar character

It should be allowed to have vertical bar symbol in URI: `|`.

See: https://github.com/nodejs/node/issues/27584

<!-- meta={"type": "request"} -->
```http
GET /test.cgi?query=| HTTP/1.1


```

```log
off=0 message begin
off=4 len=17 span[url]="/test.cgi?query=|"
off=34 headers complete method=1 v=1/1 flags=0 content_length=0
off=34 message complete
```

## `host:port` terminated by a space

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