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

Cannot implement strict TLS over request.js #240

Closed
olygofren opened this issue Jan 11, 2016 · 2 comments
Closed

Cannot implement strict TLS over request.js #240

olygofren opened this issue Jan 11, 2016 · 2 comments

Comments

@olygofren
Copy link

It seems that node-spdy on both client and server side hides the actual TLSSocket object in a fake net.Socket through a spdy.Handle. However, request.js (quite possibly other libraries too) and even my application code assume that if TLS is involved, sockets available on req/res objects will actually be TLSSockets. This causes code like:

if (req.socket.authorized) ... 
... req.socket.getPeerCertificate() ...

to fail, hence no strict TLS can be implemented without drilling down into node-spdy internals.

So I guess my question is, why the wrapping? Is there any workaround that will allow me to implement strict TLS?

@indutny
Copy link
Collaborator

indutny commented Jan 13, 2016

Should be fixed, sorry about this!

The wrapping is required because of the nature of the HTTP2/SPDY protocol. The multiplex multiple requests over the same TLS connection, and the easiest way to present this to node.js is to emulate the socket for each multiplexed request. Thus each request is getting emulated socket, not a real one.

I have added all necessary properties and methods to the emulated socket. Please let me know if it works or doesn't.

Thank you!

@olygofren
Copy link
Author

Thanks, I'll give it a try as soon as I get the opportunity. Code seems fine.

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