fix libcurl usage
fix libcurl usage

* move init and cleanup out of while loop
* add sleep(5) in case of error (stopping spamming of journal
  because of feedback loop)
* add check against valid transport configuration of target

ContentSafe/journal-gateway-gelf,travelping/journal-gateway-gelf,travelping/journal-gateway-gelf,ContentSafe/journal-gateway-gelf