fix: claiming with wget (#12163)
Ilya Mashchenko committed
Feb 18, 2022 at 11:09 UTC
3a4562ef89165089c2fa1d2e0f5142805c4c4f7c
1 file changed
+6
-2
claim/netdata-claim.sh.in
+6
-2
@@ -296,7 +296,7 @@ if [ "${URLTOOL}" = "curl" ] ; then
296
URLCOMMAND="${URLCOMMAND} -x \"${PROXY}\""
297
fi
298
else
299
- URLCOMMAND="wget -T 15 -O - -q --save-headers --content-on-error=on --method=PUT \
299
+ URLCOMMAND="wget -T 15 -O - -q --server-response --content-on-error=on --method=PUT \
300
--body-file=\"${CLAIMING_DIR}/tmpin.txt\""
301
if [ "${NOPROXY}" = "yes" ] ; then
302
URLCOMMAND="${URLCOMMAND} --no-proxy"
@@ -326,7 +326,11 @@ if [ "${VERBOSE}" == 1 ]; then
326
fi
327
328
attempt_contact () {
329
- eval "${URLCOMMAND} \"${TARGET_URL}\"" >"${CLAIMING_DIR}/tmpout.txt"
329
+ if [ "${URLTOOL}" = "curl" ] ; then
330
+ eval "${URLCOMMAND} \"${TARGET_URL}\"" >"${CLAIMING_DIR}/tmpout.txt"
331
+ else
332
+ eval "${URLCOMMAND} \"${TARGET_URL}\"" >"${CLAIMING_DIR}/tmpout.txt" 2>&1
333
+ fi
334
URLCOMMAND_EXIT_CODE=$?
335
if [ "${URLTOOL}" = "wget" ] && [ "${URLCOMMAND_EXIT_CODE}" -eq 8 ] ; then
336
# We consider the server issuing an error response a successful attempt at communicating