0002-fix-gssapi-chunking-failure.patch
text/x-diff
Filename: 0002-fix-gssapi-chunking-failure.patch
Type: text/x-diff
Part: 1
Patch
Format: unified
Series: patch 0002
| File | + | − |
|---|---|---|
| src/interfaces/libpq/fe-misc.c | 13 | 1 |
diff --git a/src/interfaces/libpq/fe-misc.c b/src/interfaces/libpq/fe-misc.c
index 660cdec93c..5a74a95968 100644
--- a/src/interfaces/libpq/fe-misc.c
+++ b/src/interfaces/libpq/fe-misc.c
@@ -541,7 +541,19 @@ pqPutMsgEnd(PGconn *conn)
if (conn->outCount >= 8192)
{
- int toSend = conn->outCount - (conn->outCount % 8192);
+ int toSend = conn->outCount;
+
+ /*
+ * Normally we only send full 8K blocks. However, if we don't present
+ * the last partial block we can trigger pg_GSS_write's "failed to
+ * retransmit all data" failure, since rounding toSend down could
+ * result in not presenting some data that we did present on an
+ * earlier try. The full-block heuristic is pretty useless anyway
+ * when encrypting, since encryption overhead will throw off the
+ * number. Hence, in GSSAPI mode just send all we have.
+ */
+ if (!conn->gssenc)
+ toSend -= toSend % 8192;
if (pqSendSome(conn, toSend) < 0)
return EOF;