Skip to content

Commit

Permalink
Differentiate between GET and HEAD in log messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Scavo committed Jun 14, 2017
1 parent e71fdf4 commit b6893b4
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/http_tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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=$?
Expand Down Expand Up @@ -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}'"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b6893b4

Please sign in to comment.