quickjs-tart

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

test2707 (2175B)


      1 <testcase>
      2 <info>
      3 <keywords>
      4 WebSockets
      5 </keywords>
      6 </info>
      7 
      8 <client>
      9 <name>
     10 ws: Peculiar frame sizes
     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 </setenv>
     28 </client>
     29 
     30 <reply>
     31 <servercmd>
     32 upgrade
     33 </servercmd>
     34 
     35 # Full list of frames: see <verify.stdout> below
     36 # Frames with sizes around special cases of the frame encoding
     37 #   see https://datatracker.ietf.org/doc/html/rfc6455#section-5.2
     38 #    - 0: empty frame
     39 #    - 125: largest payload with 7-bit encoding
     40 #    - 126: smallest payload with 16-bit encoding AND this value in first byte indicates 16-bit encoding
     41 #    - 127: this value in first byte indicates 64-bit encoding
     42 #    - 65535: largest payload with 16-bit length encoding
     43 #    - 65536: smallest payload with 64-bit length encoding
     44 <data nocheck="yes" nonewline="yes">
     45 HTTP/1.1 101 Switching to WebSockets
     46 Server: server/%TESTNUMBER
     47 Upgrade: Websocket
     48 Connection: Upgrade
     49 Sec-WebSocket-Accept: HkPsVga7+8LuxM4RGQ5p9tZHeYs=
     50 
     51 %hex[%81%00]hex%%hex[%81%7d]hex%%repeat[125 x _]%%hex[%81%7e%00%7e]hex%%repeat[126 x _]%%hex[%81%7e%00%7f]hex%%repeat[127 x _]%%hex[%81%7e%ff%ff]hex%%repeat[65535 x _]%%hex[%81%7f%00%00%00%00%00%01%00%00]hex%%repeat[65536 x _]%%hex[%88%00]hex%
     52 </data>
     53 </reply>
     54 
     55 <verify>
     56 
     57 # Exact echo of reply data with additional masking
     58 <protocol nonewline="yes">
     59 %hex[%81%80%00%00%00%00]hex%%hex[%81%fd%00%00%00%00]hex%%repeat[125 x _]%%hex[%81%fe%00%7e%00%00%00%00]hex%%repeat[126 x _]%%hex[%81%fe%00%7f%00%00%00%00]hex%%repeat[127 x _]%%hex[%81%fe%ff%ff%00%00%00%00]hex%%repeat[65535 x _]%%hex[%81%ff%00%00%00%00%00%01%00%00%00%00%00%00]hex%%repeat[65536 x _]%%hex[%88%80%00%00%00%00]hex%
     60 </protocol>
     61 
     62 <stdout>
     63 txt fin [0]
     64 txt fin [125] %repeat[125 x _]%
     65 txt fin [126] %repeat[126 x _]%
     66 txt fin [127] %repeat[127 x _]%
     67 txt fin [65535] %repeat[65535 x _]%
     68 txt fin [65536] %repeat[65536 x _]%
     69 close [0]
     70 </stdout>
     71 
     72 # CURLE_OK
     73 <errorcode>
     74 0
     75 </errorcode>
     76 
     77 # Strip HTTP header from <protocol>
     78 <strip>
     79 ^GET /.*
     80 ^(Host|User-Agent|Accept|Upgrade|Connection|Sec-WebSocket-(Version|Key)): .*
     81 ^\s*$
     82 </strip>
     83 </verify>
     84 </testcase>