ed560b2018-09-27Henrik Grubbström (Grubba) inherit "../pike_async_process_test_common"; string simple_check( ) { return common_wait( ([ 2:"Illegal headers", 3:"Illegal data", 4:"Connection failed", 5:"Bad protocol value in reply", 6:"Bad response code in reply", 7:"No date header", 8:"Bad or no content-length header", 9:"Bad or no last-modified header", 11:"Did not expect headers", 12:"Did not expect data", 13:"Did not expect connection", 14:"Did not expect valid reply", ]) ); } function run( string script, string file, int|string ... ma ) { return lambda() { run_pikescript( script, file, @((array(string))ma) ); }; } #define rtest( COMMENT, SCRIPT, PATH, ARGS...) \
161f322018-09-28Henrik Grubbström (Grubba)  atest(COMMENT, run(SCRIPT, PATH, ARGS), simple_check)
ed560b2018-09-27Henrik Grubbström (Grubba)  // NB: Keep in sync with the brokeness enum in websocket.pike. constant descriptions = ({ "Trivial", "Bad path", "Bad path suffix", "Bad HTTP version", "No Connection header", "Bad Connection header", "No Upgrade header", "Bad Upgrade header", "No Sec-WebSocket-Version header", "Bad Sec-WebSocket-Version header", "No Sec-WebSocket-Key header", "Bad Sec-WebSocket-Key header", }); void setup( ) { foreach(descriptions; int i; string descr) {
a46a712018-10-01Henrik Grubbström (Grubba)  rtest(descr, "http/websocket.pike", "/websocket_example/", i); if (i) { // Test for over-caching. rtest(descriptions[0], "http/websocket.pike", "/websocket_example/", 0); }
ed560b2018-09-27Henrik Grubbström (Grubba)  } }