Skip to content

Instantly share code, notes, and snippets.

@matthewp
Last active June 23, 2017 18:05
Show Gist options
  • Save matthewp/d5a26ba620fc921754f3ba4892a9b230 to your computer and use it in GitHub Desktop.
Save matthewp/d5a26ba620fc921754f3ba4892a9b230 to your computer and use it in GitHub Desktop.
spdy crash bug
node_modules/
console.log("hello world");
<!doctype html>
<html lang="en">
<h1>Hello world!</h1>
var fs = require("fs");
var spdy = require("spdy");
var os = require("os");
function getc(pth) {
var p = os.homedir() + pth;
return fs.readFileSync(p);
}
var server = spdy.createServer({
key: getc("/.localhost-ssl/private.pem"),
cert: getc("/.localhost-ssl/cert.pem"),
spdy: {
protocols: ["h2", "http/1.1"]
}
}, onRequest);
server.listen(8001);
function onRequest(req, res) {
for(var i = 1; i <= 51 ;i++) {
var f = "/" + i;
var s = res.push(f, {
request: { accept: '/' },
response: {
'content-type': 'application/javascript'
}
});
s.on('error',function(){});
fs.createReadStream("./app.js",{autoClose:true}).pipe(s);
}
fs.createReadStream("./index.html",{autoClose:true}).pipe(res);
}
{
"name": "node-spdy-break",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"spdy": "^3.4.7"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment