added timeout support and test, added native curl error detect