quickjs-tart

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

test650 (4705B)


      1 <testcase>
      2 <info>
      3 <keywords>
      4 HTTP
      5 HTTP POST
      6 FORM
      7 </keywords>
      8 </info>
      9 
     10 #
     11 # Server-side
     12 <reply>
     13 <data nocheck="yes">
     14 HTTP/1.1 301 OK
     15 Date: Tue, 09 Nov 2010 14:49:00 GMT
     16 Server: test-server/fake swsclose
     17 Connection: close
     18 Content-Type: text/html
     19 Location: /%TESTNUMBER0002
     20 
     21 hello
     22 </data>
     23 <data2 crlf="yes">
     24 HTTP/1.1 200 OK
     25 Date: Tue, 09 Nov 2010 14:49:00 GMT
     26 Server: test-server/fake
     27 Content-Length: 6
     28 Connection: close
     29 Content-Type: text/html
     30 
     31 -foo-
     32 </data2>
     33 </reply>
     34 
     35 # Client-side
     36 <client>
     37 <features>
     38 form-api
     39 </features>
     40 <server>
     41 http
     42 </server>
     43 # tool is what to use instead of 'curl'
     44 <tool>
     45 lib%TESTNUMBER
     46 </tool>
     47 
     48 <name>
     49 HTTP formpost using form API - with redirect and re-POST
     50 </name>
     51 <stdin>
     52  Some data from stdin
     53 </stdin>
     54 <command>
     55 http://%HOSTIP:%HTTPPORT/%TESTNUMBER %LOGDIR/test%TESTNUMBER.filedata
     56 </command>
     57 <file name="%LOGDIR/test%TESTNUMBER.filedata">
     58 This is data from a file.
     59 </file>
     60 </client>
     61 
     62 #
     63 # Verify data bbter the test has been "shot"
     64 <verify>
     65 <strippart>
     66 s/^--------------------------[A-Za-z0-9]*/------------------------------/
     67 s/boundary=------------------------[A-Za-z0-9]*/boundary=----------------------------/
     68 </strippart>
     69 # Note that the stripping above removes 12 bytes from every occurrence of the
     70 # boundary string and since 5 of them are in the body contents, we see
     71 # (5*12) == 60 bytes less
     72 <protocol>
     73 POST /%TESTNUMBER HTTP/1.1
     74 Host: %HOSTIP:%HTTPPORT
     75 Accept: */*
     76 Transfer-Encoding: chunked
     77 Content-Type: multipart/form-data; boundary=----------------------------
     78 Expect: 100-continue
     79 
     80 385
     81 ------------------------------
     82 Content-Disposition: form-data; name="fieldname"
     83 Content-Type: text/plain
     84 X-customheader-1: Header 1 data
     85 X-customheader-2: Header 2 data
     86 
     87 this is what we post to the silly web server
     88 ------------------------------
     89 Content-Disposition: form-data; name="fieldnam"
     90 
     91 uhis is what we post to the silly web serve
     92 ------------------------------
     93 Content-Disposition: form-data; name="multifile"
     94 Content-Type: multipart/mixed; boundary=----------------------------
     95 
     96 ------------------------------
     97 Content-Disposition: attachment; filename="test%TESTNUMBER.filedata"
     98 Content-Type: application/octet-stream
     99 
    100 This is data from a file.
    101 
    102 ------------------------------
    103 Content-Disposition: attachment; filename="test%TESTNUMBER.filedata"
    104 Content-Type: text/whatever
    105 
    106 
    107 ab
    108 This is data from a file.
    109 
    110 ------------------------------
    111 Content-Disposition: attachment; filename="test%TESTNUMBER.filedata"
    112 Content-Type: text/whatever
    113 
    114 
    115 bb
    116 This is data from a file.
    117 
    118 --------------------------------
    119 
    120 ------------------------------
    121 Content-Disposition: form-data; name="filecontents"
    122 
    123 
    124 11b
    125 This is data from a file.
    126 
    127 ------------------------------
    128 Content-Disposition: form-data; name="formlength"
    129 
    130 1433
    131 ------------------------------
    132 Content-Disposition: form-data; name="standardinput"
    133 Content-Type: application/octet-stream
    134 
    135 
    136 16
    137  Some data from stdin
    138 
    139 36
    140 
    141 --------------------------------
    142 
    143 0
    144 
    145 POST /%TESTNUMBER0002 HTTP/1.1
    146 Host: %HOSTIP:%HTTPPORT
    147 Accept: */*
    148 Transfer-Encoding: chunked
    149 Content-Type: multipart/form-data; boundary=----------------------------
    150 Expect: 100-continue
    151 
    152 385
    153 ------------------------------
    154 Content-Disposition: form-data; name="fieldname"
    155 Content-Type: text/plain
    156 X-customheader-1: Header 1 data
    157 X-customheader-2: Header 2 data
    158 
    159 this is what we post to the silly web server
    160 ------------------------------
    161 Content-Disposition: form-data; name="fieldnam"
    162 
    163 uhis is what we post to the silly web serve
    164 ------------------------------
    165 Content-Disposition: form-data; name="multifile"
    166 Content-Type: multipart/mixed; boundary=----------------------------
    167 
    168 ------------------------------
    169 Content-Disposition: attachment; filename="test%TESTNUMBER.filedata"
    170 Content-Type: application/octet-stream
    171 
    172 This is data from a file.
    173 
    174 ------------------------------
    175 Content-Disposition: attachment; filename="test%TESTNUMBER.filedata"
    176 Content-Type: text/whatever
    177 
    178 
    179 ab
    180 This is data from a file.
    181 
    182 ------------------------------
    183 Content-Disposition: attachment; filename="test%TESTNUMBER.filedata"
    184 Content-Type: text/whatever
    185 
    186 
    187 bb
    188 This is data from a file.
    189 
    190 --------------------------------
    191 
    192 ------------------------------
    193 Content-Disposition: form-data; name="filecontents"
    194 
    195 
    196 11b
    197 This is data from a file.
    198 
    199 ------------------------------
    200 Content-Disposition: form-data; name="formlength"
    201 
    202 1433
    203 ------------------------------
    204 Content-Disposition: form-data; name="standardinput"
    205 Content-Type: application/octet-stream
    206 
    207 
    208 16
    209  Some data from stdin
    210 
    211 36
    212 
    213 --------------------------------
    214 
    215 0
    216 
    217 </protocol>
    218 </verify>
    219 </testcase>