diff --git a/src/backend/libpq/be-secure.c b/src/backend/libpq/be-secure.c index b7000a653a1..8e8d745a00f 100644 --- a/src/backend/libpq/be-secure.c +++ b/src/backend/libpq/be-secure.c @@ -736,6 +736,12 @@ initialize_SSL(void) (errmsg("could not create SSL context: %s", SSLerrmessage()))); + /* + * Disable OpenSSL's moving-write-buffer sanity check, because it + * causes unnecessary failures in nonblocking send cases. + */ + SSL_CTX_set_mode(SSL_context, SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER); + /* * Load and verify server's certificate and private key */ diff --git a/src/interfaces/libpq/fe-secure.c b/src/interfaces/libpq/fe-secure.c index eacf9c62c60..fa911f9f643 100644 --- a/src/interfaces/libpq/fe-secure.c +++ b/src/interfaces/libpq/fe-secure.c @@ -757,6 +757,12 @@ init_ssl_system(PGconn *conn) #endif return -1; } + + /* + * Disable OpenSSL's moving-write-buffer sanity check, because it + * causes unnecessary failures in nonblocking send cases. + */ + SSL_CTX_set_mode(SSL_context, SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER); } #ifdef ENABLE_THREAD_SAFETY