Skip to content

Commit

Permalink
Added provisional support for TLS transport
Browse files Browse the repository at this point in the history
  • Loading branch information
MelindaShore committed Apr 16, 2015
1 parent 4bacb20 commit 68d92da
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions context.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,11 @@ context_set_dns_transport(getdns_context *context, PyObject *py_value)
return -1;
}
if ((value < GETDNS_TRANSPORT_UDP_FIRST_AND_FALL_BACK_TO_TCP) ||
#if defined(WITH_TLS)
(value > GETDNS_TRANSPORT_TLS_FIRST_AND_FALL_BACK_TO_TCP_KEEP_CONNECTIONS_OPEN)) {
#else
(value > GETDNS_TRANSPORT_TCP_ONLY_KEEP_CONNECTIONS_OPEN)) {
#endif
PyErr_SetString(getdns_error, GETDNS_RETURN_INVALID_PARAMETER_TEXT);
return -1;
}
Expand Down
4 changes: 4 additions & 0 deletions getdns.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,10 @@ initgetdns(void)
PyModule_AddIntConstant(g, "TRANSPORT_UDP_ONLY", 541);
PyModule_AddIntConstant(g, "TRANSPORT_TCP_ONLY", 542);
PyModule_AddIntConstant(g, "TRANSPORT_TCP_ONLY_KEEP_CONNECTIONS_OPEN", 543);
#if defined(WITH_TLS)
PyModule_AddIntConstant(g, "TRANSPORT_TLS_ONLY_KEEP_CONNECTIONS_OPEN", 544);
PyModule_AddIntConstant(g, "TRANSPORT_TLS_FIRST_AND_FALL_BACK_TO_TCP_KEEP_CONNECTIONS_OPEN", 545);
#endif

/*
* suffix appending methods
Expand Down
4 changes: 4 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@
CFLAGS.append('-DWITH_EDNS_COOKIES')
sys.argv.remove('--with-edns-cookies')

if '--with-tls' in sys.argv:
CFLAGS.append('-DWITH_TLS')
sys.argv.remove('--with-tls')

getdns_module = Extension('getdns',
include_dirs = [ '/usr/local/include', ],
libraries = [ 'ldns', 'getdns', 'getdns_ext_event', 'event' ],
Expand Down

0 comments on commit 68d92da

Please sign in to comment.