Skip to content

Commit 2e10ed5

Browse files
committed
pulling in scope_id
2 parents 70b43a3 + 36138db commit 2e10ed5

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pygetdns_util.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@ getdnsify_addressdict(PyObject *pydict)
351351
unsigned char buf[sizeof(struct in6_addr)];
352352
int domain;
353353
getdns_bindata tls_auth_name;
354+
getdns_bindata scope_id;
354355
uint32_t tls_port;
355356

356357
if (!PyDict_Check(pydict)) {
@@ -374,6 +375,15 @@ getdnsify_addressdict(PyObject *pydict)
374375
tls_auth_name.size = (size_t)strlen((char *)tls_auth_name.data);
375376
getdns_dict_set_bindata(addr_dict, "tls_auth_name", &tls_auth_name);
376377
}
378+
if ((str = PyDict_GetItemString(pydict, "scope_id")) != NULL) {
379+
#if PY_MAJOR_VERSION >= 3
380+
scope_id.data = (uint8_t *)strdup(PyBytes_AsString(PyUnicode_AsEncodedString(str, "ascii", NULL)));
381+
#else
382+
scope_id.data = (uint8_t *)strdup(PyString_AsString(str));
383+
#endif
384+
scope_id.size = (size_t)strlen((char *)scope_id.data);
385+
getdns_dict_set_bindata(addr_dict, "scope_id", &scope_id);
386+
}
377387
if ((str = PyDict_GetItemString(pydict, "tls_port")) != NULL) {
378388
if (!PyInt_Check(str)) {
379389
PyErr_SetString(getdns_error, GETDNS_RETURN_INVALID_PARAMETER_TEXT);

0 commit comments

Comments
 (0)