]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Dig: Do not call isc_nm_cancelread() for HTTP sockets
authorArtem Boldariev <artem@boldariev.com>
Tue, 10 May 2022 20:09:59 +0000 (23:09 +0300)
committerArtem Boldariev <artem@boldariev.com>
Fri, 20 May 2022 17:18:40 +0000 (20:18 +0300)
This commit ensures that isc_nm_cancelread() is not called from within
dig code for HTTP sockets, as these lack its implementation.

It does not have much sense to have it due to transactional nature of
HTTP.

Every HTTP request-response pair is represented by a virtual socket,
where read callback is called only when full DNS message is received
or when an error code is being passed there. That is, there is nothing
to cancel at the time of the call.

bin/dig/dighost.c

index 14f626785941dc77bbd14f56419cd58b231526a4..e29f9514651e41e126da22e3d19489360facd9be 100644 (file)
@@ -2752,7 +2752,8 @@ _cancel_lookup(dig_lookup_t *lookup, const char *file, unsigned int line) {
                debug("canceling pending query %p, belonging to %p", query,
                      query->lookup);
                query->canceled = true;
-               if (query->readhandle != NULL) {
+               if (query->readhandle != NULL &&
+                   !isc_nm_is_http_handle(query->readhandle)) {
                        isc_nm_cancelread(query->readhandle);
                }
                query_detach(&query);
@@ -4566,7 +4567,8 @@ cancel_all(void) {
                        debug("canceling pending query %p, belonging to %p", q,
                              current_lookup);
                        q->canceled = true;
-                       if (q->readhandle != NULL) {
+                       if (q->readhandle != NULL &&
+                           !isc_nm_is_http_handle(q->readhandle)) {
                                isc_nm_cancelread(q->readhandle);
                        }
                        query_detach(&q);