Skip to content

Commit

Permalink
test: check 0xff in header value
Browse files Browse the repository at this point in the history
  • Loading branch information
indutny committed Sep 2, 2020
1 parent 883d9dd commit 8e6903c
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
3 changes: 3 additions & 0 deletions test/md-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ function run(name: string): void {
input = input.replace(/\\n/g, '\n');
input = input.replace(/\\t/g, '\t');
input = input.replace(/\\f/g, '\f');
input = input.replace(/\\x([0-9a-fA-F]+)/g, (all, hex) => {
return String.fromCharCode(parseInt(hex, 16));
});

// Useful in token tests
input = input.replace(/\\([0-7]{1,3})/g, (_, digits) => {
Expand Down
24 changes: 24 additions & 0 deletions test/request/sample.md
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,30 @@ off=37 headers complete method=1 v=1/1 flags=0 content_length=0
off=37 message complete
```

## 255 ASCII in header value

Note: `Buffer.from([ 0xff ]).toString('latin1') === 'ÿ'`.

<!-- meta={"type": "request", "noScan": true} -->
```http
OPTIONS /url HTTP/1.1
Header1: Value1
Header2: \xffValue2
```

```log
off=0 message begin
off=8 len=4 span[url]="/url"
off=23 len=7 span[header_field]="Header1"
off=32 len=6 span[header_value]="Value1"
off=40 len=7 span[header_field]="Header2"
off=49 len=8 span[header_value]="ÿValue2"
off=61 headers complete method=6 v=1/1 flags=0 content_length=0
off=61 message complete
```

## X-SSL-Nonsense

See nodejs/test/parallel/test-http-headers-obstext.js
Expand Down

0 comments on commit 8e6903c

Please sign in to comment.