Christopher Faulet | d57d9fe | 2021-04-01 10:45:57 +0200 | [diff] [blame] | 1 | varnishtest "A test for the wait-for-body HTTP action" |
| 2 | feature ignore_unknown_macro |
| 3 | |
| 4 | #REQUIRE_VERSION=2.4 |
| 5 | #REGTEST_TYPE=slow |
| 6 | |
| 7 | server s1 { |
| 8 | rxreq |
| 9 | expect req.bodylen == 1001 |
| 10 | txresp |
| 11 | |
| 12 | rxreq |
| 13 | expect req.bodylen == 1001 |
| 14 | txresp |
| 15 | } -start |
| 16 | |
| 17 | |
| 18 | server s2 { |
| 19 | rxreq |
| 20 | send "HTTP/1.1 200 OK\r\n" |
| 21 | send "Content-Length: 1001\r\n\r\n" |
| 22 | delay 0.01 |
| 23 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 24 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 25 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 26 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 27 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 28 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 29 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 30 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 31 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 32 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 33 | |
| 34 | expect_close |
| 35 | accept |
| 36 | |
| 37 | rxreq |
| 38 | send "HTTP/1.1 200 OK\r\n" |
| 39 | send "Content-Length: 1001\r\n\r\n" |
| 40 | delay 0.01 |
| 41 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 42 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 43 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 44 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 45 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 46 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 47 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 48 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 49 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 50 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 51 | delay 0.01 |
| 52 | send "1" |
| 53 | |
| 54 | rxreq |
| 55 | send "HTTP/1.1 201 OK\r\n" |
| 56 | send "Content-Length: 1001\r\n\r\n" |
| 57 | delay 0.01 |
| 58 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 59 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 60 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 61 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 62 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 63 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 64 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 65 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 66 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 67 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 68 | delay 0.1 |
| 69 | send "1" |
| 70 | } -start |
| 71 | |
| 72 | haproxy h1 -conf { |
| 73 | defaults |
| 74 | mode http |
| 75 | ${no-htx} option http-use-htx |
| 76 | timeout client 1s |
| 77 | timeout server 1s |
| 78 | timeout connect 1s |
| 79 | |
| 80 | frontend fe1 |
| 81 | bind "fd@${fe1}" |
| 82 | http-request wait-for-body time 100ms if { path /a } |
| 83 | http-request wait-for-body time 100ms at-least 1000 if { path /b } |
| 84 | use_backend be1 |
| 85 | |
| 86 | backend be1 |
| 87 | server srv1 ${s1_addr}:${s1_port} |
| 88 | |
| 89 | frontend fe2 |
| 90 | bind "fd@${fe2}" |
| 91 | use_backend be2 |
| 92 | |
| 93 | backend be2 |
| 94 | http-response wait-for-body time 100ms if { status eq 200 } |
| 95 | http-response wait-for-body time 100ms at-least 1000 if { status eq 201 } |
| 96 | server srv1 ${s2_addr}:${s2_port} |
| 97 | } -start |
| 98 | |
| 99 | |
| 100 | client c1 -connect ${h1_fe1_sock} { |
| 101 | send "GET /a HTTP/1.1\r\n" |
| 102 | send "Content-Length: 1001\r\n\r\n" |
| 103 | delay 0.01 |
| 104 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 105 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 106 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 107 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 108 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 109 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 110 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 111 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 112 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 113 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 114 | rxresp |
| 115 | expect resp.status == 408 |
| 116 | } -run |
| 117 | |
| 118 | client c2 -connect ${h1_fe1_sock} { |
| 119 | send "GET /a HTTP/1.1\r\n" |
| 120 | send "Content-Length: 1001\r\n\r\n" |
| 121 | delay 0.01 |
| 122 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 123 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 124 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 125 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 126 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 127 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 128 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 129 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 130 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 131 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 132 | delay 0.01 |
| 133 | send "1" |
| 134 | rxresp |
| 135 | expect resp.status == 200 |
| 136 | |
| 137 | send "GET /b HTTP/1.1\r\n" |
| 138 | send "Content-Length: 1001\r\n\r\n" |
| 139 | delay 0.01 |
| 140 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 141 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 142 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 143 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 144 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 145 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 146 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 147 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 148 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 149 | send "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=====================================\n" |
| 150 | delay 0.1 |
| 151 | send "1" |
| 152 | rxresp |
| 153 | expect resp.status == 200 |
| 154 | } -run |
| 155 | |
| 156 | client c3 -connect ${h1_fe2_sock} { |
| 157 | txreq |
| 158 | rxresp |
| 159 | expect resp.status == 504 |
| 160 | } -run |
| 161 | |
| 162 | client c4 -connect ${h1_fe2_sock} { |
| 163 | txreq |
| 164 | rxresp |
| 165 | expect resp.status == 200 |
| 166 | expect resp.bodylen == 1001 |
| 167 | |
| 168 | txreq |
| 169 | rxresp |
| 170 | expect resp.status == 201 |
| 171 | expect resp.bodylen == 1001 |
| 172 | } -run |