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