diff --git a/doc/src/sgml/libpq.sgml b/doc/src/sgml/libpq.sgml new file mode 100644 index 3d5f98b..37b838d *** a/doc/src/sgml/libpq.sgml --- b/doc/src/sgml/libpq.sgml *************** PGconn *PQconnectdbParams(const char * c *** 494,499 **** --- 494,516 ---- + + sslcompression + + + If set to 1 (default), data sent over SSL connections will be + compressed if the SSL library supports it. If set to 0, + compression will be disabled if the SSL library supports it. + This option is only available if PostgreSQL + is compiled with SSL support. + + + Note that setting sslcompression to 0 has no + effect on OpenSSL versions before 1.0.0. + + + + sslcert *************** myEventProc(PGEventId evtId, void *evtIn *** 6311,6316 **** --- 6328,6343 ---- + PGSSLCOMPRESSION + + PGSSLCOMPRESSION behaves the same as the connection parameter. + + + + + + PGSSLCERT PGSSLCERT behaves the same as the keepalives_count = tmp ? strdup(tmp) : NULL; tmp = conninfo_getval(connOptions, "sslmode"); conn->sslmode = tmp ? strdup(tmp) : NULL; + tmp = conninfo_getval(connOptions, "sslcompression"); + conn->sslcompression = tmp ? strdup(tmp) : NULL; tmp = conninfo_getval(connOptions, "sslkey"); conn->sslkey = tmp ? strdup(tmp) : NULL; tmp = conninfo_getval(connOptions, "sslcert"); diff --git a/src/interfaces/libpq/fe-secure.c b/src/interfaces/libpq/fe-secure.c new file mode 100644 index 9c6ced6..f2bd9d0 *** a/src/interfaces/libpq/fe-secure.c --- b/src/interfaces/libpq/fe-secure.c *************** init_ssl_system(PGconn *conn) *** 908,913 **** --- 908,923 ---- * causes unnecessary failures in nonblocking send cases. */ SSL_CTX_set_mode(SSL_context, SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER); + + /* + * If the OpenSSL version used supports it (from 1.0.0 on) + * and the user requested it, disable SSL compression. + */ + #ifdef SSL_OP_NO_COMPRESSION + if (conn->sslcompression && conn->sslcompression[0] == '0') { + SSL_CTX_set_options(SSL_context, SSL_OP_NO_COMPRESSION); + } + #endif } #ifdef ENABLE_THREAD_SAFETY diff --git a/src/interfaces/libpq/libpq-int.h b/src/interfaces/libpq/libpq-int.h new file mode 100644 index d56ef5d..64dfcb2 *** a/src/interfaces/libpq/libpq-int.h --- b/src/interfaces/libpq/libpq-int.h *************** struct pg_conn *** 310,315 **** --- 310,316 ---- char *keepalives_count; /* maximum number of TCP keepalive * retransmits */ char *sslmode; /* SSL mode (require,prefer,allow,disable) */ + char *sslcompression; /* SSL compression (0 or 1) */ char *sslkey; /* client key filename */ char *sslcert; /* client certificate filename */ char *sslrootcert; /* root certificate filename */