Skip to content

Conversation

@indutny
Copy link
Member

Fix: #1499

@indutny
Copy link
MemberAuthor

cc @nodejs/crypto @nodejs/collaborators

@brendanashworthbrendanashworth added tls Issues and PRs related to the tls subsystem. https Issues or PRs related to the https subsystem. labels Jul 23, 2015
lib/https.js Outdated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If session is the only one being set, maybe it is worth it to just use options.session = options.session || ...?

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, but we usually try to avoid changing the objects that are passed to the function.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we already make a copy, that's why I'm asking. :) Not trying to be a stickler - you could say that call and I go back a little bit.

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha, I'd leave it as it is. Performance impact is minimal here.

@brendanashworth
Copy link
Contributor

Can this cause a memory leak for servers that make a lot of TLS connections to different servers?

@indutny
Copy link
MemberAuthor

@brendanashworth good catch! I'll revise it tomorrow

@indutny
Copy link
MemberAuthor

@brendanashworth added limit ;)

@indutny
Copy link
MemberAuthor

Any further comments @brendanashworth ? cc @bnoordhuis@shigeki ;)

@brendanashworth
Copy link
Contributor

@indutny 'tis cool and a great improvement on before :) but I'm not comfortable reviewing, too complicated - no further comments. Can't wait to see this merged!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW Buffer.compare() is still fairly slow right now and using a manual for-loop in js land is faster.

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't there an edge case if socket.getSession() returns null?

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, @shigeki !

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After some consideration - I don't think that it might be the case at this point in runtime. But I will add guard just in case.

@shigeki
Copy link
Contributor

I made several tests with/without resumption against my https server and confirmed this works fine. Good job. I put small comments for fix but LGTM.
It's not an issue but I found that TLSSocket.getPeerCertificate() returns an empty object because a server does not sent Certificate to a client in resumption. It is caused by protocol spec itself but we have to care what information is lost in resumption.

@indutny
Copy link
MemberAuthor

Thanks everyone! May I ask you to take one last look at this before I'll land it?

@indutny
Copy link
MemberAuthor

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't care if you make this change, but could use return session.equals(next); (assuming they're both buffers).

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I'll use next.equals() here.

Fix: nodejs#1499 PR-URL: nodejs#2228 Reviewed-By: Shigeki Ohtsu <[email protected]> Reviewed-By: Trevor Norris <[email protected]>
@indutny
Copy link
MemberAuthor

@trevnorris fixed

@trevnorris
Copy link
Contributor

LGTM

indutny added a commit that referenced this pull request Jul 27, 2015
Fix: #1499 PR-URL: #2228 Reviewed-By: Shigeki Ohtsu <[email protected]> Reviewed-By: Trevor Norris <[email protected]>
@indutny
Copy link
MemberAuthor

Landed in 2ca5a3d, thank you everyone!

@indutnyindutny closed this Jul 27, 2015
@indutnyindutny deleted the fix/gh-1499 branch July 27, 2015 18:48
@cjihrigcjihrig mentioned this pull request Jul 28, 2015
nicolas-moteau added a commit to Orange-OpenSource/node that referenced this pull request Mar 6, 2019
BridgeAR pushed a commit to BridgeAR/node that referenced this pull request Mar 6, 2019
PR-URL: nodejs#26433 Refs: nodejs#2228 Refs: nodejs#4252 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
BridgeAR pushed a commit to BridgeAR/node that referenced this pull request Mar 12, 2019
PR-URL: nodejs#26433 Refs: nodejs#2228 Refs: nodejs#4252 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
BridgeAR pushed a commit that referenced this pull request Mar 14, 2019
PR-URL: #26433 Refs: #2228 Refs: #4252 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

httpsIssues or PRs related to the https subsystem.tlsIssues and PRs related to the tls subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@indutny@brendanashworth@shigeki@trevnorris@mscdex@thefourtheye