Skip to content

Commit 0825564

Browse files
committed
http: fixed invalid path with connect method
Added tests Fixes: nodejs#34347
1 parent edd8f6e commit 0825564

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
'use strict';
2+
3+
const common = require('../common');
4+
const assert = require('assert');
5+
const http = require('http');
6+
7+
const server = http.createServer();
8+
9+
server.on('connect', common.mustCall((req, stream) => {
10+
assert.notStrictEqual(req.url.charAt(0), '/');
11+
stream.end();
12+
}));
13+
14+
server.listen(0);
15+
16+
server.on('listening', common.mustCall(() => {
17+
const url = new URL(`http://localhost:${server.address().port}/example.com`);
18+
19+
const req = http.request(url, {method: 'CONNECT'}).end();
20+
req.once('connect', common.mustCall(res => {
21+
res.destroy();
22+
server.close();
23+
}))
24+
}));
25+

0 commit comments

Comments
 (0)