discovery: httpsOrHTTP: fix error management
discovery: httpsOrHTTP: fix error management

Symptoms:
$ sudo ./bin/rkt run foo
panic: runtime error: invalid memory address or nil pointer dereference

Fixed by checking if res is nil.

Additionally, only release res.Body with closeBody(res) if the http method is
attempted. Otherwise, it would be released a second time at the end of the
function.

iaguis/appc-spec,apcera/appc-spec,craimbert/spec,tklauser/spec,yifan-gu/spec,dgonyeo/spec,yifan-gu/spec,sgotti/spec,mesosphere/spec,iaguis/appc-spec,appc/spec,stufflebear/spec,dustymabe/spec,alban/appc-spec,marineam/spec,appc/spec,sgotti/spec,squeed/spec,apcera/appc-spec,dustymabe/spec,craimbert/spec,stufflebear/spec,endocode/appc-spec,yifan-gu/spec,squeed/spec,marineam/spec,ChengTiesheng/spec,craimbert/spec,apcera/appc-spec,jonboulle/spec,tklauser/spec,squeed/spec,3ofcoins/appc-spec,dgonyeo/spec,stufflebear/spec,krnowak/appc-spec,dgonyeo/spec,zenlinTechnofreak/spec,dustymabe/spec,krnowak/appc-spec,mesosphere/spec,endocode/appc-spec,alban/appc-spec,krnowak/appc-spec,alban/appc-spec,tklauser/spec,jonboulle/spec,appc/spec,ChengTiesheng/spec,zenlinTechnofreak/spec,ChengTiesheng/spec,marineam/spec,zenlinTechnofreak/spec,3ofcoins/appc-spec,endocode/appc-spec,3ofcoins/appc-spec,iaguis/appc-spec,jonboulle/spec