/[jscoverage]/trunk/tests/server-bad-requests.sh
ViewVC logotype

Diff of /trunk/tests/server-bad-requests.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 305 by siliconforks, Mon Oct 13 05:39:27 2008 UTC revision 306 by siliconforks, Mon Oct 13 06:12:21 2008 UTC
# Line 28  Line 28 
28    rm -fr EXPECTED ACTUAL OUT ERR    rm -fr EXPECTED ACTUAL OUT ERR
29  }  }
30    
31    bad_request() {
32      /bin/echo -ne "$1" | $NETCAT 127.0.0.1 $server_port > OUT 2> ERR
33      echo 'HTTP/1.1 400 Bad Request' > EXPECTED
34      head -n 1 OUT > ACTUAL
35      diff --strip-trailing-cr EXPECTED ACTUAL
36    }
37    
38  trap 'cleanup' 0 1 2 3 15  trap 'cleanup' 0 1 2 3 15
39    
40  export PATH=.:..:$PATH  export PATH=.:..:$PATH
# Line 39  Line 46 
46    delay=2    delay=2
47  fi  fi
48    
 rm -fr EXPECTED ACTUAL OUT ERR  
 $VALGRIND jscoverage-server --port 8000 > /dev/null 2> /dev/null &  
 server_pid=$!  
 server_port=8000  
   
 sleep $delay  
   
49  if which netcat > /dev/null 2> /dev/null  if which netcat > /dev/null 2> /dev/null
50  then  then
51    NETCAT=netcat    NETCAT=netcat
# Line 56  Line 56 
56    NETCAT='perl netcat.pl';    NETCAT='perl netcat.pl';
57  fi  fi
58    
59  bad_request() {  rm -fr EXPECTED ACTUAL OUT ERR
60    /bin/echo -ne "$1" | $NETCAT 127.0.0.1 $server_port > OUT 2> ERR  $VALGRIND jscoverage-server --port 8000 > /dev/null 2> /dev/null &
61    echo 'HTTP/1.1 400 Bad Request' > EXPECTED  server_pid=$!
62    head -n 1 OUT > ACTUAL  server_port=8000
63    diff --strip-trailing-cr EXPECTED ACTUAL  
64  }  sleep $delay
65    
66  # send NUL in Request-Line  # send NUL in Request-Line
67  bad_request 'GET \0000 HTTP/1.1\r\n\r\n'  bad_request 'GET \0000 HTTP/1.1\r\n\r\n'

Legend:
Removed from v.305  
changed lines
  Added in v.306

  ViewVC Help
Powered by ViewVC 1.1.24