Skip to content

Commit 8e6903c

Browse files
committed
test: check 0xff in header value
1 parent 883d9dd commit 8e6903c

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

test/md-test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,9 @@ function run(name: string): void {
189189
input = input.replace(/\\n/g, '\n');
190190
input = input.replace(/\\t/g, '\t');
191191
input = input.replace(/\\f/g, '\f');
192+
input = input.replace(/\\x([0-9a-fA-F]+)/g, (all, hex) => {
193+
return String.fromCharCode(parseInt(hex, 16));
194+
});
192195

193196
// Useful in token tests
194197
input = input.replace(/\\([0-7]{1,3})/g, (_, digits) => {

test/request/sample.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,30 @@ off=37 headers complete method=1 v=1/1 flags=0 content_length=0
355355
off=37 message complete
356356
```
357357

358+
## 255 ASCII in header value
359+
360+
Note: `Buffer.from([ 0xff ]).toString('latin1') === 'ÿ'`.
361+
362+
<!-- meta={"type": "request", "noScan": true} -->
363+
```http
364+
OPTIONS /url HTTP/1.1
365+
Header1: Value1
366+
Header2: \xffValue2
367+
368+
369+
```
370+
371+
```log
372+
off=0 message begin
373+
off=8 len=4 span[url]="/url"
374+
off=23 len=7 span[header_field]="Header1"
375+
off=32 len=6 span[header_value]="Value1"
376+
off=40 len=7 span[header_field]="Header2"
377+
off=49 len=8 span[header_value]="ÿValue2"
378+
off=61 headers complete method=6 v=1/1 flags=0 content_length=0
379+
off=61 message complete
380+
```
381+
358382
## X-SSL-Nonsense
359383

360384
See nodejs/test/parallel/test-http-headers-obstext.js

0 commit comments

Comments
 (0)