Skip to content

Commit b9bdaf3

Browse files
committed
doc: Update PQgetssl() documentation
The return type of PQgetssl() was changed from SSL* to void* a long time ago, but the documentation was not updated.
1 parent d61dddb commit b9bdaf3

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

doc/src/sgml/libpq.sgml

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1864,7 +1864,7 @@ int PQconnectionUsedPassword(const PGconn *conn);
18641864
if SSL is not in use.
18651865

18661866
<synopsis>
1867-
SSL *PQgetssl(const PGconn *conn);
1867+
void *PQgetssl(const PGconn *conn);
18681868
</synopsis>
18691869
</para>
18701870

@@ -1875,10 +1875,29 @@ SSL *PQgetssl(const PGconn *conn);
18751875
</para>
18761876

18771877
<para>
1878-
You must define <symbol>USE_SSL</symbol> in order to get the
1879-
correct prototype for this function. Doing so will also
1880-
automatically include <filename>ssl.h</filename> from
1881-
<productname>OpenSSL</productname>.
1878+
The actual return value is of type <type>SSL *</type>,
1879+
where <type>SSL</type> is a type defined by
1880+
the <productname>OpenSSL</productname> library, but it is not declared
1881+
this way to avoid requiring the <productname>OpenSSL</productname>
1882+
header files. To use this function, code along the following lines
1883+
could be used:
1884+
<programlisting><![CDATA[
1885+
#include <libpq-fe.h>
1886+
#include <openssl/ssl.h>
1887+
1888+
...
1889+
1890+
SSL *ssl;
1891+
1892+
dbconn = PQconnectdb(...);
1893+
...
1894+
1895+
ssl = PQgetssl(dbconn);
1896+
if (ssl)
1897+
{
1898+
/* use OpenSSL functions to access ssl */
1899+
}
1900+
]]></programlisting>
18821901
</para>
18831902
</listitem>
18841903
</varlistentry>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy