diff --git a/lib/server/server.c b/lib/server/server.c index 4a6bc0ad..62944a5e 100644 --- a/lib/server/server.c +++ b/lib/server/server.c @@ -2477,8 +2477,8 @@ lws_server_socket_service(struct lws_context *context, struct lws *wsi, __func__); wsi->seen_zero_length_recv = 1; lws_change_pollfd(wsi, LWS_POLLIN, 0); - // goto try_pollout; - goto fail; + goto try_pollout; + //goto fail; case LWS_SSL_CAPABLE_ERROR: goto fail; diff --git a/lib/tls/openssl/openssl-client.c b/lib/tls/openssl/openssl-client.c index 86682618..febb3c30 100644 --- a/lib/tls/openssl/openssl-client.c +++ b/lib/tls/openssl/openssl-client.c @@ -135,11 +135,14 @@ lws_ssl_client_bio_create(struct lws *wsi) return -1; } -#if defined(LWS_HAVE_SSL_set_alpn_protos) && defined(LWS_HAVE_SSL_get0_alpn_selected) +#if defined(LWS_HAVE_SSL_set_alpn_protos) && \ + defined(LWS_HAVE_SSL_get0_alpn_selected) +#if defined(LWS_WITH_HTTP2) if (wsi->use_ssl & LCCSCF_NOT_H2) { plist += 3; n -= 3; } +#endif SSL_set_alpn_protos(wsi->ssl, plist, n); #endif diff --git a/test-apps/attack.sh b/test-apps/attack.sh index ee00ef6b..554ac4db 100755 --- a/test-apps/attack.sh +++ b/test-apps/attack.sh @@ -77,7 +77,7 @@ function check { fi if [ "$1" == "1" ] ; then - a="`dd if=$LOG bs=1 skip=$LEN 2>/dev/null |grep URI\ Arg\ 1\: | tr -s ' ' | cut -d' ' -f5-`" + a="`dd if=$LOG bs=1 skip=$LEN 2>/dev/null |grep URI\ Arg\ 1\: | tr -s ' ' | cut -d' ' -f7-`" if [ "$a" != "$2" ] ; then echo "Arg 1 '$a' not $2" exit 1 @@ -85,14 +85,14 @@ function check { fi if [ "$1" == "2" ] ; then - a="`dd if=$LOG bs=1 skip=$LEN 2>/dev/null |grep URI\ Arg\ 2\: | tr -s ' ' | cut -d' ' -f5-`" + a="`dd if=$LOG bs=1 skip=$LEN 2>/dev/null |grep URI\ Arg\ 2\: | tr -s ' ' | cut -d' ' -f7-`" if [ "$a" != "$2" ] ; then echo "Arg 2 '$a' not $2" exit 1 fi fi if [ "$1" == "3" ] ; then - a="`dd if=$LOG bs=1 skip=$LEN 2>/dev/null |grep URI\ Arg\ 3\: | tr -s ' ' | cut -d' ' -f5-`" + a="`dd if=$LOG bs=1 skip=$LEN 2>/dev/null |grep URI\ Arg\ 3\: | tr -s ' ' | cut -d' ' -f7-`" if [ "$a" != "$2" ] ; then echo "Arg 3 '$a' not $2" exit 1 @@ -343,7 +343,7 @@ for i in \ /...// \ /.../a \ /.../w \ -/.../? \ +"/.../?" \ /.../% \ /../.. \ /.././ \ @@ -355,7 +355,7 @@ for i in \ /../// \ /..//a \ /..//w \ -/..//? \ +"/..//?" \ /..//% \ /../a. \ /../a/ \ @@ -551,7 +551,7 @@ echo ==== $R if [ "$R" != "403" ]; then - U=`cat $LOG | grep lws_http_serve | tail -n 1 | cut -d':' -f3 | cut -d' ' -f2` + U=`cat $LOG | grep lws_http_serve | tail -n 1 | cut -d':' -f6 | cut -d' ' -f2` echo $U echo "- \"$i\" -> $R \"$U\"" >>/tmp/results else @@ -577,7 +577,7 @@ cat </tmp/lwsresult1 - "/..///" -> 200 "/" - "/..//a" -> 415 "/a" - "/..//w" -> 415 "/w" -- "/..//1" -> 415 "/1" +- "/..//?" -> 200 "/" - "/..//%" -> 403 - "/../a." -> 415 "/a." - "/../a/" -> 406 "/a/" @@ -628,7 +628,7 @@ cat </tmp/lwsresult1 - "//..//" -> 200 "/" - "//../a" -> 415 "/a" - "//../w" -> 415 "/w" -- "//../1" -> 415 "/1" +- "//../?" -> 200 "/" - "//../%" -> 403 - "//..a." -> 415 "/..a." - "//..a/" -> 406 "/..a/" diff --git a/test-apps/test-client.c b/test-apps/test-client.c index 91049eaf..784d4e0d 100644 --- a/test-apps/test-client.c +++ b/test-apps/test-client.c @@ -339,7 +339,7 @@ callback_lws_mirror(struct lws *wsi, enum lws_callback_reasons reason, if (longlived) mirror_lifetime += 500000; - lwsl_info("opened mirror connection with " + lwsl_notice("opened mirror connection with " "%d lifetime\n", mirror_lifetime); /* @@ -355,7 +355,7 @@ callback_lws_mirror(struct lws *wsi, enum lws_callback_reasons reason, lws_callback_on_writable(wsi); break; - case LWS_CALLBACK_CLOSED: + case LWS_CALLBACK_CLIENT_CLOSED: lwsl_notice("mirror: LWS_CALLBACK_CLOSED mirror_lifetime=%d, " "rxb %d, rx_count %d\n", mirror_lifetime, rxb, rx_count); @@ -411,12 +411,11 @@ callback_lws_mirror(struct lws *wsi, enum lws_callback_reasons reason, if (!justmirror) mirror_lifetime--; if (!mirror_lifetime) { - lwsl_info("closing mirror session\n"); + lwsl_notice("closing mirror session\n"); return -1; } /* get notified as soon as we can write again */ - if (!justmirror) - lws_callback_on_writable(wsi); + lws_callback_on_writable(wsi); #if !defined(_WIN32) && !defined(WIN32) usleep(250); @@ -583,7 +582,7 @@ int main(int argc, char **argv) memset(&info, 0, sizeof info); lwsl_notice("libwebsockets test client - license LGPL2.1+SLE\n"); - lwsl_notice("(C) Copyright 2010-2017 Andy Green \n"); + lwsl_notice("(C) Copyright 2010-2018 Andy Green \n"); if (argc < 2) goto usage;