Re: url_param not matching key-only params (also testcases for fetchers)
Hello, On 07/16/2018 08:47 PM, Robin H. Johnson wrote: I looked in tests & reg-tests, but didn't see any clear way to add tests for verifying that fetchers work correctly. I think my co-worker found an edge-case on smp_fetch_url_param/smp_fetch_param. Have a look to the attached file to test these sample fetchers. In this reg-test file we use two servers. s1 replies "FAILED" in its body, s2 replies "SUCCEEDED". s2 is used if your ACL is matched, if not this is s1 as default backend which is used. I hope this will help. Regards, Fred. varnishtest "something..." feature ignore_unknown_macro server s1 { rxreq txresp -body "FAILED" } -start server s2 { rxreq txresp -body "SUCCEEDED" } -start haproxy ha1 -conf { defaults mode http timeout connect 20s timeout client 20ms timeout server 1s backend b1 server s1 ${s1_addr}:${s1_port} backend b2 server s2 ${s2_addr}:${s2_port} frontend fe1 default_backend b1 bind "fd@${fe1}" acl bucket_website_crud urlp(website) -m found use_backend b2 if bucket_website_crud } -start client c1 -connect ${ha1_fe1_sock} { txreq -url "/something" rxresp expect resp.body == "FAILED" } client c2 -connect ${ha1_fe1_sock} { txreq -url "/?website=foo" rxresp expect resp.body == "SUCCEEDED" } client c1 -start client c2 -start client c1 -wait client c2 -wait
url_param not matching key-only params (also testcases for fetchers)
I looked in tests & reg-tests, but didn't see any clear way to add tests for verifying that fetchers work correctly. I think my co-worker found an edge-case on smp_fetch_url_param/smp_fetch_param. Trying to identify URLs that have a URL parameter set, that MIGHT not have a value. This is commonly found in AWS S3 sub-resource URLs. Sample inputs that are all expected to match below. # Desired code: acl bucket_website_crud urlp(website) -m found # Should_match, Input 1,/?website 1,/?website=a 1,/?website& 1,/?website 1,/?website=a 1,/?website 1,/?website=1 1,/?website=a=1 1,/?website=1 1,/?foo 1,/?foo=a 1,/?foo& 1,/?foo= 1,/?foo==a 1,/?foo=& # Workaround: acl bucket_website_crud url ?website acl bucket_website_crud url -- Robin Hugh Johnson E-Mail : robb...@orbis-terrarum.net Home Page : http://www.orbis-terrarum.net/?l=people.robbat2 GnuPG FP : 11ACBA4F 4778E3F6 E4EDF38E B27B944E 34884E85 signature.asc Description: Digital signature