1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-19 23:22:23 +03:00

libpq: Trace responses to SSLRequest and GSSENCRequest

Since these are single bytes instead of v2 or v3 messages they need
custom tracing logic.  These "messages" don't even have official names
in the protocol specification, so I (Jelte) called them SSLResponse and
GSSENCResponse here.

Author: Jelte Fennema-Nio <postgres@jeltef.nl>
Discussion: https://postgr.es/m/CAGECzQSoPHtZ4xe0raJ6FYSEiPPS+YWXBhOGo+Y1YecLgknF3g@mail.gmail.com
This commit is contained in:
Alvaro Herrera
2024-08-14 14:53:55 -04:00
parent 5304fec4d8
commit a5c6b8f22c
3 changed files with 36 additions and 0 deletions

View File

@@ -840,3 +840,23 @@ pqTraceOutputNoTypeByteMessage(PGconn *conn, const char *message)
fputc('\n', conn->Pfdebug);
}
/*
* Trace a single-byte backend response received for a known request
* type the frontend previously sent. Only useful for the simplest of
* FE/BE interaction workflows such as SSL/GSS encryption requests.
*/
void
pqTraceOutputCharResponse(PGconn *conn, const char *responseType,
char response)
{
if ((conn->traceFlags & PQTRACE_SUPPRESS_TIMESTAMPS) == 0)
{
char timestr[128];
pqTraceFormatTimestamp(timestr, sizeof(timestr));
fprintf(conn->Pfdebug, "%s\t", timestr);
}
fprintf(conn->Pfdebug, "B\t1\t%s\t %c\n", responseType, response);
}