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

Res.socket is nil on CONNECT #48

Closed
igrigorik opened this issue Jun 19, 2012 · 4 comments
Closed

Res.socket is nil on CONNECT #48

igrigorik opened this issue Jun 19, 2012 · 4 comments

Comments

@igrigorik
Copy link
Contributor

Trying to figure out what's going here.. For some reason, if I issue a "CONNECT" query against the server, the response object does not have the socket? This fails later when we try to create the SYN_REPLY.

debug> n
< ...writeHead: undefined
break in node_modules/spdy/lib/spdy/response.js:34
 32   console.log('...writeHead: ' + this.socket)
 33 
 34   if (this._headerSent) return;
 35   this._headerSent = true;
 36 
debug> 

Frame example:

<   frame: 
<    { type: 'SYN_STREAM',
<      id: 1,
<      associated: 0,
<      priority: 0,
<      fin: false,
<      unidir: false,
<      _offset: 10,
<      headers: 
<       { host: 'google.com',
<         method: 'CONNECT',
<         path: 'google.com:443',
<         url: 'google.com:443',
<         version: 'HTTP/1.1',
<         'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.0 Safari/537.1' } },
<   writable: true,
<   readable: true }

Any ideas?

@eee-c
Copy link

eee-c commented Jun 20, 2012

What versions of node and node-spdy are you using?

@igrigorik
Copy link
Contributor Author

v0.7.10-pre for node.js. Checked out the latest and greatest v3 branch.. Tried with master and others, same behavior.

@eee-c
Copy link

eee-c commented Jun 20, 2012

What are you using for the upstream app? Node-spdy doesn't establish the request / response objects, but re-uses and decorates them. Still, I can't think why an upstream app wouldn't have a socket associated with it -- especially if it had called writeHead...

@igrigorik
Copy link
Contributor Author

Tracked it down... Turns out node's handling of upgrade and connect currently exposes a different API:
nodejs/node-v0.x-archive#3036

Current API: nodejs/node-v0.x-archive@08a91ac#L2R56

With that, got my code to work. Annoying, because I have to replicate the SYN_REPLY frame construction in my server, but does the trick. Speaking of which, we need to extend node-spdy to emit connect events -- I'll open a separate pull for that.

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

No branches or pull requests

2 participants