Skip to content

Commit 68d92da

Browse files
committed
Added provisional support for TLS transport
1 parent 4bacb20 commit 68d92da

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

Diff for: context.c

+4
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,11 @@ context_set_dns_transport(getdns_context *context, PyObject *py_value)
141141
return -1;
142142
}
143143
if ((value < GETDNS_TRANSPORT_UDP_FIRST_AND_FALL_BACK_TO_TCP) ||
144+
#if defined(WITH_TLS)
145+
(value > GETDNS_TRANSPORT_TLS_FIRST_AND_FALL_BACK_TO_TCP_KEEP_CONNECTIONS_OPEN)) {
146+
#else
144147
(value > GETDNS_TRANSPORT_TCP_ONLY_KEEP_CONNECTIONS_OPEN)) {
148+
#endif
145149
PyErr_SetString(getdns_error, GETDNS_RETURN_INVALID_PARAMETER_TEXT);
146150
return -1;
147151
}

Diff for: getdns.c

+4
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,10 @@ initgetdns(void)
329329
PyModule_AddIntConstant(g, "TRANSPORT_UDP_ONLY", 541);
330330
PyModule_AddIntConstant(g, "TRANSPORT_TCP_ONLY", 542);
331331
PyModule_AddIntConstant(g, "TRANSPORT_TCP_ONLY_KEEP_CONNECTIONS_OPEN", 543);
332+
#if defined(WITH_TLS)
333+
PyModule_AddIntConstant(g, "TRANSPORT_TLS_ONLY_KEEP_CONNECTIONS_OPEN", 544);
334+
PyModule_AddIntConstant(g, "TRANSPORT_TLS_FIRST_AND_FALL_BACK_TO_TCP_KEEP_CONNECTIONS_OPEN", 545);
335+
#endif
332336

333337
/*
334338
* suffix appending methods

Diff for: setup.py

+4
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@
4343
CFLAGS.append('-DWITH_EDNS_COOKIES')
4444
sys.argv.remove('--with-edns-cookies')
4545

46+
if '--with-tls' in sys.argv:
47+
CFLAGS.append('-DWITH_TLS')
48+
sys.argv.remove('--with-tls')
49+
4650
getdns_module = Extension('getdns',
4751
include_dirs = [ '/usr/local/include', ],
4852
libraries = [ 'ldns', 'getdns', 'getdns_ext_event', 'event' ],

0 commit comments

Comments
 (0)