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

Socket.encrypted documentation #41863

Closed
tobidelius opened this issue Feb 5, 2022 · 3 comments
Closed

Socket.encrypted documentation #41863

tobidelius opened this issue Feb 5, 2022 · 3 comments
Labels
doc Issues and PRs related to the documentations. question Issues that look for answers.

Comments

@tobidelius
Copy link

Affected URL(s)

https://nodejs.org/api/net.html#class-netsocket

Description of the problem

From what I can see people are using req.connection.encrypted or req.socket.encrypted to check it the request is http or https but I cannot find any reference to this in the documentation.

Is this the way to do it or is there another way? I cannot find anyone that actually knows :)

@tobidelius tobidelius added the doc Issues and PRs related to the documentations. label Feb 5, 2022
@VoltrexKeyva VoltrexKeyva added the net Issues and PRs related to the net subsystem. label Feb 5, 2022
@Mesteery
Copy link
Contributor

Mesteery commented Feb 5, 2022

It's document here: https://nodejs.org/api/tls.html#tlssocketencrypted.
When it's https, tls is used instead of net, that's why encrypted comes from here (and so encrypted is undefined when it's http, because net doesn't define this property).

I don't know if this answers your question.

@Mesteery Mesteery closed this as completed Feb 5, 2022
@Mesteery Mesteery reopened this Feb 5, 2022
@Mesteery Mesteery added question Issues that look for answers. and removed net Issues and PRs related to the net subsystem. labels Feb 5, 2022
@tobidelius
Copy link
Author

Ahh, thank you for the clarification.

@lobsterkatie
Copy link

Landed here because I had the same question. Would it be possible to reopen this until a note can be added to request.socket to say that it will be net.socket when the protocol is http and tls.socket when the protocol is https?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Issues and PRs related to the documentations. question Issues that look for answers.
Projects
None yet
Development

No branches or pull requests

4 participants