see https://github.com/ohadlevy/smart-proxy/commit/7980009294358567533b4183014dd71790bcb74d