diff --git a/test/md-test.ts b/test/md-test.ts index 14e014c5..04acba8c 100644 --- a/test/md-test.ts +++ b/test/md-test.ts @@ -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) => { diff --git a/test/request/sample.md b/test/request/sample.md index 1367f9ee..184255a7 100644 --- a/test/request/sample.md +++ b/test/request/sample.md @@ -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') === 'ÿ'`. + + +```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