Add stream support

Fix cUrl headers
Reduce code dupplication
Add custom exceptions