Merge pull request #19 from pkit/auth

refactored flush and read
added processing some errors in config file and received auth data
Merge branch 'master' of https://github.com/VarchukVladimir/collectd
added check if tokenId already known
fix for tenantId check
union transport_send & transport_start_session
Refactor setting curl headers in `send` routine.

Fix not freeing headers memory, not refreshing on reauth.
Small refactoring, fix bug with duplicate tenantid
Fix memory leak in `auth` routine
Merge pull request #21 from rampage644/memory

Memory
Fix leaking json generator handle on shutdown
Merge pull request #22 from rampage644/memory

Fix leaking json generator handle on shutdown
refactor, reformat, remove stale code