From b6893b4dc09a1719c38ecaa4a5e9b9bbce356493 Mon Sep 17 00:00:00 2001 From: Tom Scavo Date: Wed, 14 Jun 2017 13:43:19 -0400 Subject: [PATCH] Differentiate between GET and HEAD in log messages --- lib/http_tools.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/http_tools.sh b/lib/http_tools.sh index fe946d5..9812452 100755 --- a/lib/http_tools.sh +++ b/lib/http_tools.sh @@ -238,10 +238,10 @@ conditional_get () { if $cache_only_mode; then if $headers_only_mode; then - print_log_message "$FUNCNAME reading cached header file: $cached_header_file" + print_log_message -I "$FUNCNAME reading cached header file: $cached_header_file" /bin/cat "$cached_header_file" else - print_log_message "$FUNCNAME reading cached content file: $cached_content_file" + print_log_message -I "$FUNCNAME reading cached content file: $cached_content_file" /bin/cat "$cached_content_file" fi exit_code=$? @@ -301,9 +301,11 @@ conditional_get () { # capture the output iff the script issues a GET request curl_opts="${curl_opts} --dump-header '${tmp_header_file}'" if $headers_only_mode; then + print_log_message -I "$FUNCNAME issuing HEAD request for resource: $location" curl_opts="${curl_opts} --head" curl_opts="${curl_opts} --output '/dev/null'" else + print_log_message -I "$FUNCNAME issuing GET request for resource: $location" curl_opts="${curl_opts} --output '${tmp_content_file}'" fi curl_opts="${curl_opts} --stderr '${tmp_stderr_file}'" @@ -368,7 +370,7 @@ conditional_get () { print_log_message -E "$FUNCNAME: get_response_code failed (return code: $return_code)" return 7 fi - print_log_message "$FUNCNAME received response code: $response_code" + print_log_message -I "$FUNCNAME received response code: $response_code" if $headers_only_mode; then /bin/cat "$tmp_header_file" @@ -423,7 +425,7 @@ conditional_get () { print_log_message -E "$FUNCNAME failed copy to file $cached_header_file (exit code: $exit_code)" return 8 fi - print_log_message "$FUNCNAME writing cached content file: ${cached_content_file}" + print_log_message -I "$FUNCNAME writing cached content file: ${cached_content_file}" /bin/cp -f "$tmp_content_file" "$cached_content_file" >&2 exit_code=$? if [ $exit_code -ne 0 ]; then @@ -451,7 +453,7 @@ conditional_get () { # ####################################################################### - print_log_message "$FUNCNAME reading cached content file: ${cached_content_file}" + print_log_message -I "$FUNCNAME reading cached content file: ${cached_content_file}" /bin/cat "$cached_content_file" exit_code=$? if [ $exit_code -ne 0 ]; then