Remi Tricot-Le Breton | 2d2ceb5 | 2021-12-16 17:14:41 +0100 | [diff] [blame] | 1 | #REGTEST_TYPE=devel |
| 2 | |
| 3 | # This regtest checks the multiple conditions that can be specified to a |
| 4 | # set-var call (be it a converter or HTTP or TCP action). It mainly uses the |
| 5 | # actions but since the "var_set" function is used for the converter and for |
| 6 | # the actions, it should be enough to focus on one type of set-var. |
| 7 | # Among the variables that can be defined and the multiple scopes they can |
| 8 | # have, the proc scope is the only one having a specific behaviour. Proc scoped |
| 9 | # variables are created during init when a variable of any other scope is |
| 10 | # created during the first successful set-var. |
| 11 | # Since this test uses variables of different scopes, the validation cannot be |
| 12 | # based on the "show var" command of the CLI because it only displays process |
| 13 | # variables. It then always follows the same logic, for every sub test case : |
| 14 | # an HTTP header is added to the response in which we add a concatenation of |
| 15 | # all the tested variables (which exist in the request/response scope). These |
| 16 | # HTTP headers are then tested upon an expected result (which changes for every |
| 17 | # test case). |
| 18 | # |
| 19 | |
| 20 | varnishtest "Test the conditional set-var converter and action" |
| 21 | feature cmd "$HAPROXY_PROGRAM -cc 'version_atleast(2.5-dev0)'" |
| 22 | feature cmd "command -v socat" |
| 23 | feature ignore_unknown_macro |
| 24 | |
| 25 | server s1 -repeat 10 { |
| 26 | rxreq |
| 27 | txresp |
| 28 | } -start |
| 29 | |
| 30 | haproxy h1 -conf { |
| 31 | global |
Remi Tricot-Le Breton | 2d2ceb5 | 2021-12-16 17:14:41 +0100 | [diff] [blame] | 32 | set-var proc.int12 int(12) |
| 33 | set-var proc.int5 var(proc.str60,60),div(proc.int12) |
| 34 | |
| 35 | defaults |
| 36 | mode http |
| 37 | timeout connect 100ms |
| 38 | timeout client 1s |
| 39 | timeout server 1s |
| 40 | |
| 41 | listen main-fe |
| 42 | bind "fd@${mainfe}" |
| 43 | |
| 44 | use_backend ifexists_be if { path_beg /ifexists } |
| 45 | use_backend ifnotexists_be if { path_beg /ifnotexists } |
| 46 | use_backend ifempty_be if { path_beg /ifempty } |
| 47 | use_backend ifnotempty_be if { path_beg /ifnotempty } |
| 48 | use_backend ifset_be if { path_beg /ifset } |
| 49 | use_backend ifnotset_be if { path_beg /ifnotset } |
| 50 | use_backend ifgt_be if { path_beg /ifgt } |
| 51 | use_backend iflt_be if { path_beg /iflt } |
| 52 | use_backend combined_be if { path_beg /combined } |
| 53 | use_backend converter_be if { path_beg /converter } |
| 54 | |
| 55 | |
| 56 | backend ifexists_be |
| 57 | server s1 ${s1_addr}:${s1_port} |
| 58 | |
| 59 | # proc scope variables are created during configuration parsing so the |
| 60 | # ifexists condition will always be true for those variables |
| 61 | http-response set-var(proc.ifexists_proc,ifexists) var(proc.int12) |
| 62 | http-response set-var(sess.ifexists_sess,ifexists) var(proc.int5) |
| 63 | http-response set-var(res.ifexists_res,ifexists) str(toto) |
| 64 | |
| 65 | http-response set-header x-var "proc.ifexists=%[var(proc.ifexists_proc)] sess.ifexists=%[var(sess.ifexists_sess)] res.ifexists=%[var(res.ifexists_res)]" |
| 66 | |
| 67 | |
| 68 | backend ifnotexists_be |
| 69 | server s1 ${s1_addr}:${s1_port} |
| 70 | |
| 71 | http-response set-header x-var-init "proc.ifnotexists=%[var(proc.ifnotexists_proc)] sess.ifnotexists=%[var(sess.ifnotexists_sess)] res.ifnotexists=%[var(res.ifnotexists_res)]" |
| 72 | |
| 73 | http-response set-var(proc.ifnotexists_proc,ifnotexists) var(proc.int12) |
| 74 | http-response set-var(sess.ifnotexists_sess,ifnotexists) var(proc.int5) |
| 75 | http-response set-var(res.ifnotexists_res,ifnotexists) str(toto) |
| 76 | |
| 77 | http-response set-header x-var "proc.ifnotexists=%[var(proc.ifnotexists_proc)] sess.ifnotexists=%[var(sess.ifnotexists_sess)] res.ifnotexists=%[var(res.ifnotexists_res)]" |
| 78 | |
| 79 | |
| 80 | backend ifempty_be |
| 81 | server s1 ${s1_addr}:${s1_port} |
| 82 | # init |
| 83 | http-response set-var(proc.ifempty_proc) str(ifempty_proc) |
| 84 | http-response set-var(sess.ifempty_sess) bin(6966656d7074795f73657373) #ifempty_sess |
| 85 | http-response set-var(res.ifempty_res) str(ifempty_res) |
| 86 | http-response set-var(res.ifempty_res_int) int(5) |
| 87 | |
| 88 | http-response set-header x-var-init "proc.ifempty=%[var(proc.ifempty_proc)] sess.ifempty=%[var(sess.ifempty_sess)] res.ifempty=%[var(res.ifempty_res)] res.ifempty_res_int=%[var(res.ifempty_res_int)]" |
| 89 | |
| 90 | # None of those set-var calls should actually change their respective variables |
| 91 | # since none of the samples is empty |
| 92 | http-response set-var(proc.ifempty_proc,ifempty) int(12) |
| 93 | http-response set-var(sess.ifempty_sess,ifempty) bool(false) |
| 94 | http-response set-var(res.ifempty_res,ifempty) bin(746F746F) # "toto" |
| 95 | http-response set-var(res.ifempty_res_int,ifempty) str(toto) |
| 96 | |
| 97 | http-response set-header x-var1 "proc.ifempty=%[var(proc.ifempty_proc)] sess.ifempty=%[var(sess.ifempty_sess)] res.ifempty=%[var(res.ifempty_res)] res.ifempty_res_int=%[var(res.ifempty_res_int)]" |
| 98 | |
| 99 | http-response set-var(proc.ifempty_proc,ifempty) str() |
| 100 | http-response set-var(sess.ifempty_sess,ifempty) str() |
| 101 | http-response set-var(res.ifempty_res,ifempty) str() |
| 102 | http-response set-var(res.ifempty_res_int,ifempty) int(7) # should not work, scalar types are never empty |
| 103 | |
| 104 | http-response set-header x-var2 "proc.ifempty=%[var(proc.ifempty_proc)] sess.ifempty=%[var(sess.ifempty_sess)] res.ifempty=%[var(res.ifempty_res)] res.ifempty_res_int=%[var(res.ifempty_res_int)]" |
| 105 | |
| 106 | |
| 107 | backend ifnotempty_be |
| 108 | server s1 ${s1_addr}:${s1_port} |
| 109 | # init |
| 110 | http-response set-var(proc.ifnotempty_proc) str(ifnotempty_proc) |
| 111 | http-response set-var(sess.ifnotempty_sess) bin(69666e6f74656d7074795f73657373) # "ifnotempty_sess" |
| 112 | http-response set-var(res.ifnotempty_res) str(ifnotempty_res) |
| 113 | http-response set-var(res.ifnotempty_res_int) int(5) |
| 114 | |
| 115 | http-response set-header x-var-init "proc.ifnotempty=%[var(proc.ifnotempty_proc)] sess.ifnotempty=%[var(sess.ifnotempty_sess)] res.ifnotempty=%[var(res.ifnotempty_res)] res.ifnotempty_res_int=%[var(res.ifnotempty_res_int)]" |
| 116 | |
| 117 | # None of those set-var calls should actually change their respective variables |
| 118 | # since none of the samples is not empty |
| 119 | http-response set-var(proc.ifnotempty_proc,ifnotempty) str(toto) |
| 120 | http-response set-var(sess.ifnotempty_sess,ifnotempty) bin(746F746F) # "toto" |
| 121 | http-response set-var(res.ifnotempty_res,ifnotempty) str(tata) |
| 122 | http-response set-var(res.ifnotempty_res_int,ifnotempty) int(6) |
| 123 | |
| 124 | http-response set-header x-var1 "proc.ifnotempty=%[var(proc.ifnotempty_proc)] sess.ifnotempty=%[var(sess.ifnotempty_sess)] res.ifnotempty=%[var(res.ifnotempty_res)] res.ifnotempty_res_int=%[var(res.ifnotempty_res_int)]" |
| 125 | |
| 126 | # The first three variables should remain unchanged. |
| 127 | http-response set-var(proc.ifnotempty_proc,ifnotempty) str() |
| 128 | http-response set-var(sess.ifnotempty_sess,ifnotempty) str() |
| 129 | http-response set-var(res.ifnotempty_res,ifnotempty) str() |
| 130 | http-response set-var(res.ifnotempty_res_int,ifnotempty) int(7) # should not work |
| 131 | |
| 132 | http-response set-header x-var2 "proc.ifnotempty=%[var(proc.ifnotempty_proc)] sess.ifnotempty=%[var(sess.ifnotempty_sess)] res.ifnotempty=%[var(res.ifnotempty_res)] res.ifnotempty_res_int=%[var(res.ifnotempty_res_int)]" |
| 133 | |
| 134 | |
| 135 | backend ifset_be |
| 136 | server s1 ${s1_addr}:${s1_port} |
| 137 | # init |
| 138 | http-response set-var(proc.ifset_proc) str(ifset_proc) |
| 139 | http-response set-var(sess.ifset_sess) bin(69667365745f73657373) # "ifset_sess" |
| 140 | http-response set-var(res.ifset_res) str(ifset_res) |
| 141 | http-response set-var(res.ifset_res_int) int(5) |
| 142 | |
| 143 | http-response set-header x-var-init "proc.ifset=%[var(proc.ifset_proc)] sess.ifset=%[var(sess.ifset_sess)] res.ifset=%[var(res.ifset_res)] res.ifset_res_int=%[var(res.ifset_res_int)]" |
| 144 | |
| 145 | # All those set-var calls should succeed |
| 146 | http-response set-var(proc.ifset_proc,ifset) str(toto) |
| 147 | http-response set-var(sess.ifset_sess,ifset) bin(746F746F) # "toto" |
| 148 | http-response set-var(res.ifset_res,ifset) int(123) |
| 149 | http-response set-var(res.ifset_res_int,ifset) str(azerty) |
| 150 | |
| 151 | http-response set-header x-var1 "proc.ifset=%[var(proc.ifset_proc)] sess.ifset=%[var(sess.ifset_sess)] res.ifset=%[var(res.ifset_res)] res.ifset_res_int=%[var(res.ifset_res_int)]" |
| 152 | |
| 153 | http-response unset-var(proc.ifset_proc) |
| 154 | http-response unset-var(sess.ifset_sess) |
| 155 | http-response unset-var(res.ifset_res) |
| 156 | http-response unset-var(res.ifset_res_int) |
| 157 | |
| 158 | http-response set-header x-var2 "proc.ifset=%[var(proc.ifset_proc)] sess.ifset=%[var(sess.ifset_sess)] res.ifset=%[var(res.ifset_res)] res.ifset_res_int=%[var(res.ifset_res_int)]" |
| 159 | |
| 160 | # None of those set-var calls should succeed |
| 161 | http-response set-var(proc.ifset_proc,ifset) str(toto) |
| 162 | http-response set-var(sess.ifset_sess,ifset) bin(746F746F) # "toto" |
| 163 | http-response set-var(res.ifset_res,ifset) int(123) |
| 164 | http-response set-var(res.ifset_res_int,ifset) str(azerty) |
| 165 | |
| 166 | http-response set-header x-var3 "proc.ifset=%[var(proc.ifset_proc)] sess.ifset=%[var(sess.ifset_sess)] res.ifset=%[var(res.ifset_res)] res.ifset_res_int=%[var(res.ifset_res_int)]" |
| 167 | |
| 168 | |
| 169 | backend ifnotset_be |
| 170 | server s1 ${s1_addr}:${s1_port} |
| 171 | # init |
| 172 | http-response set-var(proc.ifnotset_proc) str(ifnotset_proc) |
| 173 | http-response set-var(sess.ifnotset_sess) bin(69666e6f747365745f73657373) # "ifnotset_sess" |
| 174 | http-response set-var(res.ifnotset_res) str(ifnotset_res) |
| 175 | http-response set-var(res.ifnotset_res_int) int(5) |
| 176 | |
| 177 | http-response set-header x-var-init "proc.ifnotset=%[var(proc.ifnotset_proc)] sess.ifnotset=%[var(sess.ifnotset_sess)] res.ifnotset=%[var(res.ifnotset_res)] res.ifnotset_res_int=%[var(res.ifnotset_res_int)]" |
| 178 | |
| 179 | # None of those set-var calls should succeed |
| 180 | http-response set-var(proc.ifnotset_proc,ifnotset) str(toto) |
| 181 | http-response set-var(sess.ifnotset_sess,ifnotset) bin(746F746F) # "toto" |
| 182 | http-response set-var(res.ifnotset_res,ifnotset) int(123) |
| 183 | http-response set-var(res.ifnotset_res_int,ifnotset) str(azerty) |
| 184 | |
| 185 | http-response set-header x-var1 "proc.ifnotset=%[var(proc.ifnotset_proc)] sess.ifnotset=%[var(sess.ifnotset_sess)] res.ifnotset=%[var(res.ifnotset_res)] res.ifnotset_res_int=%[var(res.ifnotset_res_int)]" |
| 186 | |
| 187 | http-response unset-var(proc.ifnotset_proc) |
| 188 | http-response unset-var(sess.ifnotset_sess) |
| 189 | http-response unset-var(res.ifnotset_res) |
| 190 | http-response unset-var(res.ifnotset_res_int) |
| 191 | |
| 192 | http-response set-header x-var2 "proc.ifnotset=%[var(proc.ifnotset_proc)] sess.ifnotset=%[var(sess.ifnotset_sess)] res.ifnotset=%[var(res.ifnotset_res)] res.ifnotset_res_int=%[var(res.ifnotset_res_int)]" |
| 193 | |
| 194 | # All of those set-var calls should succeed |
| 195 | http-response set-var(proc.ifnotset_proc,ifnotset) str(toto) |
| 196 | http-response set-var(sess.ifnotset_sess,ifnotset) bin(746F746F) # "toto" |
| 197 | http-response set-var(res.ifnotset_res,ifnotset) int(123) |
| 198 | http-response set-var(res.ifnotset_res_int,ifnotset) str(azerty) |
| 199 | |
| 200 | http-response set-header x-var3 "proc.ifnotset=%[var(proc.ifnotset_proc)] sess.ifnotset=%[var(sess.ifnotset_sess)] res.ifnotset=%[var(res.ifnotset_res)] res.ifnotset_res_int=%[var(res.ifnotset_res_int)]" |
| 201 | |
| 202 | backend ifgt_be |
| 203 | server s1 ${s1_addr}:${s1_port} |
| 204 | # init |
| 205 | http-response set-var(proc.ifgt_proc) str(ifgt_proc) |
| 206 | http-response set-var(sess.ifgt_sess) bin(696667745f73657373) # "ifgt_sess" |
| 207 | http-response set-var(res.ifgt_res1) str(ifgt_res) |
| 208 | http-response set-var(res.ifgt_res2) int(5) |
| 209 | http-response set-var(res.ifgt_res_int1) int(5) |
| 210 | http-response set-var(res.ifgt_res_int2) int(5) |
| 211 | |
| 212 | http-response set-header x-var-init "proc.ifgt=%[var(proc.ifgt_proc)] sess.ifgt=%[var(sess.ifgt_sess)] res.ifgt1=%[var(res.ifgt_res1)] res.ifgt2=%[var(res.ifgt_res2)] res.ifgt_res_int1=%[var(res.ifgt_res_int1)] res.ifgt_res_int2=%[var(res.ifgt_res_int2)]" |
| 213 | |
| 214 | # ifgt does not apply on non scalar type so the two following set-var will ignore the condition |
| 215 | http-response set-var(proc.ifgt_proc,ifgt) str(toto) |
| 216 | http-response set-var(sess.ifgt_sess,ifgt) bin(746F746F) # "toto" |
| 217 | # ifgt can only apply when the variable and the sample are both scalar. In this case, the variable was a string so the condition is ignored |
| 218 | http-response set-var(res.ifgt_res1,ifgt) int(55) |
| 219 | # ifgt can only apply when the variable and the sample are both scalar. In this case, the sample is a string so the condition is ignored |
| 220 | http-response set-var(res.ifgt_res2,ifgt) str(text) |
| 221 | http-response set-var(res.ifgt_res_int1,ifgt) int(55) # should not work |
| 222 | http-response set-var(res.ifgt_res_int2,ifgt) int(2) # should work |
| 223 | |
| 224 | http-response set-header x-var1 "proc.ifgt=%[var(proc.ifgt_proc)] sess.ifgt=%[var(sess.ifgt_sess)] res.ifgt1=%[var(res.ifgt_res1)] res.ifgt2=%[var(res.ifgt_res2)] res.ifgt_res_int1=%[var(res.ifgt_res_int1)] res.ifgt_res_int2=%[var(res.ifgt_res_int2)]" |
| 225 | |
| 226 | |
| 227 | backend iflt_be |
| 228 | server s1 ${s1_addr}:${s1_port} |
| 229 | # init |
| 230 | http-response set-var(proc.iflt_proc) str(iflt_proc) |
| 231 | http-response set-var(sess.iflt_sess) bin(69666c745f73657373) # "iflt_sess" |
| 232 | http-response set-var(res.iflt_res1) str(iflt_res) |
| 233 | http-response set-var(res.iflt_res2) int(5) |
| 234 | http-response set-var(res.iflt_res_int1) int(5) |
| 235 | http-response set-var(res.iflt_res_int2) int(5) |
| 236 | |
| 237 | http-response set-header x-var-init "proc.iflt=%[var(proc.iflt_proc)] sess.iflt=%[var(sess.iflt_sess)] res.iflt1=%[var(res.iflt_res1)] res.iflt2=%[var(res.iflt_res2)] res.iflt_res_int1=%[var(res.iflt_res_int1)] res.iflt_res_int2=%[var(res.iflt_res_int2)]" |
| 238 | |
| 239 | # iflt does not apply on non scalar type so the two following set-var will ignore the condition |
| 240 | http-response set-var(proc.iflt_proc,iflt) str(toto) |
| 241 | http-response set-var(sess.iflt_sess,iflt) bin(746F746F) # "toto" |
| 242 | # iflt can only apply when the variable and the sample are both scalar. In this case, the variable was a string so the condition is ignored |
| 243 | http-response set-var(res.iflt_res1,iflt) int(55) |
| 244 | # iflt can only apply when the variable and the sample are both scalar. In this case, the sample is a string so the condition is ignored |
| 245 | http-response set-var(res.iflt_res2,iflt) str(text) |
| 246 | http-response set-var(res.iflt_res_int1,iflt) int(55) # should work |
| 247 | http-response set-var(res.iflt_res_int2,iflt) int(2) # should not work |
| 248 | |
| 249 | http-response set-header x-var1 "proc.iflt=%[var(proc.iflt_proc)] sess.iflt=%[var(sess.iflt_sess)] res.iflt1=%[var(res.iflt_res1)] res.iflt2=%[var(res.iflt_res2)] res.iflt_res_int1=%[var(res.iflt_res_int1)] res.iflt_res_int2=%[var(res.iflt_res_int2)]" |
| 250 | |
| 251 | |
| 252 | # Test multiple conditions at once |
| 253 | backend combined_be |
| 254 | server s1 ${s1_addr}:${s1_port} |
| 255 | # init |
| 256 | http-response set-var(proc.combined_proc) str(combined_proc) |
| 257 | http-response set-var(res.combined_res) int(5) |
| 258 | http-response unset-var(proc.combined_proc) |
| 259 | |
| 260 | http-response set-header x-var-init "proc.combined=%[var(proc.combined_proc)] res.combined=%[var(res.combined_res)]" |
| 261 | |
| 262 | http-response set-var(proc.combined_proc,ifnotset,ifnotempty) str(toto) |
| 263 | http-response set-var(res.combined_res,ifset,iflt) int(55) |
| 264 | |
| 265 | http-response set-header x-var1 "proc.combined=%[var(proc.combined_proc)] res.combined=%[var(res.combined_res)]" |
| 266 | |
| 267 | |
| 268 | # Test the set-var converter |
| 269 | backend converter_be |
| 270 | server s1 ${s1_addr}:${s1_port} |
| 271 | |
| 272 | http-request deny if { req.len,set-var(proc.req_len,ifexists) -m int 0 } |
| 273 | http-request deny if { req.hdr("X-Cust"),set-var(sess.x_cust,ifnotempty,ifnotset),length -m int 0 } |
| 274 | |
| 275 | http-response set-header x-var "proc.req_len=%[var(proc.req_len)] sess.x_cust=%[var(sess.x_cust)]" |
| 276 | |
| 277 | } -start |
| 278 | |
| 279 | |
| 280 | client c1 -connect ${h1_mainfe_sock} { |
| 281 | txreq -url "/ifexists" |
| 282 | rxresp |
| 283 | expect resp.status == 200 |
| 284 | expect resp.http.x-var == "proc.ifexists=12 sess.ifexists= res.ifexists=" |
| 285 | } -run |
| 286 | |
| 287 | client c2 -connect ${h1_mainfe_sock} { |
| 288 | txreq -url "/ifnotexists" |
| 289 | rxresp |
| 290 | expect resp.status == 200 |
| 291 | expect resp.http.x-var-init == "proc.ifnotexists= sess.ifnotexists= res.ifnotexists=" |
| 292 | expect resp.http.x-var == "proc.ifnotexists= sess.ifnotexists=5 res.ifnotexists=toto" |
| 293 | } -run |
| 294 | |
| 295 | client c3 -connect ${h1_mainfe_sock} { |
| 296 | txreq -url "/ifempty" |
| 297 | rxresp |
| 298 | expect resp.status == 200 |
| 299 | expect resp.http.x-var-init == "proc.ifempty=ifempty_proc sess.ifempty=ifempty_sess res.ifempty=ifempty_res res.ifempty_res_int=5" |
| 300 | expect resp.http.x-var1 == "proc.ifempty=ifempty_proc sess.ifempty=ifempty_sess res.ifempty=ifempty_res res.ifempty_res_int=5" |
| 301 | expect resp.http.x-var2 == "proc.ifempty= sess.ifempty= res.ifempty= res.ifempty_res_int=5" |
| 302 | } -run |
| 303 | |
| 304 | client c4 -connect ${h1_mainfe_sock} { |
| 305 | txreq -url "/ifnotempty" |
| 306 | rxresp |
| 307 | expect resp.status == 200 |
| 308 | expect resp.http.x-var-init == "proc.ifnotempty=ifnotempty_proc sess.ifnotempty=ifnotempty_sess res.ifnotempty=ifnotempty_res res.ifnotempty_res_int=5" |
| 309 | expect resp.http.x-var1 == "proc.ifnotempty=toto sess.ifnotempty=toto res.ifnotempty=tata res.ifnotempty_res_int=6" |
| 310 | expect resp.http.x-var2 == "proc.ifnotempty=toto sess.ifnotempty=toto res.ifnotempty=tata res.ifnotempty_res_int=7" |
| 311 | } -run |
| 312 | |
| 313 | client c5 -connect ${h1_mainfe_sock} { |
| 314 | txreq -url "/ifset" |
| 315 | rxresp |
| 316 | expect resp.status == 200 |
| 317 | expect resp.http.x-var-init == "proc.ifset=ifset_proc sess.ifset=ifset_sess res.ifset=ifset_res res.ifset_res_int=5" |
| 318 | expect resp.http.x-var1 == "proc.ifset=toto sess.ifset=toto res.ifset=123 res.ifset_res_int=azerty" |
| 319 | expect resp.http.x-var2 == "proc.ifset= sess.ifset= res.ifset= res.ifset_res_int=" |
| 320 | expect resp.http.x-var3 == "proc.ifset= sess.ifset= res.ifset= res.ifset_res_int=" |
| 321 | } -run |
| 322 | |
| 323 | client c6 -connect ${h1_mainfe_sock} { |
| 324 | txreq -url "/ifnotset" |
| 325 | rxresp |
| 326 | expect resp.status == 200 |
| 327 | expect resp.http.x-var-init == "proc.ifnotset=ifnotset_proc sess.ifnotset=ifnotset_sess res.ifnotset=ifnotset_res res.ifnotset_res_int=5" |
| 328 | expect resp.http.x-var1 == "proc.ifnotset=ifnotset_proc sess.ifnotset=ifnotset_sess res.ifnotset=ifnotset_res res.ifnotset_res_int=5" |
| 329 | expect resp.http.x-var2 == "proc.ifnotset= sess.ifnotset= res.ifnotset= res.ifnotset_res_int=" |
| 330 | expect resp.http.x-var3 == "proc.ifnotset=toto sess.ifnotset=toto res.ifnotset=123 res.ifnotset_res_int=azerty" |
| 331 | } -run |
| 332 | |
| 333 | client c7 -connect ${h1_mainfe_sock} { |
| 334 | txreq -url "/ifgt" |
| 335 | rxresp |
| 336 | expect resp.status == 200 |
| 337 | expect resp.http.x-var-init == "proc.ifgt=ifgt_proc sess.ifgt=ifgt_sess res.ifgt1=ifgt_res res.ifgt2=5 res.ifgt_res_int1=5 res.ifgt_res_int2=5" |
| 338 | expect resp.http.x-var1 == "proc.ifgt=toto sess.ifgt=toto res.ifgt1=55 res.ifgt2=text res.ifgt_res_int1=5 res.ifgt_res_int2=2" |
| 339 | } -run |
| 340 | |
| 341 | client c8 -connect ${h1_mainfe_sock} { |
| 342 | txreq -url "/iflt" |
| 343 | rxresp |
| 344 | expect resp.status == 200 |
| 345 | expect resp.http.x-var-init == "proc.iflt=iflt_proc sess.iflt=iflt_sess res.iflt1=iflt_res res.iflt2=5 res.iflt_res_int1=5 res.iflt_res_int2=5" |
| 346 | expect resp.http.x-var1 == "proc.iflt=toto sess.iflt=toto res.iflt1=55 res.iflt2=text res.iflt_res_int1=55 res.iflt_res_int2=5" |
| 347 | } -run |
| 348 | |
| 349 | client c9 -connect ${h1_mainfe_sock} { |
| 350 | txreq -url "/combined" |
| 351 | rxresp |
| 352 | expect resp.status == 200 |
| 353 | expect resp.http.x-var-init == "proc.combined= res.combined=5" |
| 354 | expect resp.http.x-var1 == "proc.combined=toto res.combined=55" |
| 355 | } -run |
| 356 | |
| 357 | client c10 -connect ${h1_mainfe_sock} { |
| 358 | txreq -url "/converter" -hdr "X-Cust: foobar" |
| 359 | rxresp |
| 360 | expect resp.status == 200 |
| 361 | expect resp.http.x-var == "proc.req_len=67 sess.x_cust=foobar" |
| 362 | } -run |