"Fossies" - the Fresh Open Source Software Archive

Member "haproxy-2.0.9/reg-tests/http-cookies/cookie_insert_indirect.vtc" (15 Nov 2019, 1488 Bytes) of package /linux/misc/haproxy-2.0.9.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 varnishtest "HTTP cookie basic test"
    2 feature ignore_unknown_macro
    3 
    4 # This script tests "cookie <name> insert indirect" directive.
    5 # The client sends a wrong "SRVID=s2" cookie.
    6 # haproxy removes it.
    7 # The server replies with "SRVID=S1" after having checked that
    8 # no cookies were sent by haproxy.
    9 # haproxy replies "SRVID=server-one" to the client.
   10 # We log the HTTP request to a syslog server and check their "--II"
   11 # (invalid, insert) flags.
   12 
   13 syslog S1 -level notice {
   14     recv
   15     expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Proxy (fe|be)1 started."
   16     recv
   17     expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Proxy (fe|be)1 started."
   18     recv info
   19     expect ~ "[^:\\[ ]\\[${h1_pid}\\]: .* fe1 be1/srv1 .* --II .* \"GET / HTTP/1\\.1\""
   20 } -start
   21 
   22 server s1 {
   23 	rxreq
   24 	expect req.http.cookie == <undef>
   25     txresp -hdr "Cookie: SRVID=S1"
   26 } -start
   27 
   28 haproxy h1 -conf {
   29 	global
   30         log ${S1_addr}:${S1_port} len 2048 local0 debug err
   31 
   32     defaults
   33         mode http
   34         ${no-htx} option http-use-htx
   35 		option httplog
   36         timeout client 1s
   37         timeout server 1s
   38         timeout connect 1s
   39         log global
   40 
   41     backend be1
   42         cookie SRVID insert indirect
   43         server srv1 ${s1_addr}:${s1_port} cookie server-one
   44 
   45     frontend fe1
   46 		option httplog
   47         bind "fd@${fe1}"
   48         use_backend be1
   49 } -start
   50 
   51 client c1 -connect ${h1_fe1_sock} {
   52     txreq -hdr "Cookie: SRVID=s2"
   53     rxresp
   54     expect resp.http.Set-Cookie ~ "^SRVID=server-one;.*"
   55 } -start
   56 
   57 
   58 client c1 -wait
   59 syslog S1 -wait