Skip to content

Instantly share code, notes, and snippets.

@jan-osch
Created December 12, 2018 13:32
Show Gist options
  • Save jan-osch/e43474441ce50f94e70c76a8d11cff05 to your computer and use it in GitHub Desktop.
Save jan-osch/e43474441ce50f94e70c76a8d11cff05 to your computer and use it in GitHub Desktop.
#!/usr/bin/env node
/* eslint-disable no-console */
const superagent = require('superagent');
const stream = require('stream');
// Tests if the server is not vulnerable for this issue
// https://github.com/expressjs/body-parser/blob/master/README.md#request-aborted
const main = async () => {
const request = superagent.post('http://localhost:8001/v1/rexio')
.set('Content-Type', 'application/octet-stream');
const s = new stream.Transform({
transform(data, encoding, callback) {
this.push(data);
callback();
},
});
setInterval(() => {
s.write('f');
}, 10);
s.pipe(request);
setTimeout(() => {
request.abort();
process.exit(0);
}, 1000);
};
main();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment