Hello Frederic,

On Mon, Jan 07, Frederic Lecaille wrote:
> 
> reg-tests/http-rules/h00003.vtc fails on my side due to a typo in
> the regex with this error:
> 
> ---- h1    0.0 CLI regexp error: 'missing opening brace after \o'
> (@48) (^0x[a-f0-9]+ example\.org
> https://www\.example.\org\n0x[a-f0-9]+ subdomain\.example\.org
> https://www\.subdomain\.example\.org\n$)
> 
> .\org shoulb be replaced by \.org
> 
> Could you check on your side why you did not notice this issue please?

For some reason the buggy regex works for me, maybe it depends on
pcre version.
My varnishtest links to centos7 default pcre (pcre-8.32-17.el7.x86_64).

> After checking this issue we will merge your patches. Great work!

I'm attaching the patches again, with fixed regex in h00003.vtc.
The patches are for recent 2.0dev.

Should reg-tests/README default to [-Dno-htx='#'] instead of -Dno-htx= ?

-Jarno

-- 
Jarno Huuskonen
>From 1a5a90641ec072d62babbb8ed65c6831998bbdee Mon Sep 17 00:00:00 2001
From: Jarno Huuskonen <jarno.huusko...@uef.fi>
Date: Wed, 9 Jan 2019 13:41:19 +0200
Subject: [PATCH 1/4] REGTESTS: test case for map_regm commit 271022150d

Minimal test case for map_regm commit 271022150d7961b9aa39dbfd88e0c6a4bc48c3ee.
Config and test is adapted from: Daniel Schneller's example
(https://www.mail-archive.com/haproxy@formilux.org/msg30523.html).
---
 reg-tests/http-rules/b00000.map |  1 +
 reg-tests/http-rules/b00000.vtc | 77 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 78 insertions(+)
 create mode 100644 reg-tests/http-rules/b00000.map
 create mode 100644 reg-tests/http-rules/b00000.vtc

diff --git a/reg-tests/http-rules/b00000.map b/reg-tests/http-rules/b00000.map
new file mode 100644
index 0000000..08ffcfb
--- /dev/null
+++ b/reg-tests/http-rules/b00000.map
@@ -0,0 +1 @@
+^(.*)\.(.*)$ \1_AND_\2
diff --git a/reg-tests/http-rules/b00000.vtc b/reg-tests/http-rules/b00000.vtc
new file mode 100644
index 0000000..897c3b4
--- /dev/null
+++ b/reg-tests/http-rules/b00000.vtc
@@ -0,0 +1,77 @@
+#commit 271022150d7961b9aa39dbfd88e0c6a4bc48c3ee
+#    BUG/MINOR: map: fix map_regm with backref
+#
+#    Due to a cascade of get_trash_chunk calls the sample is
+#    corrupted when we want to read it.
+#
+#    The fix consist to use a temporary chunk to copy the sample
+#    value and use it.
+
+varnishtest "map_regm get_trash_chunk test"
+feature ignore_unknown_macro
+
+#REQUIRE_VERSION=1.6
+syslog S1 -level notice {
+    recv
+    expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Proxy (fe|be)1 started."
+    recv
+    expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Proxy (fe|be)1 started."
+    recv info
+    # not expecting ${h1_pid} with master-worker
+    expect ~ "[^:\\[ ]\\[[[:digit:]]+\\]: .* fe1 be1/s1 
[[:digit:]]+/[[:digit:]]+/[[:digit:]]+/[[:digit:]]+/[[:digit:]]+ 200 
[[:digit:]]+ - - ---- .* \"GET / HTTP/(1|2)(\\.1)?\""
+} -start
+
+server s1 {
+   rxreq
+   expect req.method == "GET"
+   expect req.http.x-mapped-from-header == example_AND_org
+   expect req.http.x-mapped-from-var == example_AND_org
+   txresp
+
+   rxreq
+   expect req.method == "GET"
+   expect req.http.x-mapped-from-header == www.example_AND_org
+   expect req.http.x-mapped-from-var == www.example_AND_org
+   txresp
+} -start
+
+haproxy h1 -conf {
+  global
+    log ${S1_addr}:${S1_port} local0 debug err
+
+  defaults
+    mode http
+    ${no-htx} option http-use-htx
+    log global
+    option httplog
+    timeout connect         15ms
+    timeout client          20ms
+    timeout server          20ms
+
+  frontend fe1
+    bind "fd@${fe1}"
+    # Remove port from Host header
+    http-request replace-value Host '(.*):.*' '\1'
+    # Store host header in variable
+    http-request set-var(txn.host) req.hdr(Host)
+    # This works correctly
+    http-request set-header X-Mapped-From-Header 
%[req.hdr(Host),map_regm(${testdir}/b00000.map,"unknown")]
+    # This breaks before commit 271022150d7961b9aa39dbfd88e0c6a4bc48c3ee
+    http-request set-header X-Mapped-From-Var 
%[var(txn.host),map_regm(${testdir}/b00000.map,"unknown")]
+
+    default_backend be1
+
+    backend be1
+    server s1 ${s1_addr}:${s1_port}
+} -start
+
+client c1 -connect ${h1_fe1_sock} {
+    txreq -hdr "Host: example.org:8443"
+    rxresp
+    expect resp.status == 200
+
+    txreq -hdr "Host: www.example.org"
+    rxresp
+    expect resp.status == 200
+} -run
+
-- 
1.8.3.1

>From 27b305721d62d5809f8ec400f0c236dd6a51e149 Mon Sep 17 00:00:00 2001
From: Jarno Huuskonen <jarno.huusko...@uef.fi>
Date: Wed, 9 Jan 2019 13:44:44 +0200
Subject: [PATCH 2/4] REGTESTS: Basic tests for concat,strcmp,word,field,ipmask
 converters

---
 reg-tests/http-rules/h00002.map |   1 +
 reg-tests/http-rules/h00002.vtc | 220 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 221 insertions(+)
 create mode 100644 reg-tests/http-rules/h00002.map
 create mode 100644 reg-tests/http-rules/h00002.vtc

diff --git a/reg-tests/http-rules/h00002.map b/reg-tests/http-rules/h00002.map
new file mode 100644
index 0000000..9a3e8e6
--- /dev/null
+++ b/reg-tests/http-rules/h00002.map
@@ -0,0 +1 @@
+^(.+)_(.+)$ \2_\1
diff --git a/reg-tests/http-rules/h00002.vtc b/reg-tests/http-rules/h00002.vtc
new file mode 100644
index 0000000..019e32e
--- /dev/null
+++ b/reg-tests/http-rules/h00002.vtc
@@ -0,0 +1,220 @@
+varnishtest "Minimal tests for 1.9 converters: ipmask,concat,strcmp,field,word"
+feature ignore_unknown_macro
+
+# concat,strcmp,ipmask(ipv6mask) need 1.9
+#REQUIRE_VERSION=1.9
+
+# ipmask tests server
+server s1 {
+   rxreq
+   expect req.method == "GET"
+   expect req.http.srciphdr == "192.168.1.101"
+   expect req.http.srcmask1 == "192.168.1.0"
+   expect req.http.srcmask2 == "192.168.0.0"
+   expect req.http.srcmask3 == "192.0.0.0"
+
+   expect req.http.test1mask128 == "2001:db8::1"
+   expect req.http.test2mask64 == "2001:db8::"
+   expect req.http.test2mask128 == "2001:db8::bad:c0f:ffff"
+   expect req.http.test2mask120 == "2001:db8::bad:c0f:ff00"
+   expect req.http.test2maskff00 == "2001:db8::bad:c0f:ff00"
+   expect req.http.test2maskfee0 == "2001:db8::bad:c0f:fee0"
+
+   expect req.http.test3mask64 == "2001:db8:c001:c01a::"
+   expect req.http.test3mask64v2 == "2001:db8:c001:c01a::"
+   expect req.http.test3mask64v3 == "2001:db8:c001:c01a::"
+   expect req.http.test3maskff == "2001:db8:c001:c01a:0:ffff:10:0"
+   expect req.http.test3maskv2 == "2001:db8:c001:c01a:c001:c001::"
+
+   expect req.http.test4mask32 == "192.168.1.101"
+
+   expect req.http.test5mask24 == "192.168.1.0"
+   expect req.http.test6mask24 == "192.168.1.0"
+   expect req.http.test6mask25 == "192.168.1.128"
+   txresp
+} -start
+
+# concat,strcmp,field,word tests server
+server s2 {
+   rxreq
+   expect req.method == "GET"
+   expect req.http.fieldconcat == "f1_f2_f3__f5"
+   expect req.http.fieldconcat2 == "f1_f2_f3__f5"
+   expect req.http.fieldconcat3 == "f1_f2_f3__f5"
+   expect req.http.fieldstrcmp == "0"
+
+   # field tests
+   expect req.http.fieldtest1 == "f5"
+   expect req.http.fieldtest2 == "f2_f3__f5"
+   expect req.http.fieldtest3 == "f2_f3"
+   expect req.http.fieldtest4 == "f2_f3_"
+   expect req.http.fieldtest5 == "f1_f2_f3"
+   expect req.http.okfieldtest == "ok"
+   expect req.http.qsfieldtest == "IT_IS"
+   expect req.http.qsfieldconcat == "IT_IS_ok"
+   expect req.http.fieldtest1strcmp == "0"
+
+   # word tests
+   expect req.http.wordtest1 == "f5"
+   expect req.http.wordtest2 == "f2_f3__f5"
+   expect req.http.wordtest3 == "f3__f5"
+   expect req.http.wordtest4 == "f1_f2_f3"
+   expect req.http.wordtest5 == "f1_f2"
+   expect req.http.okwordtest == "OK"
+   expect req.http.qswordtest == "Yes_It"
+   expect req.http.qswordregmtest == "It_Yes"
+   expect req.http.wordtest1strcmp == "0"
+   txresp
+} -start
+
+
+# ipmask tests with accept-proxy bind
+haproxy h1 -conf {
+  defaults
+    mode http
+    ${no-htx} option http-use-htx
+    log global
+    option httplog
+    timeout connect         15ms
+    timeout client          20ms
+    timeout server          20ms
+
+  frontend fe1
+    # accept-proxy so test client can send src ip
+    bind "fd@${fe1}" accept-proxy
+
+    # ipmask tests w/src
+    http-request set-header Srciphdr %[src]
+    http-request set-header Srcmask1 %[src,ipmask(24)] # 192.168.1.0
+    http-request set-header Srcmask2 %[src,ipmask(16)] # 192.168.0.0
+    http-request set-header Srcmask3 %[src,ipmask(8)] # 192.0.0.0
+
+    # ipmask tests from headers
+    http-request set-header Test1mask128 %[req.hdr_ip(Addr1),ipmask(24,128)]
+
+    http-request set-header Test2mask64 %[req.hdr_ip(Addr2),ipmask(24,64)]
+    http-request set-header Test2mask128 %[req.hdr_ip(Addr2),ipmask(24,128)]
+    http-request set-header Test2mask120 %[req.hdr_ip(Addr2),ipmask(24,120)]
+    http-request set-header Test2maskff00 
%[req.hdr_ip(Addr2),ipmask(24,ffff:ffff:ffff:ffff:ffff:ffff:ffff:ff00)]
+    http-request set-header Test2maskfee0 
%[req.hdr_ip(Addr2),ipmask(24,ffff:ffff:ffff:ffff:ffff:ffff:ffff:fee0)]
+
+    http-request set-header Test3mask64 %[req.hdr_ip(Addr3),ipmask(24,64)]
+    http-request set-header Test3mask64v2 
%[req.hdr_ip(Addr3),ipmask(24,ffff:ffff:ffff:ffff:0:0:0:0)]
+    http-request set-header Test3mask64v3 
%[req.hdr_ip(Addr3),ipmask(24,ffff:ffff:ffff:ffff::)]
+    http-request set-header Test3maskff 
%[req.hdr_ip(Addr3),ipmask(24,ffff:ffff:ffff:ffff:0:ffff:ffff:0)]
+    http-request set-header Test3maskv2 
%[req.hdr_ip(Addr3),ipmask(24,ffff:ffff:ffff:ffff:c001:c001:0000:0000)]
+
+    # ipv4 mask applied to ipv4 mapped address
+    http-request set-header Test4mask32 %[req.hdr_ip(Addr4),ipmask(32,64)]
+
+    http-request set-header Test5mask24 %[req.hdr_ip(Addr5),ipmask(24)]
+
+    http-request set-header Test6mask24 %[req.hdr_ip(Addr6),ipmask(24)]
+    http-request set-header Test6mask25 %[req.hdr_ip(Addr6),ipmask(25)]
+
+    # track addr/mask in stick table
+    http-request track-sc0 src,ipmask(24) table be1
+    http-request track-sc1 hdr_ip(Addr4),ipmask(32) table be1
+    http-request track-sc2 hdr_ip(Addr3),ipmask(24,64) table be1
+
+    default_backend be1
+
+  backend be1
+    stick-table type ipv6 size 20 expire 360s store gpc0,conn_cnt
+    server s1 ${s1_addr}:${s1_port}
+} -start
+
+# concat,strcmp,word,field haproxy
+haproxy h2 -conf {
+  defaults
+    mode http
+    ${no-htx} option http-use-htx
+    log global
+    option httplog
+    timeout connect         15ms
+    timeout client          20ms
+    timeout server          20ms
+
+  frontend fe2
+    bind "fd@${fe2}"
+
+    # concat f1_f2 + _ + f3__f5 tests
+    http-request set-var(sess.field1) hdr(Field1)
+    http-request set-var(sess.field2) hdr(Field2)
+    http-request set-var(sess.fieldhdr) hdr(Fieldhdr)
+    http-request set-var(sess.fieldconcat) hdr(Field1),concat(_,sess.field2,)
+    http-request set-header Fieldconcat2 
%[var(sess.field1),concat(_,sess.field2,)]
+    http-request set-header Fieldconcat3 %[hdr(Field1),concat(_,sess.field2,)]
+    http-request set-header Fieldconcat %[var(sess.fieldconcat)]
+    http-request set-header Fieldstrcmp 
%[hdr(Fieldhdr),strcmp(sess.fieldconcat)]
+    http-request deny unless { hdr(Fieldhdr),strcmp(sess.fieldconcat) eq 0 }
+
+    # field tests
+    http-request set-header Fieldtest1 %[hdr(Fieldhdr),field(5,_)] #f5
+    http-request set-var(sess.fieldtest1var) hdr(Fieldtest1)
+    http-request set-var(sess.okfield) path,lower,field(4,/,1) #ok
+    http-request set-header Okfieldtest %[var(sess.okfield)] #ok
+    http-request set-var(sess.qsfield) url_param(qs),upper,field(2,_,2) #IT_IS
+    http-request set-header Qsfieldtest %[var(sess.qsfield)] #IT_IS
+    http-request set-header Qsfieldconcat 
%[var(sess.qsfield),concat(_,sess.okfield,)] #IT_IS_ok
+    http-request set-header Fieldtest2 %[var(sess.fieldhdr),field(2,_,0)] 
#f2_f3__f5
+    http-request set-header Fieldtest3 %[var(sess.fieldconcat),field(2,_,2)] 
#f2_f3
+    http-request set-header Fieldtest4 %[hdr(Fieldconcat2),field(-2,_,3)] 
#f2_f3_
+    http-request set-header Fieldtest5 %[hdr(Fieldconcat3),field(-3,_,0)] 
#f1_f2_f3
+    http-request set-header Fieldtest1strcmp 
%[str(f5),strcmp(sess.fieldtest1var)]
+    http-request deny unless { str(f5),strcmp(sess.fieldtest1var) eq 0 }
+    http-request deny unless { str(ok),strcmp(sess.okfield) eq 0 }
+    http-request deny unless { str(IT_IS),strcmp(sess.qsfield) eq 0 }
+
+    # word tests
+    http-request set-header Wordtest1 %[hdr(Fieldhdr),word(4,_)] #f5
+    http-request set-var(sess.wordtest1var) hdr(Wordtest1)
+    http-request set-var(sess.okword) path,upper,word(3,/,1) #OK
+    http-request set-header Okwordtest %[var(sess.okword)] #OK
+    http-request set-var(sess.qsword) url_param(qs),word(1,_,2) #Yes_It
+    http-request set-header Qswordtest %[var(sess.qsword)] #Yes_It
+    http-request set-header Qswordregmtest 
%[var(sess.qsword),map_regm(${testdir}/h00002.map)] #It_Yes
+    http-request set-header Wordtest2 %[var(sess.fieldhdr),word(2,_,0)] 
#f2_f3__f5
+    http-request set-header Wordtest3 %[var(sess.fieldconcat),word(3,_,2)] 
#f3__f5
+    http-request set-header Wordtest4 %[hdr(Fieldconcat2),word(-2,_,3)] 
#f1_f2_f3
+    http-request set-header Wordtest5 %[hdr(Fieldconcat3),word(-3,_,0)] #f1_f2
+    http-request set-header Wordtest1strcmp 
%[str(f5),strcmp(sess.wordtest1var)]
+    http-request deny unless { str(f5),strcmp(sess.wordtest1var) eq 0 }
+    http-request deny unless { str(OK),strcmp(sess.okword) eq 0 }
+    http-request deny unless { str(Yes_It),strcmp(sess.qsword) eq 0 }
+
+    default_backend be2
+
+    backend be2
+    server s2 ${s2_addr}:${s2_port}
+} -start
+
+# ipmask tests
+client c1 -connect ${h1_fe1_sock} -proxy2 "192.168.1.101:1234 127.0.0.1:2345" {
+    txreq -hdr "Addr1: 2001:db8::1" \
+        -hdr "Addr2: 2001:db8::bad:c0f:ffff" \
+        -hdr "Addr3: 2001:db8:c001:c01a:ffff:ffff:10:ffff" \
+        -hdr "Addr4: ::FFFF:192.168.1.101" \
+        -hdr "Addr5: 192.168.1.2" \
+        -hdr "Addr6: 192.168.1.255"
+    rxresp
+    expect resp.status == 200
+} -run
+
+# cli show be1 stick table
+haproxy h1 -cli {
+    send "show table be1"
+    expect ~ "^# table: be1, type: ipv6, size:20, used:3\\n0x[a-f0-9]+: 
key=::ffff:192\\.168\\.1\\.0 use=0 exp=[[:digit:]]+ gpc0=0 
conn_cnt=1\\n0x[a-f0-9]+: key=::ffff:192\\.168\\.1\\.101 use=0 exp=[[:digit:]]+ 
gpc0=0 conn_cnt=1\\n0x[a-f0-9]+: key=2001:db8:c001:c01a:: use=0 
exp=[[:digit:]]+ gpc0=0 conn_cnt=1\\n"
+}
+
+# concat,strcmp,word,field tests
+client c2 -connect ${h2_fe2_sock} {
+    txreq -req GET \
+        -url /is/this/Ok/or/not?qs=Yes_It_Is \
+        -hdr "Fieldhdr: f1_f2_f3__f5" \
+        -hdr "Field1: f1_f2" \
+        -hdr "Field2: f3__f5"
+    rxresp
+    expect resp.status == 200
+} -run
+
-- 
1.8.3.1

>From c12a398ddcd2f5a8beaf881e684db7301204795c Mon Sep 17 00:00:00 2001
From: Jarno Huuskonen <jarno.huusko...@uef.fi>
Date: Wed, 9 Jan 2019 15:40:27 +0200
Subject: [PATCH 3/4] REGTESTS: Basic tests for using maps to redirect requests
 / select backend

---
 reg-tests/http-rules/h00003-be.map |   4 +
 reg-tests/http-rules/h00003.map    |   3 +
 reg-tests/http-rules/h00003.vtc    | 174 +++++++++++++++++++++++++++++++++++++
 3 files changed, 181 insertions(+)
 create mode 100644 reg-tests/http-rules/h00003-be.map
 create mode 100644 reg-tests/http-rules/h00003.map
 create mode 100644 reg-tests/http-rules/h00003.vtc

diff --git a/reg-tests/http-rules/h00003-be.map 
b/reg-tests/http-rules/h00003-be.map
new file mode 100644
index 0000000..c8822fc
--- /dev/null
+++ b/reg-tests/http-rules/h00003-be.map
@@ -0,0 +1,4 @@
+# These entries are used for use_backend rules
+test1.example.com      test1_be
+test1.example.invalid  test1_be
+test2.example.com      test2_be
diff --git a/reg-tests/http-rules/h00003.map b/reg-tests/http-rules/h00003.map
new file mode 100644
index 0000000..a0cc02d
--- /dev/null
+++ b/reg-tests/http-rules/h00003.map
@@ -0,0 +1,3 @@
+# These entries are used for http-request redirect rules
+example.org https://www.example.org
+subdomain.example.org https://www.subdomain.example.org
diff --git a/reg-tests/http-rules/h00003.vtc b/reg-tests/http-rules/h00003.vtc
new file mode 100644
index 0000000..55bb268
--- /dev/null
+++ b/reg-tests/http-rules/h00003.vtc
@@ -0,0 +1,174 @@
+varnishtest "haproxy host header: map / redirect tests"
+feature ignore_unknown_macro
+
+#REQUIRE_VERSION=1.6
+
+server s1 {
+   rxreq
+   expect req.method == "GET"
+   expect req.http.host == "test1.example.com"
+   txresp -body "test1 ok"
+} -start
+
+server s2 {
+   rxreq
+   expect req.method == "GET"
+   expect req.http.host == "test2.example.com"
+   txresp -body "test2 ok"
+} -start
+
+server s3 {
+   rxreq
+   expect req.method == "GET"
+   expect req.http.host == "test3.example.com"
+   txresp -body "test3 ok"
+} -start
+
+server s4 {
+   rxreq
+   expect req.method == "GET"
+   expect req.http.host == "test1.example.invalid"
+   txresp -body "test1 after del map ok"
+} -start
+
+haproxy h1 -conf {
+  defaults
+    mode http
+    ${no-htx} option http-use-htx
+    log global
+    option httplog
+    timeout connect         15ms
+    timeout client          20ms
+    timeout server          20ms
+
+  frontend fe1
+    bind "fd@${fe1}"
+
+    # redirect Host: example.org / subdomain.example.org
+    http-request redirect prefix 
%[req.hdr(Host),lower,regsub(:\d+$,,),map_str(${testdir}/h00003.map)] code 301 
if { hdr(Host),lower,regsub(:\d+$,,),map_str(${testdir}/h00003.map) -m found }
+
+    # set var and redirect in be1
+    http-request set-var(txn.testvar) 
req.hdr(Testvar),lower,regsub(:\d+$,,),map_str(${testdir}/h00003.map) if { 
hdr(Testvar),lower,regsub(:\d+$,,),map_str(${testdir}/h00003.map) -m found }
+
+    # use map to select backend (no default map value)
+    use_backend %[req.hdr(Host),lower,map_dom(${testdir}/h00003-be.map)] if { 
hdr_dom(Host) -i test1.example.com || hdr_dom(Host) -i test2.example.com }
+
+    # use map to select backend with default value(test3_be)
+    use_backend 
%[req.hdr(Host),lower,map_dom(${testdir}/h00003-be.map,test3_be)] if { 
hdr_dom(Host) -m end -i example.com }
+
+    # use map(after del map test1.example.com) default value(test4_be)
+    use_backend 
%[req.hdr(Host),lower,map_dom(${testdir}/h00003-be.map,test4_be)] if { 
hdr_dom(Host) -m end -i example.invalid }
+
+    default_backend be1
+
+    backend be1
+    http-request redirect prefix %[var(txn.testvar)] code 301 if { 
var(txn.testvar) -m found }
+    http-request deny
+
+    backend test1_be
+    server s1 ${s1_addr}:${s1_port}
+
+    backend test2_be
+    server s2 ${s2_addr}:${s2_port}
+
+    backend test3_be
+    server s3 ${s3_addr}:${s3_port}
+
+    backend test4_be
+    server s4 ${s4_addr}:${s4_port}
+} -start
+
+# Check map redirects
+client c1 -connect ${h1_fe1_sock} {
+    txreq -hdr "Host: example.org:8443"
+    rxresp
+    expect resp.status == 301
+    expect resp.http.location ~ "https://www.example.org";
+
+    txreq -hdr "Host: subdomain.example.org"
+    rxresp
+    expect resp.status == 301
+    expect resp.http.location ~ "https://www.subdomain.example.org";
+
+    # redirect on Testvar header
+    txreq -hdr "Testvar: subdomain.example.org"
+    rxresp
+    expect resp.status == 301
+    expect resp.http.location ~ "https://www.subdomain.example.org";
+} -run
+
+client c2 -connect ${h1_fe1_sock} {
+    txreq -hdr "Host: www.subdomain.example.org"
+    rxresp
+    expect resp.status == 403
+    # Closes connection
+} -run
+
+client c3 -connect ${h1_fe1_sock} {
+    txreq -hdr "Testvar: www.subdomain.example.org"
+    rxresp
+    expect resp.status == 403
+    # Closes connection
+} -run
+
+client c4 -connect ${h1_fe1_sock} {
+    txreq -hdr "Host: :8443example.org"
+    rxresp
+    expect resp.status == 403
+    # Closes connection
+} -run
+
+# Check map backend selection
+client c5 -connect ${h1_fe1_sock} {
+    txreq -hdr "Host: test1.example.com"
+    rxresp
+    expect resp.status == 200
+    expect resp.body == "test1 ok"
+
+    txreq -hdr "Host: test2.example.com"
+    rxresp
+    expect resp.status == 200
+    expect resp.body == "test2 ok"
+
+    txreq -hdr "Host: test3.example.com"
+    rxresp
+    expect resp.status == 200
+    expect resp.body == "test3 ok"
+} -run
+
+# cli show maps
+haproxy h1 -cli {
+    send "show map ${testdir}/h00003.map"
+    expect ~ "^0x[a-f0-9]+ example\\.org 
https://www\\.example\\.org\\n0x[a-f0-9]+ subdomain\\.example\\.org 
https://www\\.subdomain\\.example\\.org\\n$";
+
+    send "show map ${testdir}/h00003-be.map"
+    expect ~ "^0x[a-f0-9]+ test1\\.example\\.com test1_be\\n0x[a-f0-9]+ 
test1\\.example\\.invalid test1_be\\n0x[a-f0-9]+ test2\\.example\\.com 
test2_be\\n$"
+}
+
+haproxy h1 -cli {
+    # clear map ${testdir}/h00003.map
+    send "clear map ${testdir}/h00003.map"
+    expect ~ "^\\n"
+
+    send "show map ${testdir}/h00003.map"
+    expect ~ "^\\n"
+
+    # del map ${testdir}/h00003-be.map test1.example.{com,invalid}
+    send "del map ${testdir}/h00003-be.map test1.example.com"
+    expect ~ "^\\n"
+
+    send "del map ${testdir}/h00003-be.map test1.example.invalid"
+    expect ~ "^\\n"
+
+    send "show map ${testdir}/h00003-be.map"
+    expect ~ "^0x[a-f0-9]+ test2\\.example\\.com test2_be\\n$"
+}
+
+# Check map backend after del map
+client c6 -connect ${h1_fe1_sock} {
+    # test1.example.invalid should go to test4_be after del map
+    txreq -hdr "Host: test1.example.invalid"
+    rxresp
+    expect resp.status == 200
+    expect resp.body == "test1 after del map ok"
+} -run
-- 
1.8.3.1

>From c640c6859c6f10f5b9b9b83fabe029e263295b2f Mon Sep 17 00:00:00 2001
From: Jarno Huuskonen <jarno.huusko...@uef.fi>
Date: Wed, 9 Jan 2019 15:42:25 +0200
Subject: [PATCH 4/4] DOC: REGTESTS README varnishtest -Dno-htx= define.

Add -Dno-htx= to varnishtest command line, because without no-htx most
vtc tests fail (${no-htx} macro). Also link to doc/regression-testing.txt
---
 reg-tests/README | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/reg-tests/README b/reg-tests/README
index 5427ad6..05d7e54 100644
--- a/reg-tests/README
+++ b/reg-tests/README
@@ -8,7 +8,7 @@ Varnish cache application. varnishtest is a very useful program 
which has been
 developed to test Varnish cache application. varnishtest has been modified in
 collaboration with Varnish cache conceptor Poul-Henning Kamp to support 
HAProxy in
 addition to Varnish cache.
-
+See also: doc/regression-testing.txt
 
 * varnishtest compilation *
 
@@ -35,7 +35,7 @@ addition to Varnish cache.
   You must set HAPROXY_PROGRAM environment variable to give the location
   of the HAProxy program to test to varnishtest:
 
-    $ HAPROXY_PROGRAM=<my haproxy program> varnishtest ...
+    $ HAPROXY_PROGRAM=<my haproxy program> varnishtest [-Dno-htx=] ...
 
   The HAProxy VTC files found in HAProxy sources may be run with the reg-tests
   Makefile target. You must set the VARNISHTEST_PROGRAM environment variable to
-- 
1.8.3.1

Reply via email to