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

bug: (*Conn).Handshake() is called upon (*UConn).Read() #291

Closed
gaukas opened this issue Apr 10, 2024 · 3 comments · Fixed by #292
Closed

bug: (*Conn).Handshake() is called upon (*UConn).Read() #291

gaukas opened this issue Apr 10, 2024 · 3 comments · Fixed by #292
Assignees
Labels
bug Unexpected behavior confirmed and should be fixed

Comments

@gaukas
Copy link
Contributor

gaukas commented Apr 10, 2024

This should be considered a high priority bug.

In crypto/tls, upon calling (*Conn).Read(), (*Conn).Handshake() will be called if TLS handshake is not yet performed.

However, UConn in uTLS did not correctly inherit this behavior. By fully inheriting (*Conn).Read(), it also calls (*Conn).Handshake() instead of (*UConn).Handshake(), where the latter is the function performing a uTLS handshake and the former one performs default crypto/tls handshake.

@gaukas gaukas added the bug Unexpected behavior confirmed and should be fixed label Apr 10, 2024
@gaukas gaukas self-assigned this Apr 10, 2024
@gaukas
Copy link
Contributor Author

gaukas commented Apr 10, 2024

This behavior is not restricted to Read(), but also multiple other functions where UConn directly inherits from Conn.

@guysv
Copy link

guysv commented Apr 10, 2024

but basically if you explicitly call UConn.Handshake before UConn.Read you're good right?

@gaukas
Copy link
Contributor Author

gaukas commented Apr 10, 2024

but basically if you explicitly call UConn.Handshake before UConn.Read you're good right?

Correct. This issue is more about an inconsistent behavior that when someone switch from crypto/tls to uTLS, where the former does not require an explicit call to Handshake, uTLS may use the default version of handshake if Handshake() is not explicitly called.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unexpected behavior confirmed and should be fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants