quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

test2708 (1141B)


      1 <testcase>
      2 <info>
      3 <keywords>
      4 WebSockets
      5 </keywords>
      6 </info>
      7 
      8 <client>
      9 <name>
     10 ws: Automatic PONG
     11 </name>
     12 <features>
     13 Debug
     14 ws
     15 </features>
     16 <server>
     17 http
     18 </server>
     19 <tool>
     20 lib2700
     21 </tool>
     22 <command>
     23 ws://%HOSTIP:%HTTPPORT/%TESTNUMBER
     24 </command>
     25 <setenv>
     26 CURL_WS_FORCE_ZERO_MASK=1
     27 LIB2700_AUTO_PONG=1
     28 </setenv>
     29 </client>
     30 
     31 <reply>
     32 <servercmd>
     33 upgrade
     34 </servercmd>
     35 
     36 # PING "test"
     37 # CLOSE
     38 <data nocheck="yes" nonewline="yes">
     39 HTTP/1.1 101 Switching to WebSockets
     40 Server: server/%TESTNUMBER
     41 Upgrade: Websocket
     42 Connection: Upgrade
     43 Sec-WebSocket-Accept: HkPsVga7+8LuxM4RGQ5p9tZHeYs=
     44 
     45 %hex[%89%04test]hex%%hex[%88%00]hex%
     46 </data>
     47 </reply>
     48 
     49 <verify>
     50 
     51 # PONG "test" (payload MUST equal ping payload)
     52 #   see https://datatracker.ietf.org/doc/html/rfc6455#section-5.2
     53 # CLOSE
     54 <protocol nonewline="yes">
     55 %hex[%8A%84%00%00%00%00test%88%80%00%00%00%00]hex%
     56 </protocol>
     57 
     58 # PING is handled by lib and never given to application
     59 <stdout>
     60 close [0]
     61 </stdout>
     62 
     63 # CURLE_OK
     64 <errorcode>
     65 0
     66 </errorcode>
     67 
     68 # Strip HTTP header from <protocol>
     69 <strip>
     70 ^GET /.*
     71 ^(Host|User-Agent|Accept|Upgrade|Connection|Sec-WebSocket-(Version|Key)): .*
     72 ^\s*$
     73 </strip>
     74 </verify>
     75 </testcase>