Quit using "yes" in ssl-opt.sh with openssl

It caused s_server to send an AppData record of 16Kb every millisecond or so,
which destroyed readability of the proxy and client logs.
This commit is contained in:
Manuel Pégourié-Gonnard 2014-09-26 16:07:29 +02:00 committed by Paul Bakker
parent ae666c5092
commit fa60f128d6
2 changed files with 27 additions and 6 deletions

View file

@ -367,13 +367,12 @@ static unsigned char dropped[2048] = { 0 };
void update_dropped( const packet *p )
{
size_t id = p->len % sizeof( dropped );
++dropped[id];
const unsigned char *end = p->buf + p->len;
const unsigned char *cur = p->buf;
size_t len = ( ( cur[11] << 8 ) | cur[12] ) + 13;
++dropped[id];
/* Avoid counting single record twice */
if( len == p->len )
return;

View file

@ -18,7 +18,7 @@ set -u
: ${GNUTLS_CLI:=gnutls-cli}
: ${GNUTLS_SERV:=gnutls-serv}
O_SRV="$OPENSSL_CMD s_server -cert data_files/server5.crt -key data_files/server5.key"
O_SRV="$OPENSSL_CMD s_server -www -cert data_files/server5.crt -key data_files/server5.key"
O_CLI="echo 'GET / HTTP/1.0' | $OPENSSL_CMD s_client"
G_SRV="$GNUTLS_SERV --x509certfile data_files/server5.crt --x509keyfile data_files/server5.key"
G_CLI="$GNUTLS_CLI"
@ -172,6 +172,28 @@ is_polar() {
echo "$1" | grep 'ssl_server2\|ssl_client2' > /dev/null
}
# openssl s_server doesn't have -www with DTLS
check_osrv_dtls() {
if echo "$SRV_CMD" | grep 's_server.*-dtls' >/dev/null; then
NEEDS_INPUT=1
SRV_CMD="$( echo $SRV_CMD | sed s/-www// )"
else
NEEDS_INPUT=0
fi
}
# provide input to commands that need it
provide_input() {
if [ $NEEDS_INPUT -eq 0 ]; then
return
fi
while true; do
echo "HTTP/1.0 200 OK"
sleep 1
done
}
# has_mem_err <log_file_name>
has_mem_err() {
if ( grep -F 'All heap blocks were freed -- no leaks are possible' "$1" &&
@ -299,9 +321,9 @@ run_test() {
# assume proxy starts faster than server
fi
check_osrv_dtls
echo "$SRV_CMD" > $SRV_OUT
# "yes" is for servers without -www (openssl with DTLS)
yes "HTTP/1.0 200 OK" | $SRV_CMD >> $SRV_OUT 2>&1 &
provide_input | $SRV_CMD >> $SRV_OUT 2>&1 &
SRV_PID=$!
wait_server_start