Skip to content

Commit

Permalink
constants: add | to list of allowed URL chars
Browse files Browse the repository at this point in the history
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

PR-URL: #24
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
  • Loading branch information
indutny committed May 7, 2019
1 parent 4483adc commit ba06644
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
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

0 comments on commit ba06644

Please sign in to comment.