• Tobias Schmidt's avatar
    Ensure cache.ResponseWriter can be used asynchronously during prefetch (#1884) · 9c2dc7a1
    Tobias Schmidt authored
    The default dns.Response implementation of a dns.ResponseWriter will
    panic if RemoteAddr() is called after the connection to the client has
    been closed already. The current cache implementation doesn't create a
    new request+responsewriter during an asynchronous prefetch, but
    piggybacks on the request triggering the prefetch.
    
    This change copies the RemoteAddr first, so that it's safe to use it
    later during the actual prefetch request.
    
    A better implementation would be to completely decouple the prefetch
    request from the client triggering a request.
    9c2dc7a1
handler.go 3.57 KB