Created
July 9, 2013 23:38
-
-
Save stash/5962276 to your computer and use it in GitHub Desktop.
Node script that pretends to send a 10 MiB JSON to an https server, but then just hangs there.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*jshint node:true */ | |
| 'use strict'; | |
| var tls = require('tls'); | |
| var auth = new Buffer('username:password').toString('base64'); | |
| var CRLF = "\r\n"; | |
| var opts = { | |
| host: '127.0.0.1', | |
| port: 443, | |
| servername: 'host', | |
| rejectUnauthorized: false | |
| }; | |
| var size = process.argv[2] || '10485760'; | |
| var sock = tls.connect(opts, function() { | |
| var head = [ | |
| 'POST /v1/apps/2/acl HTTP/1.1', | |
| 'Host: host', | |
| 'Authorization: Basic '+auth, | |
| 'Content-Type: application/json', | |
| 'Content-Length: '+size, | |
| '' | |
| ].join(CRLF) + CRLF; | |
| // process.stdout.write(head); | |
| sock.write(head); | |
| // just hang | |
| }); | |
| sock.pipe(process.stdout); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment