httpBuffer: fixed error handling