cherry picked from commit https://github.com/caeies/polipo-caeies/commit/258dd91443e042e0e18fb15dad0ac9e004ff710b