DNS-OARC / flamethrower

a DNS performance and functional testing utility supporting UDP, TCP, DoT and DoH
Apache License 2.0
316 stars 37 forks source link

DoT: Properly handle partial writes #93

Closed rgacogne closed 2 years ago

rgacogne commented 2 years ago

If the buffer (batch of queries) passed to gnutls_record_send() exceeds the maximum size of a TLS record (pretty much always 16k), it will only process a part of the buffer and return a value smaller than the requested size. The current code does not handle that case and assumes that all queries have been sent, which is not true, resulting in the remaining queries being counted as timeouts. This change deals with that case by calling gnutls_record_send() until the buffer has been entirely processed, resulting in several TLS records if needed.

weyrick commented 2 years ago

thank you for the fix!