spdy-http2 / node-spdy

SPDY server on Node.js
2.81k stars 196 forks source link

Setting plain option throws TypeError #76

Closed joelcox closed 11 years ago

joelcox commented 11 years ago

Hey there,

When I create a SPDY server using the latest (1.4.1) version of this module and setting the plain option, visiting the page in the latest Chrome/Firefox will throw the following stack trace.

../node_modules/spdy/lib/spdy/zlib-pool.js:54
  self.pool[version].push(pair);
                     ^
TypeError: Cannot call method 'push' of undefined
at done (../node_modules/spdy/lib/spdy/zlib-pool.js:54:26)
at Object.resetZlibStream (/Users/joelcox/Desktop/lab-5-spdy/node_modules/spdy/lib/spdy/utils.js:57:3)
at Pool.put (../node_modules/spdy/lib/spdy/zlib-pool.js:50:14)
at Socket.onclose (../node_modules/spdy/lib/spdy/server.js:291:10)
at Socket.EventEmitter.emit (events.js:115:20)
at Socket._destroy.destroyed (net.js:358:10)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)

This happens both for spdy/2 and for spdy/3

var spdyOptions = {
    plain: 'spdy/3',
    windowSize: 1024,
};

var spdyServer = spdy.createServer(spdyOptions, app);
spdyServer.listen(8001);

Running the same Express application over an encrypted SPDY connection works as expected.

indutny commented 11 years ago

Thank you, fixed in @1.4.4

joelcox commented 11 years ago

Thanks for your quick response Fedor, but I still have some issues when using 1.4.4. Would you like me to create a new issue for this?

stream.js:74
    dest.destroy();
         ^
TypeError: Object #<Parser> has no method 'destroy'
    at Socket.onclose (stream.js:74:10)
    at Socket.EventEmitter.emit (events.js:115:20)
    at Socket._destroy.destroyed (net.js:358:10)
    at process.startup.processNextTick.process._tickCallback (node.js:244:9)

Both the latest Chrome Canary and Firefox choke when trying to visit the page

Error 324 (net::ERR_EMPTY_RESPONSE): The server closed the connection without sending any data.
indutny commented 11 years ago

What node.js version are you using?

joelcox commented 11 years ago

This is on node v0.8.1

indutny commented 11 years ago

It's very very old and retarded :) Use a fresh one, please. (0.8.18)

joelcox commented 11 years ago

True, but the requirements for this module only states it supports node 0.7 and up ;-)

Anyway, I updated to Node 0.8.18, which gets rid of the error message, but the request still seems to time out in both Firefox and Chrome. What would be the best way to get you the data you need? I tried looking for a compatibility test suite, but there seems to be none.

indutny commented 11 years ago

Well, can you give me some sources to reproduce it? Small test case, better if reduced.

joelcox commented 11 years ago

This code I'm using is the exact code from the README, with the key options removed and the plain option added:

➜  lab-5-spdy git:master ✗ node -v
v0.8.18
➜  lab-5-spdy git:master ✗ npm install spdy@1.4.4
npm http GET https://registry.npmjs.org/spdy/1.4.4
npm http 304 https://registry.npmjs.org/spdy/1.4.4
spdy@1.4.4 node_modules/spdy
➜  lab-5-spdy git:master ✗ cat spdy.js 
var spdy = require('spdy'),
    fs = require('fs');

var options = {
  plain: 'spdy/3',
  // SPDY-specific options
  windowSize: 1024, // Server's window size
};

var server = spdy.createServer(options, function(req, res) {
  res.writeHead(200);
  res.end('hello world!');
});

server.listen(8000);
indutny commented 11 years ago

Ah, I think I got it. Have you setup a TLS-terminating proxy in front of spdy server, or are you just trying to connect to it directly?

joelcox commented 11 years ago

Nope, I'm trying to connect to it directly.

On Feb 9, 2013, at 11:50 AM, Fedor Indutny notifications@github.com wrote:

Ah, I think I got it. Have you setup a TLS-terminating proxy in front of spdy server, or are you just trying to connect to it directly?

— Reply to this email directly or view it on GitHub..

indutny commented 11 years ago

So, why are you using plain then? :)

joelcox commented 11 years ago

I was under the impression that running a TLS proxy wasn't required, my bad. Thanks for your help.