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: remove the use of curl in the test suite · nodejs/node@a19de97

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • test/parallel
    • test-http-304.js
    • test-http-chunk-problem.js
    • test-http-curl-chunk-problem.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎test/parallel/test-http-304.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-http-304.js
-18Lines changed: 0 additions & 18 deletions
This file was deleted.
Collapse file

‎test/parallel/test-http-chunk-problem.js‎

Copy file name to clipboard
+93Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
'use strict';
2+
// http://groups.google.com/group/nodejs/browse_thread/thread/f66cd3c960406919
3+
const common = require('../common');
4+
const assert = require('assert');
5+
if (!common.hasCrypto) {
6+
console.log('1..0 # Skipped: missing crypto');
7+
return;
8+
}
9+
10+
if (process.argv[2] === 'request') {
11+
const http = require('http');
12+
const options = {
13+
port: common.PORT,
14+
path : '/'
15+
};
16+
17+
http.get(options, (res) => {
18+
res.pipe(process.stdout);
19+
});
20+
21+
return;
22+
}
23+
24+
if (process.argv[2] === 'shasum') {
25+
const crypto = require('crypto');
26+
const shasum = crypto.createHash('sha1');
27+
process.stdin.on('data', (d) => {
28+
shasum.update(d);
29+
});
30+
31+
process.stdin.on('close', () => {
32+
process.stdout.write(shasum.digest('hex'));
33+
});
34+
35+
return;
36+
}
37+
38+
const http = require('http');
39+
const cp = require('child_process');
40+
41+
const filename = require('path').join(common.tmpDir, 'big');
42+
43+
function executeRequest(cb) {
44+
cp.exec([process.execPath,
45+
__filename,
46+
'request',
47+
'|',
48+
process.execPath,
49+
__filename,
50+
'shasum' ].join(' '),
51+
(err, stdout, stderr) => {
52+
if (err) throw err;
53+
assert.equal('8c206a1a87599f532ce68675536f0b1546900d7a',
54+
stdout.slice(0, 40));
55+
cb();
56+
}
57+
);
58+
}
59+
60+
61+
common.refreshTmpDir();
62+
63+
const ddcmd = common.ddCommand(filename, 10240);
64+
65+
cp.exec(ddcmd, function(err, stdout, stderr) {
66+
if (err) throw err;
67+
const server = http.createServer(function(req, res) {
68+
res.writeHead(200);
69+
70+
// Create the subprocess
71+
const cat = cp.spawn('cat', [filename]);
72+
73+
// Stream the data through to the response as binary chunks
74+
cat.stdout.on('data', (data) => {
75+
res.write(data);
76+
});
77+
78+
cat.stdout.on('end', () => res.end());
79+
80+
// End the response on exit (and log errors)
81+
cat.on('exit', (code) => {
82+
if (code !== 0) {
83+
console.error('subprocess exited with code ' + code);
84+
process.exit(1);
85+
}
86+
});
87+
88+
});
89+
90+
server.listen(common.PORT, () => {
91+
executeRequest(() => server.close());
92+
});
93+
});
Collapse file

‎test/parallel/test-http-curl-chunk-problem.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-http-curl-chunk-problem.js
-71Lines changed: 0 additions & 71 deletions
This file was deleted.

0 commit comments

Comments
0 (0)
You are visitor 01402520 — 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.