Skip to content

Surface server errors during SSL negotiation - #1348

Draft
aryansk wants to merge 1 commit into
MagicStack:masterfrom
aryansk:fix/1317-ssl-error-response
Draft

Surface server errors during SSL negotiation#1348
aryansk wants to merge 1 commit into
MagicStack:masterfrom
aryansk:fix/1317-ssl-error-response

Conversation

@aryansk

@aryansk aryansk commented Aug 16, 2026

Copy link
Copy Markdown

Summary

Preserve the PostgreSQL server's diagnostic when it returns an early error while asyncpg is waiting for the one-byte SSL negotiation response.

Changes

  • recognize pre-auth responses beginning with the PostgreSQL ErrorResponse marker (E)
  • decode and surface the server-provided text as an asyncpg InterfaceError
  • retain the existing S, advisory N, and generic fallback behavior
  • add a unit regression test using the reported pre-auth response shape

Test plan

python -m unittest tests.test_connect.TestTLSUpgradeProto.test_error_response_preserves_server_message

Fixes #1317

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.

TLSUpgradeProto.data_received hides PostgreSQL ErrorResponse behind generic 'rejected SSL upgrade' ConnectionError

1 participant