Add fallback for "head" request (use "get").   Also, log errors getting contentLength, and return -1 (=> unknown content length).
Merge remote-tracking branch: upstream/master