Fix for #1228 from mikka/requests@120a2f3.