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

backend, net: return handshake errors to the client #294

Merged
merged 3 commits into from
May 31, 2023

Conversation

djshow832
Copy link
Collaborator

@djshow832 djshow832 commented May 30, 2023

What problem does this PR solve?

Issue Number: close #188

Problem Summary:
Some errors are not returned to the client, compared with TiDB.

What is changed and how it works:

  • Move UserError from package backend to net because net uses it.
  • Return ErrNotSupportedAuthMode to the client when frontend capability mismatches. This is consistent with TiDB.
  • Return ErrMalformPacket when packet size is less than 32. This is consistent with TiDB.
  • Return error to the client when TLS handshake fails. This is consistent with TiDB.
  • Embed logger into PacketIO.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Notable changes

  • Has configuration change
  • Has HTTP API interfaces change
  • Has tiproxyctl change
  • Other user behavior changes

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

@djshow832 djshow832 requested a review from xhebox May 30, 2023 09:50
Comment on lines -127 to -129
if len(pkt) <= 32 {
return errors.WithStack(errors.New("expect handshake resp"))
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is already checked in ReadSSLRequestOrHandshakeResp.

@djshow832 djshow832 requested a review from xhebox May 31, 2023 04:00
@xhebox xhebox merged commit 8d06a7a into pingcap:main May 31, 2023
@djshow832 djshow832 deleted the hs_err branch May 31, 2023 07:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Send the error message to the client whenever there's a handshake error
2 participants