- FIX: 30x with BigIP doesn't have a date, handled properly now

- generic GET/HEAD is now always with URL_PATH
This commit is contained in:
Dirk 2015-05-10 23:38:06 +02:00
parent 0050df5529
commit 19fc021587
1 changed files with 17 additions and 12 deletions

View File

@ -1288,16 +1288,21 @@ server_defaults() {
fi fi
# HTTP date: # HTTP date:
out " HTTP clock skew: "
printf "$GET_REQ11" | $OPENSSL s_client -ign_eof -connect $NODE:$PORT $SNI &>$TMPFILE printf "$GET_REQ11" | $OPENSSL s_client -ign_eof -connect $NODE:$PORT $SNI &>$TMPFILE
now=$(date "+%s") now=$(date "+%s")
HTTP_TIME=$(awk -F': ' '/^date:/ { print $2 } /^Date:/ { print $2 }' $TMPFILE) HTTP_TIME=$(awk -F': ' '/^date:/ { print $2 } /^Date:/ { print $2 }' $TMPFILE)
case $SYSTEM in if [ -n "$HTTP_TIME" ] ; then
*BSD|Darwin) HTTP_TIME=$(date -j -f "%a, %d %b %Y %T %Z" "$HTTP_TIME" "+%s" 2>/dev/null) ;; # the trailing \r confuses BSD flavors otherwise case $SYSTEM in
*) HTTP_TIME=$(date --date="$HTTP_TIME" "+%s") ;; *BSD|Darwin) HTTP_TIME=$(date -j -f "%a, %d %b %Y %T %Z" "$HTTP_TIME" "+%s" 2>/dev/null) ;; # the trailing \r confuses BSD flavors otherwise
esac *) HTTP_TIME=$(date --date="$HTTP_TIME" "+%s") ;;
difftime=$(($now - $HTTP_TIME)) esac
[[ $difftime != "-"* ]] && [[ $difftime != "0" ]] && difftime="+$difftime" difftime=$(($now - $HTTP_TIME))
out " HTTP clock skew: $difftime sec from localtime"; [[ $difftime != "-"* ]] && [[ $difftime != "0" ]] && difftime="+$difftime"
out "$difftime sec from localtime";
else
out "Got no HTTP time, maybe try different URL?";
fi
debugme out "$HTTP_TIME" debugme out "$HTTP_TIME"
outln outln
@ -2966,11 +2971,11 @@ parse_hn_port() {
[ $? -ne 0 ] && exit 3 [ $? -ne 0 ] && exit 3
fi fi
if [ $SNEAKY -eq 0 ] ; then if [ $SNEAKY -eq 0 ] ; then
GET_REQ11="GET / HTTP/1.1\r\nHost: $NODE\r\nUser-Agent: $UA_SNEAKY\r\nConnection: Close\r\nAccept: text/*\r\n\r\n" GET_REQ11="GET $URL_PATH HTTP/1.1\r\nHost: $NODE\r\nUser-Agent: $UA_SNEAKY\r\nConnection: Close\r\nAccept: text/*\r\n\r\n"
HEAD_REQ10="HEAD / HTTP/1.0\r\nUser-Agent: $UA_SNEAKY\r\nAccept: text/*\r\n\r\n" HEAD_REQ10="HEAD $URL_PATH HTTP/1.0\r\nUser-Agent: $UA_SNEAKY\r\nAccept: text/*\r\n\r\n"
else else
GET_REQ11="GET / HTTP/1.1\r\nHost: $NODE\r\nUser-Agent: $UA_STD\r\nConnection: Close\r\nAccept: text/*\r\n\r\n" GET_REQ11="GET $URL_PATH HTTP/1.1\r\nHost: $NODE\r\nUser-Agent: $UA_STD\r\nConnection: Close\r\nAccept: text/*\r\n\r\n"
HEAD_REQ10="HEAD / HTTP/1.0\r\nUser-Agent: $UA_STD\r\nAccept: text/*\r\n\r\n" HEAD_REQ10="HEAD $URL_PATH HTTP/1.0\r\nUser-Agent: $UA_STD\r\nAccept: text/*\r\n\r\n"
fi fi
runs_HTTP runs_HTTP
else else
@ -3417,6 +3422,6 @@ fi
exit $ret exit $ret
# $Id: testssl.sh,v 1.244 2015/05/10 18:54:42 dirkw Exp $ # $Id: testssl.sh,v 1.245 2015/05/10 21:38:05 dirkw Exp $
# vim:ts=5:sw=5 # vim:ts=5:sw=5
# ^^^ FYI: use vim and you will see everything beautifully indented with a 5 char tab # ^^^ FYI: use vim and you will see everything beautifully indented with a 5 char tab