summaryrefslogtreecommitdiffstats
path: root/reg-tests/http-messaging/h1_request_target_validation.vtc
blob: 63e194ae3e15a9ff9f7ed950827fedc3702545af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
varnishtest "HTTP request tests: H1 request target parsing"

feature ignore_unknown_macro

#REQUIRE_VERSION=3.0

haproxy h1 -conf {
    global
        # WT: limit false-positives causing "HTTP header incomplete" due to
        # idle server connections being randomly used and randomly expiring
        # under us.
        tune.idle-pool.shared off

    defaults
        mode http
        timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
        timeout client  "${HAPROXY_TEST_TIMEOUT-5s}"
        timeout server  "${HAPROXY_TEST_TIMEOUT-5s}"

    listen li1
        bind "fd@${li1}"
        http-request return status 200
} -start

client c1 -connect ${h1_li1_sock} {
    txreq -req "OPTIONS" -url "*"
    rxresp
    expect resp.status == 200

} -run

client c2 -connect ${h1_li1_sock} {
    txreq -req "OPTIONS" -url "/"
    rxresp
    expect resp.status == 200

} -run

client c3 -connect ${h1_li1_sock} {
    txreq -req "OPTIONS" -url "http://haproxy.org" \
          -hdr "Host: haproxy.org"
    rxresp
    expect resp.status == 200

} -run

client c4 -connect ${h1_li1_sock} {
    txreq -req "OPTIONS" -url "*/test"
    rxresp
    expect resp.status == 400
} -run

client c5 -connect ${h1_li1_sock} {
    txreq -req "GET" -url "*"
    rxresp
    expect resp.status == 400
} -run

client c6 -connect ${h1_li1_sock} {
    txreq -req "CONNECT" -url "haproxy.org:80" \
          -hdr "Host: haproxy.org"
    rxresp
    expect resp.status == 200

} -run

client c7 -connect ${h1_li1_sock} {
    txreq -req "CONNECT" -url "haproxy.org" \
          -hdr "Host: haproxy.org"
    rxresp
    expect resp.status == 400
} -run

client c8 -connect ${h1_li1_sock} {
    txreq -req "CONNECT" -url "/"
    rxresp
    expect resp.status == 400
} -run

client c9 -connect ${h1_li1_sock} {
    txreq -req "CONNECT" -url "http://haproxy.org:80" \
          -hdr "Host: haproxy.org"
    rxresp
    expect resp.status == 400
} -run

client c11 -connect ${h1_li1_sock} {
    txreq -req "GET" -url "/" \
          -hdr "Host: haproxy.org"
    rxresp
    expect resp.status == 200
} -run

client c12 -connect ${h1_li1_sock} {
    txreq -req "GET" -url "haproxy.org:80" \
          -hdr "Host: haproxy.org"
    rxresp
    expect resp.status == 400
} -run

client c13 -connect ${h1_li1_sock} {
    txreq -req "GET" -url "admin"
    rxresp
    expect resp.status == 400
} -run

client c14 -connect ${h1_li1_sock} {
    txreq -req "GET" -url "admin/a/b"
    rxresp
    expect resp.status == 400
} -run