diff --git a/doc/src/sgml/libpq.sgml b/doc/src/sgml/libpq.sgml
new file mode 100644
index 3d5f98b..fb7075a
*** a/doc/src/sgml/libpq.sgml
--- b/doc/src/sgml/libpq.sgml
*************** PGconn *PQconnectdbParams(const char * c
*** 494,499 ****
--- 494,520 ----
+
+ sslcompression
+
+
+ If set to 1 (default), data sent over SSL connections will be
+ compressed if the SSL library supports compression (from
+ OpenSSL> 0.9.8 on).
+ If set to 0, compression will be disabled if the SSL library
+ supports disabling compression (from OpenSSL>
+ 1.0.0 on).
+ This parameter is ignored if an SSL connection is not made.
+
+
+ Compression uses CPU time, but can improve throughput if
+ the network is the bottleneck.
+ Disabling compression improves response time and throughput
+ if CPU time is the limiting factor.
+
+
+
+
sslcert
*************** myEventProc(PGEventId evtId, void *evtIn
*** 6311,6316 ****
--- 6332,6347 ----
+ 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..c6963be
*** a/src/interfaces/libpq/fe-secure.c
--- b/src/interfaces/libpq/fe-secure.c
*************** initialize_SSL(PGconn *conn)
*** 1292,1297 ****
--- 1292,1307 ----
}
}
+ /*
+ * 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_set_options(conn->ssl, SSL_OP_NO_COMPRESSION);
+ }
+ #endif
+
return 0;
}
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 */