Last night I was able to confirm that express-spdy does not work with node.js installs that are built against older versions of openssl (i.e. those that lack NPN / Next Protocol Negotiation). I set off down the rabbit hole of trying to get exress-spdy to not install if it detected an older openssl, but was not able to get that working.
Tonight, I am abandoning that effort and instead following the advice of Fedor Indutny, node.js coder extraordinaire and author of the very excellent node-spdy package. He suggested that I drop my efforts in the node.js stable branch in favor of the unstable 0.7.x series. The 0.7.x bundles an NPN capable openssl. It has the additional benefit of node-spdy 1.0. I had planned on playing with that eventually. Now seems a good time.
So, in a temporary directory, I install node-spdy:
➜ tmp cd ➜ ~ cd ~/tmp ➜ tmp mkdir node-spdy-test ➜ tmp cd !$ ➜ tmp cd node-spdy-test ➜ node-spdy-test which node /home/chris/local/node-v0.7.7/bin/node ➜ node-spdy-test npm install spdy npm http GET https://registry.npmjs.org/spdy npm http 304 https://registry.npmjs.org/spdy npm http GET https://registry.npmjs.org/spdy/-/spdy-1.2.0.tgz npm http 200 https://registry.npmjs.org/spdy/-/spdy-1.2.0.tgz spdy@1.2.0 ./node_modules/spdyThe, I define a simple server in
app.js
:var spdy = require('spdy'), fs = require('fs'); var options = { key: fs.readFileSync(__dirname + '/keys/jaynestown.key'), cert: fs.readFileSync(__dirname + '/keys/jaynestown.crt'), ca: fs.readFileSync(__dirname + '/keys/jaynestown.csr') }; var server = spdy.createServer(options, function(req, res) { res.writeHead(200); res.end('hello world!'); }); server.listen(3000);And, lastly, I run that server:
➜ node-spdy-test node app.jsChecking things out in the SPDY tab of Chrome's
about:net-internals
, I see a nice, legit SPDY session:t=1334632829005 [st= 0] SPDY_SESSION_PING --> type = "sent" --> unique_id = 3 t=1334632829005 [st= 0] SPDY_SESSION_SYN_STREAM --> flags = 1 --> accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 accept-charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3 accept-encoding: gzip,deflate,sdch accept-language: en-US,en;q=0.8 cache-control: no-cache host: jaynestown.local:3000 method: GET pragma: no-cache scheme: https url: / user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/536.6 (KHTML, like Gecko) Chrome/20.0.1096.1 Safari/536.6 version: HTTP/1.1 --> id = 5 t=1334632829011 [st= 6] SPDY_SESSION_PING --> type = "received" --> unique_id = 3 t=1334632829048 [st= 43] SPDY_SESSION_SYN_REPLY --> flags = 0 --> status: 200 OK version: HTTP/1.1 --> id = 5 ...Dang, that was nice and easy.
Day #358
This comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
ReplyDelete