Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

The TLS API is inconsistent with the TCP API #1467

Closed
AndreasMadsen opened this issue Aug 7, 2011 · 17 comments
Closed

The TLS API is inconsistent with the TCP API #1467

AndreasMadsen opened this issue Aug 7, 2011 · 17 comments

Comments

@AndreasMadsen
Copy link
Member

To create a request using TLS the connect method should be used, to do the same with TCP the createConnection should be used. There are also no Socket constructor in the TLS API.

I would be nice if connect was renamed to createConnection and there was a Socket constructor in the TLS API.

@ry
Copy link

ry commented Aug 7, 2011

i like connect better. That should be added to the TCP API.

@AndreasMadsen
Copy link
Member Author

Well thats fine with me.
But I found another - when creating a request using createConnection using TCP there are emitted a connect event "when a socket connection successfully is established". However there are no such event in the TLS API.

I would be nice if the TLS connect function emitted a 'connect' or secureConnect event like the TCP API.

@AndreasMadsen
Copy link
Member Author

And there are no callback in the TCP 'createConnection' function.

It would be nice if the new connect function would have an additional callback argument: net.connect(port, host, callback)

@koichik
Copy link

koichik commented Aug 9, 2011

@AndreasMadsen - In v0.5, net.createConnection() has a callback.
http://nodejs.org/docs/v0.5.3/api/net.html#net.createConnection

with --use-uv, there is net.connect() (it is not documented yet).

exports.connect = exports.createConnection = function(port /* [host], [cb] */) {

@koichik
Copy link

koichik commented Aug 17, 2011

please review.

@AndreasMadsen
Copy link
Member Author

Nice that the 'connect' method is documented, but why have two names for the same function. Please consider to remove the documentation for 'createConnection' or just mark it deprecated.

But the TLS api still need to emit a 'connect' or a 'secureConnect' event, when a connection is made.
There also need documentation about the 'tls.Socket' constructor.

@koichik
Copy link

koichik commented Aug 17, 2011

@AndreasMadsen - Thanks for your review.
Because net.createConnection() is widely used, I do not want to remove it.
I marked it 'Deprecated'.

And I added 'secureConnect' event.
After d1a2628 was merged to the master, I document it.

@AndreasMadsen
Copy link
Member Author

The secureConnect is added but is not documented as I see it.
I also like the tls.CleartextStream documentation but I find it confusing that it is not merged to the master, I assume this is just a matter of time.

@koichik
Copy link

koichik commented Aug 18, 2011

@AndreasMadsen - v0.4 branch was merged to the master, then I added 'secureConnect' event to API docs.

@AndreasMadsen
Copy link
Member Author

I have nothing more to say.
Thanks.

@koichik
Copy link

koichik commented Aug 18, 2011

@ry or @bnoordhuis, can you review 0f12a91?

@koichik
Copy link

koichik commented Oct 15, 2011

Reabased.
Only 'secureConnect' event is added to tls.cleartextStream (net.connect() has documented, net_legacy has removed).
@ry @bnoordhuis - Can you review?

@bnoordhuis
Copy link
Member

@koichik: LGTM

@koichik
Copy link

koichik commented Oct 15, 2011

@bnoordhuis - Thanks!

@koichik
Copy link

koichik commented Oct 15, 2011

@AndreasMadsen - Thanks for the suggestion.

@AndreasMadsen
Copy link
Member Author

Nice to help

@koichik
Copy link

koichik commented Oct 15, 2011

Thanks!

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

No branches or pull requests

4 participants