GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test: check that --insecure-http-parser works · nodejs/node@ccf9038

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • test/parallel
    • test-http-insecure-parser-legacy.js
    • test-http-insecure-parser.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎test/parallel/test-http-insecure-parser-legacy.js‎

Copy file name to clipboard
+35Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// Flags: --insecure-http-parser --http-parser=legacy
2+
3+
'use strict';
4+
const common = require('../common');
5+
const assert = require('assert');
6+
const http = require('http');
7+
const net = require('net');
8+
9+
const server = http.createServer(function(req, res) {
10+
assert.strictEqual(req.headers['content-type'], 'text/te\bt');
11+
req.pipe(res);
12+
});
13+
14+
server.listen(0, common.mustCall(function() {
15+
const bufs = [];
16+
const client = net.connect(
17+
this.address().port,
18+
function() {
19+
client.write(
20+
'GET / HTTP/1.1\r\n' +
21+
'Content-Type: text/te\x08t\r\n' +
22+
'Connection: close\r\n\r\n');
23+
}
24+
);
25+
client.on('data', function(chunk) {
26+
bufs.push(chunk);
27+
});
28+
client.on('end', common.mustCall(function() {
29+
const head = Buffer.concat(bufs)
30+
.toString('latin1')
31+
.split('\r\n')[0];
32+
assert.strictEqual(head, 'HTTP/1.1 200 OK');
33+
server.close();
34+
}));
35+
}));
Collapse file

‎test/parallel/test-http-insecure-parser.js‎

Copy file name to clipboard
+35Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// Flags: --insecure-http-parser
2+
3+
'use strict';
4+
const common = require('../common');
5+
const assert = require('assert');
6+
const http = require('http');
7+
const net = require('net');
8+
9+
const server = http.createServer(function(req, res) {
10+
assert.strictEqual(req.headers['content-type'], 'text/te\bt');
11+
req.pipe(res);
12+
});
13+
14+
server.listen(0, common.mustCall(function() {
15+
const bufs = [];
16+
const client = net.connect(
17+
this.address().port,
18+
function() {
19+
client.write(
20+
'GET / HTTP/1.1\r\n' +
21+
'Content-Type: text/te\x08t\r\n' +
22+
'Connection: close\r\n\r\n');
23+
}
24+
);
25+
client.on('data', function(chunk) {
26+
bufs.push(chunk);
27+
});
28+
client.on('end', common.mustCall(function() {
29+
const head = Buffer.concat(bufs)
30+
.toString('latin1')
31+
.split('\r\n')[0];
32+
assert.strictEqual(head, 'HTTP/1.1 200 OK');
33+
server.close();
34+
}));
35+
}));

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.