2
0
Commit Graph

23 Commits

Author SHA1 Message Date
Martin Ashby 9275da562f Added FunctionCall support
Added support for FunctionCall message as per
https://www.postgresql.org/docs/11/protocol-message-formats.html

Adds unit test for Encode / Decode cycle and invalid message format
errors.

Fixes https://github.com/jackc/pgproto3/issues/23
2021-11-06 16:39:43 -05:00
Jack Christensen aaef9bbc35 Merge branch 'master' into backend-unexpected-eof 2021-07-06 20:07:55 -05:00
Yuli Khodorkovskiy 2d3823838e Perform StartupMessage length validation
PG provides a maximum size for a StartupMessage:
https://doxygen.postgresql.org/pqcomm_8h.html#a4c50c668c551887ac3a49872130349e3

Limiting the size ensures a malicious user doesn't send an
overwhelmingly large StartupMessage which could DOS a Go binary that
uses pgproto3.
2021-07-06 20:01:33 -05:00
Yuli Khodorkovskiy 10c6c50ac9 Extend handling of unexpected EOF to the backend
In the original issue [1] and commit [2], support for unexpected EOF was
added to the frontend to detect when a connection was closed abruptly.
Additionally, this allows us to differentiate normal io.EOF errors with
unexpected errors in the backend.

[1] https://github.com/jackc/pgx/issues/662/
[2] https://github.com/jackc/pgproto3/commit/595780be0f9f581451a23a5151b77f782202ad72
2021-07-01 17:53:14 -04:00
Yuli Khodorkovskiy 7c9e840726 Add support for identifying authentication messages
The pgprotocol overloads 'p' messages with PasswordMessage,
SASLInitialResponse, SASLResponse, and GSSResponse. This patch allows
contextual identification of the message by setting the authType in the
frontend and then setting this value in the backend when a
AuthenticationResponseMessage is received.
2021-06-12 13:54:34 -05:00
Roman Tkachenko 88b6398594 Add CopyData and CopyDone messages support to Backend 2020-11-17 16:57:05 -06:00
Jack Christensen fede0ce5d6 Document that received messages are only valid until the next receive. 2020-09-05 11:30:23 -05:00
Yuli Khodorkovskiy e6b823d649 Add missing GSSEncRequest 2019-12-17 20:21:57 -05:00
Jack Christensen 439ea11d47 NewFrontend and NewBackend cannot fail 2019-08-31 14:49:55 -05:00
Jack Christensen 2bc8f2e6af Remove pkg/errors package 2019-08-31 11:53:26 -05:00
Jack Christensen 1ba5dcbe01 Support SSLRequest and CancelRequest 2019-08-31 11:48:01 -05:00
Jack Christensen 432c2951c7 Add a lot of documentation 2019-06-08 19:38:34 -05:00
Jack Christensen a340d5f15f CopyFail should be frontend message 2019-05-17 13:27:11 -05:00
Jack Christensen 4acc0f54c6 Import fixes from pgx/pgproto3
Import and adapt commit: fbb8cce
2019-05-03 14:07:55 -05:00
Jack Christensen bb06e6b3ff Decouple github.com/jackc/chunkreader 2019-03-30 12:46:56 -05:00
Jack Christensen 16176b5151 Add go module support 2019-03-30 12:26:24 -05:00
Jack Christensen 440fbf1581 Include missed changes 2019-01-26 12:21:54 -06:00
Jack Christensen b3d0cbd0e6 Fix reading interrupted messages
When an message is received and a timeout occurs after reading the
header but before reading the entire body the connection state could
be corrupted due to the header being consumed. The next read would
consider the body of the previous message as the header for the next.

fixes #348
2017-12-16 13:45:22 -06:00
Jack Christensen ffa9ff2213 Use github.com/pkg/errors 2017-06-04 21:30:03 -05:00
Jack Christensen d6312305ae Replace MarshalBinary with Encode
This new approach can avoid allocations.
2017-05-26 17:00:44 -05:00
Jack Christensen b1934ad4c2 Add flush and close messages to pgproto3 2017-05-19 17:31:22 -05:00
Jack Christensen 61d4386931 Update pgproto3 to enable pgmock 2017-05-06 08:48:40 -05:00
Jack Christensen d25abf5674 Add pgproto3.Backend 2017-05-01 18:11:55 -05:00