Test code for a HTTP GET request over sockets

It doesn't run per default and it doens't work yet. Just to share the idea.
This commit is contained in:
Dirk Wetter 2019-01-26 14:18:04 +01:00
parent 7de93e26dc
commit e02b313394
1 changed files with 33 additions and 23 deletions

View File

@ -1968,6 +1968,15 @@ run_http_header() {
fi
[[ -z "$1" ]] && url="/" || url="$1"
if [[ "$SOCKETHEADER" == true ]]; then
# This is just for testing only. It doesn't work (yet)
tls_sockets "03" "$TLS12_CIPHER" "" "" "" false
debugme echo "--> $?"
printf -- "%b" "$GET_REQ11" >&5 # This GET request is not being logged on the server side --> probably we're still on the TLS layer
cat <&5 >$HEADERFILE
debugme xxd "$HEADERFILE" # 1503 -> TLS alert
close_socket
else
printf "$GET_REQ11" | $OPENSSL s_client $(s_client_options "$OPTIMAL_PROTO $BUGS -quiet -ign_eof -connect $NODEIP:$PORT $PROXY $SNI") >$HEADERFILE 2>$ERRFILE &
wait_kill $! $HEADER_MAXSLEEP
if [[ $? -eq 0 ]]; then
@ -1993,6 +2002,7 @@ run_http_header() {
return 1
fi
fi
fi
if [[ ! -s $HEADERFILE ]]; then
prln_warning " HTTP header reply empty"
fileout "HTTP_status_code" "WARN" "HTTP header reply empty"
@ -12596,13 +12606,13 @@ tls_sockets() {
local -i hello_done=0
local cipher="" key_and_iv="" decrypted_response
[[ "$5" == "true" ]] && offer_compression=true
[[ "$6" == "false" ]] && close_connection=false
[[ "$5" == true ]] && offer_compression=true
[[ "$6" == false ]] && close_connection=false
tls_low_byte="$1"
if [[ -n "$2" ]]; then # use supplied string in arg2 if there is one
cipher_list_2send="$2"
else # otherwise use std ciphers then
if [[ "$tls_low_byte" == "03" ]]; then
if [[ "$tls_low_byte" == 03 ]]; then
cipher_list_2send="$TLS12_CIPHER"
else
cipher_list_2send="$TLS_CIPHER"