Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Initialize global variables
Tom Scavo committed Jun 14, 2017
1 parent 24538e0 commit edd5b53
Showing 2 changed files with 39 additions and 14 deletions.
26 changes: 19 additions & 7 deletions bin/request_http_resources.sh
@@ -274,7 +274,7 @@ append_json_object () {
local response_code=$( escape_special_json_chars "$response_code" )
local response_date=$( escape_special_json_chars "$response_date" )
local last_modified=$( escape_special_json_chars "$last_modified" )
local e_tag=$( escape_special_json_chars "$e_tag" )
local etag=$( escape_special_json_chars "$etag" )
local content_length=$( escape_special_json_chars "$content_length" )
local content_type=$( escape_special_json_chars "$content_type" )

@@ -289,13 +289,28 @@ append_json_object () {
"ResponseCode": "$response_code",
"Date": "$response_date",
"LastModified": "$last_modified",
"ETag": "$e_tag",
"ETag": "$etag",
"ContentLength": "$content_length",
"ContentType": "$content_type"
}
JSON_OBJECT
}

init_global_vars () {

# success by default
success=true
message="Resource request successful"

location=
ResponseCode=
Date=
LastModified=
ETag=
ContentLength=
ContentType=
}

get_response () {

local status_code
@@ -313,8 +328,6 @@ get_response () {
return 3
fi

# success
message="Resource request successful"
return 0
}

@@ -348,7 +361,7 @@ parse_response () {

# get the ETag response header
header_name=ETag
e_tag=$( get_header_value $header_file $header_name )
etag=$( get_header_value $header_file $header_name )
status_code=$?
if [ $status_code -ne 0 ]; then
print_log_message -E "$script_name: get_header_value failed ($status_code) to parse response header: $header_name"
@@ -380,8 +393,7 @@ print_output_file () {

while true; do

success=true

init_global_vars
get_response "$1"
status_code=$?
if [ $status_code -eq 0 ]; then
27 changes: 20 additions & 7 deletions bin/test_compressed_resources.sh
@@ -283,7 +283,7 @@ append_json_object () {
local response_code=$( escape_special_json_chars "$response_code" )
local response_date=$( escape_special_json_chars "$response_date" )
local last_modified=$( escape_special_json_chars "$last_modified" )
local e_tag=$( escape_special_json_chars "$e_tag" )
local etag=$( escape_special_json_chars "$etag" )
local content_length=$( escape_special_json_chars "$content_length" )
local content_type=$( escape_special_json_chars "$content_type" )
local content_encoding=$( escape_special_json_chars "$content_encoding" )
@@ -299,14 +299,30 @@ append_json_object () {
"ResponseCode": "$response_code",
"Date": "$response_date",
"LastModified": "$last_modified",
"ETag": "$e_tag",
"ETag": "$etag",
"ContentLength": "$content_length",
"ContentType": "$content_type",
"ContentEncoding": "$content_encoding"
}
JSON_OBJECT
}

init_global_vars () {

# success by default
success=true
message="Integrity of compressed metadata confirmed"

location=
ResponseCode=
Date=
LastModified=
ETag=
ContentLength=
ContentType=
ContentEncoding=
}

get_compressed_response () {

local status_code
@@ -357,7 +373,7 @@ parse_compressed_response () {

# get the ETag response header
header_name=ETag
e_tag=$( get_header_value $header_file $header_name )
etag=$( get_header_value $header_file $header_name )
status_code=$?
if [ $status_code -ne 0 ]; then
print_log_message -E "$script_name: get_header_value failed ($status_code) to parse response header: $header_name"
@@ -438,8 +454,6 @@ test_compressed_response () {
fi
print_log_message -D "$script_name: compressed and uncompressed resources are identical"

# success
message="Integrity of compressed metadata confirmed"
return 0
}

@@ -452,8 +466,7 @@ print_output_file () {

while true; do

success=true

init_global_vars
get_compressed_response "$1"
status_code=$?
if [ $status_code -eq 0 ]; then

0 comments on commit edd5b53

Please sign in to comment.