about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-07-22 20:18:35 +0000
committerEric Wong <normalperson@yhbt.net>2010-07-22 20:23:14 +0000
commite69a5b17e386dd98aef3fe5d003c8bdc96ec7973 (patch)
tree3743ffbd01fec18eba233b093645744215c66226 /t
parent7e4b39bff2e2a6d719f381c0021563df2b6689d1 (diff)
downloadrainbows-e69a5b17e386dd98aef3fe5d003c8bdc96ec7973.tar.gz
While gawk can handle binary data, other awks cannot, so
use tr(1) to filter out non-printable characters from the
WebSocket message.   We need to send a bigger message, too,
since tr(1) output is buffered and there's no portable way
to unbuffer it :<
Diffstat (limited to 't')
-rw-r--r--t/cramp/rainsocket.ru2
-rwxr-xr-xt/t0501-cramp-rainsocket.sh1
2 files changed, 2 insertions, 1 deletions
diff --git a/t/cramp/rainsocket.ru b/t/cramp/rainsocket.ru
index 0d26f70..dd1b229 100644
--- a/t/cramp/rainsocket.ru
+++ b/t/cramp/rainsocket.ru
@@ -19,7 +19,7 @@ class WelcomeController < Cramp::Controller::Websocket
   end
 
   def send_hello_world
-    render "Hello from the Server!\n"
+    render("Hello from the Server!\n" * 256)
   end
 end
 
diff --git a/t/t0501-cramp-rainsocket.sh b/t/t0501-cramp-rainsocket.sh
index 6e3aea4..a64145a 100755
--- a/t/t0501-cramp-rainsocket.sh
+++ b/t/t0501-cramp-rainsocket.sh
@@ -24,6 +24,7 @@ t_begin "setup and start" && {
 
 t_begin "wait for server to say hello to us" && {
         ok=$((curl --no-buffer -sS http://$listen/ || :) | \
+             (tr -d '\0\0377' || :) | \
              awk '/Hello from the Server/ { print "ok"; exit 0 }')
 
         test x"$ok" = xok