Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

protocol error w/ io.js 2.40 #36

Closed
boneskull opened this issue Jul 24, 2015 · 6 comments
Closed

protocol error w/ io.js 2.40 #36

boneskull opened this issue Jul 24, 2015 · 6 comments

Comments

@boneskull
Copy link

see GraftJS/graft#19

events.js:141
      throw er; // Unhandled 'error' event
            ^
Error: Protocol "http:" not supported. Expected "https:".
    at new ClientRequest (_http_client.js:53:11)
    at Object.exports.request (http.js:31:10)
    at ClientSession.newStream [as _createNewStream] (/Volumes/alien/projects/digs/digs-graft/node_modules/jschan/lib/spdy/client.js:104:18)
    at createChannel (/Volumes/alien/projects/digs/digs-graft/node_modules/jschan/lib/spdy/client.js:143:11)
    at ClientSession.WriteChannel (/Volumes/alien/projects/digs/digs-graft/node_modules/jschan/lib/spdy/client.js:157:10)
    at SPDYClient.Client._write (/Volumes/alien/projects/digs/digs-graft/node_modules/graft/lib/client.js:36:30)
    at doWrite (/Volumes/alien/projects/digs/digs-graft/node_modules/graft/node_modules/readable-stream/lib/_stream_writable.js:279:12)
    at writeOrBuffer (/Volumes/alien/projects/digs/digs-graft/node_modules/graft/node_modules/readable-stream/lib/_stream_writable.js:266:5)
    at SPDYClient.Writable.write (/Volumes/alien/projects/digs/digs-graft/node_modules/graft/node_modules/readable-stream/lib/_stream_writable.js:211:11)
    at Graft.ondata (/Volumes/alien/projects/digs/digs-graft/node_modules/graft/node_modules/readable-stream/lib/_stream_readable.js:572:20)

@boneskull
Copy link
Author

working on PR

@boneskull
Copy link
Author

nevermind, can't figure it out. there's some disagreement between the latest version of spdy, io.js, and jschan.

I'm getting a bunch of this:

TypeError: Cannot read property 'session' of undefined
    at Server.<anonymous> (/Volumes/alien/projects/boneskull/jschan/lib/spdy/server.js:178:43)
    at emitTwo (events.js:87:13)
    at Server.emit (events.js:172:7)
    at Connection.onrequest (/Volumes/alien/projects/boneskull/jschan/node_modules/spdy/lib/spdy/server.js:293:10)
    at emitTwo (events.js:87:13)
    at Connection.emit (events.js:172:7)
    at HTTPParser.parserOnIncoming [as onIncoming] (_http_server.js:473:12)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:88:23)
    at Stream.start [as _start] (/Volumes/alien/projects/boneskull/jschan/node_modules/spdy/lib/spdy/stream.js:249:23)
    at Connection.handleSynStream [as _handleSynStream] (/Volumes/alien/projects/boneskull/jschan/node_modules/spdy/lib/spdy/connection.js:299:10)
    at Connection.handleFrame [as _handleFrame] (/Volumes/alien/projects/boneskull/jschan/node_modules/spdy/lib/spdy/connection.js:182:19)
    at emitOne (events.js:77:13)
    at Parser.emit (events.js:169:7)
    at onFrame (/Volumes/alien/projects/boneskull/jschan/node_modules/spdy/lib/spdy/protocol/parser.js:232:12)
    at /Volumes/alien/projects/boneskull/jschan/node_modules/spdy/lib/spdy/protocol/parser.js:333:5
    at /Volumes/alien/projects/boneskull/jschan/node_modules/spdy/lib/spdy/protocol/parser.js:427:5
    at done (/Volumes/alien/projects/boneskull/jschan/node_modules/spdy/lib/spdy/utils.js:111:7)
    at afterWrite (_stream_writable.js:346:3)
    at onwrite (_stream_writable.js:337:7)
    at WritableState.onwrite (_stream_writable.js:89:5)
    at afterTransform (_stream_transform.js:79:5)
    at TransformState.afterTransform (_stream_transform.js:54:12)
    at Zlib.callback (zlib.js:614:5)

When I try to use req.connection.socket.getSession(), that doesn't work either because it's not the same socket from the connection event, so _receive is undefined.

In ClientSession.prototype._createNewStream(), I did this:

  var req = http.request({
    host: this.opts.host,
    port: this.opts.port,
    path: '/',
    headers: headers,
    method: 'POST',
    agent: this.agent,
    protocol: 'https:' // <-- this
  }, function(res) {
    chan.handleIn(res);
  });

to avoid the original exception, but I think that alters how spdy works, leading to this other issue

@boneskull
Copy link
Author

perhaps jschan should drop spdy altogether:

nodejs/NG#8

@AdrianRossouw
Copy link
Contributor

I think that's the plan, but we were waiting for a proper http2 implementation to be available.

@mcollina
Copy link
Contributor

@AdrianRossouw
Copy link
Contributor

i moved the spdy support to https://github.com/GraftJS/jschan-spdy, so we can switch out when needed.

this should also not stop you from using jschan anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants