process adds significant latency if the initial SSL connection
fails.
</para>
+ <para>
+ An exception is if <literal>gssencmode</literal> is set
+ to <literal>prefer</literal>, but the server rejects GSS encryption.
+ In that case, SSL is negotiated over the same TCP connection using
+ <productname>PostgreSQL</productname> protocol negotiation. In
+ other words, the direct SSL handshake is not used, if a TCP
+ connection has already been established and can be used for the
+ SSL handshake.
+ </para>
</listitem>
</varlistentry>
</listitem>
</varlistentry>
</variablelist>
-
- <para>
- Note that if <literal>gssencmode</literal> is set
- to <literal>prefer</literal>, a <acronym>GSS</acronym> connection is
- attempted first. If the server rejects GSS encryption, SSL is
- negotiated over the same TCP connection using the traditional postgres
- protocol, regardless of <literal>sslnegotiation</literal>. In other
- words, the direct SSL handshake is not used, if a TCP connection has
- already been established and can be used for the SSL handshake.
- </para>
</listitem>
</varlistentry>
/*
* If enabled, try direct SSL. Unless we have a valid TCP connection that
- * failed negotiating GSSAPI encryption or a plaintext connection in case
- * of sslmode='allow'; in that case we prefer to reuse the connection with
- * negotiated SSL, instead of reconnecting to do direct SSL. The point of
- * direct SSL is to avoid the roundtrip from the negotiation, but
- * reconnecting would also incur a roundtrip.
+ * failed negotiating GSSAPI encryption; in that case we prefer to reuse
+ * the connection with negotiated SSL, instead of reconnecting to do
+ * direct SSL. The point of sslnegotiation=direct is to avoid the
+ * roundtrip from the negotiation, but reconnecting would also incur a
+ * roundtrip. (In sslnegotiation=requiredirect mode, negotiated SSL is not
+ * in the list of allowed methods and we will reconnect.)
*/
if (have_valid_connection)
SELECT_NEXT_METHOD(ENC_NEGOTIATED_SSL);