Add stream support

Fix cUrl headers
Reduce code dupplication
Added custom exceptions