Tim Duesterhus | d371e99 | 2021-04-15 21:45:58 +0200 | [diff] [blame] | 1 | varnishtest "normalize-uri tests" |
| 2 | #REQUIRE_VERSION=2.4 |
| 3 | |
| 4 | # This reg-test tests the http-request normalize-uri action. |
| 5 | |
| 6 | feature ignore_unknown_macro |
| 7 | |
| 8 | server s1 { |
| 9 | rxreq |
Christopher Faulet | 23d9efa | 2022-02-28 17:04:37 +0100 | [diff] [blame] | 10 | txresp -hdr "connection: close" |
Tim Duesterhus | dec1c36 | 2021-05-10 17:28:26 +0200 | [diff] [blame] | 11 | } -repeat 70 -start |
Tim Duesterhus | d371e99 | 2021-04-15 21:45:58 +0200 | [diff] [blame] | 12 | |
| 13 | haproxy h1 -conf { |
Amaury Denoyelle | a9e639a | 2021-05-06 15:50:12 +0200 | [diff] [blame] | 14 | global |
Willy Tarreau | e1465c1 | 2021-05-09 14:41:41 +0200 | [diff] [blame] | 15 | # WT: limit false-positives causing "HTTP header incomplete" due to |
| 16 | # idle server connections being randomly used and randomly expiring |
| 17 | # under us. |
| 18 | tune.idle-pool.shared off |
Amaury Denoyelle | a9e639a | 2021-05-06 15:50:12 +0200 | [diff] [blame] | 19 | expose-experimental-directives |
| 20 | |
Tim Duesterhus | d371e99 | 2021-04-15 21:45:58 +0200 | [diff] [blame] | 21 | defaults |
| 22 | mode http |
| 23 | timeout connect 1s |
| 24 | timeout client 1s |
| 25 | timeout server 1s |
| 26 | |
Tim Duesterhus | 5be6ab2 | 2021-04-17 11:21:10 +0200 | [diff] [blame] | 27 | frontend fe_path_merge_slashes |
| 28 | bind "fd@${fe_path_merge_slashes}" |
Tim Duesterhus | d371e99 | 2021-04-15 21:45:58 +0200 | [diff] [blame] | 29 | |
| 30 | http-request set-var(txn.before) url |
Tim Duesterhus | 5be6ab2 | 2021-04-17 11:21:10 +0200 | [diff] [blame] | 31 | http-request normalize-uri path-merge-slashes |
Tim Duesterhus | d371e99 | 2021-04-15 21:45:58 +0200 | [diff] [blame] | 32 | http-request set-var(txn.after) url |
| 33 | |
| 34 | http-response add-header before %[var(txn.before)] |
| 35 | http-response add-header after %[var(txn.after)] |
| 36 | |
| 37 | default_backend be |
| 38 | |
Tim Duesterhus | 5be6ab2 | 2021-04-17 11:21:10 +0200 | [diff] [blame] | 39 | frontend fe_path_strip_dotdot |
| 40 | bind "fd@${fe_path_strip_dotdot}" |
Tim Duesterhus | 9982fc2 | 2021-04-15 21:45:59 +0200 | [diff] [blame] | 41 | |
| 42 | http-request set-var(txn.before) url |
Tim Duesterhus | 5be6ab2 | 2021-04-17 11:21:10 +0200 | [diff] [blame] | 43 | http-request normalize-uri path-strip-dotdot |
Tim Duesterhus | 9982fc2 | 2021-04-15 21:45:59 +0200 | [diff] [blame] | 44 | http-request set-var(txn.after) url |
| 45 | |
Tim Duesterhus | 560e1a6 | 2021-04-15 21:46:00 +0200 | [diff] [blame] | 46 | http-request set-uri %[var(txn.before)] |
Tim Duesterhus | 5be6ab2 | 2021-04-17 11:21:10 +0200 | [diff] [blame] | 47 | http-request normalize-uri path-strip-dotdot full |
Tim Duesterhus | 560e1a6 | 2021-04-15 21:46:00 +0200 | [diff] [blame] | 48 | http-request set-var(txn.after_full) url |
| 49 | |
Tim Duesterhus | 9982fc2 | 2021-04-15 21:45:59 +0200 | [diff] [blame] | 50 | http-response add-header before %[var(txn.before)] |
| 51 | http-response add-header after %[var(txn.after)] |
Tim Duesterhus | 560e1a6 | 2021-04-15 21:46:00 +0200 | [diff] [blame] | 52 | http-response add-header after-full %[var(txn.after_full)] |
Tim Duesterhus | 9982fc2 | 2021-04-15 21:45:59 +0200 | [diff] [blame] | 53 | |
| 54 | default_backend be |
| 55 | |
Tim Duesterhus | 5be6ab2 | 2021-04-17 11:21:10 +0200 | [diff] [blame] | 56 | frontend fe_sort_query_by_name |
| 57 | bind "fd@${fe_sort_query_by_name}" |
Tim Duesterhus | d7b89be | 2021-04-15 21:46:01 +0200 | [diff] [blame] | 58 | |
| 59 | http-request set-var(txn.before) url |
Tim Duesterhus | 5be6ab2 | 2021-04-17 11:21:10 +0200 | [diff] [blame] | 60 | http-request normalize-uri query-sort-by-name |
Tim Duesterhus | d7b89be | 2021-04-15 21:46:01 +0200 | [diff] [blame] | 61 | http-request set-var(txn.after) url |
| 62 | |
| 63 | http-response add-header before %[var(txn.before)] |
| 64 | http-response add-header after %[var(txn.after)] |
| 65 | |
| 66 | default_backend be |
| 67 | |
Tim Duesterhus | 5be6ab2 | 2021-04-17 11:21:10 +0200 | [diff] [blame] | 68 | frontend fe_percent_to_uppercase |
| 69 | bind "fd@${fe_percent_to_uppercase}" |
Tim Duesterhus | a407193 | 2021-04-15 21:46:02 +0200 | [diff] [blame] | 70 | |
| 71 | http-request set-var(txn.before) url |
Tim Duesterhus | 5be6ab2 | 2021-04-17 11:21:10 +0200 | [diff] [blame] | 72 | http-request normalize-uri percent-to-uppercase |
Tim Duesterhus | a407193 | 2021-04-15 21:46:02 +0200 | [diff] [blame] | 73 | http-request set-var(txn.after) url |
| 74 | |
| 75 | http-response add-header before %[var(txn.before)] |
| 76 | http-response add-header after %[var(txn.after)] |
| 77 | |
| 78 | default_backend be |
| 79 | |
Tim Duesterhus | 5be6ab2 | 2021-04-17 11:21:10 +0200 | [diff] [blame] | 80 | frontend fe_percent_to_uppercase_strict |
| 81 | bind "fd@${fe_percent_to_uppercase_strict}" |
Tim Duesterhus | a407193 | 2021-04-15 21:46:02 +0200 | [diff] [blame] | 82 | |
| 83 | http-request set-var(txn.before) url |
Tim Duesterhus | 5be6ab2 | 2021-04-17 11:21:10 +0200 | [diff] [blame] | 84 | http-request normalize-uri percent-to-uppercase strict |
Tim Duesterhus | a407193 | 2021-04-15 21:46:02 +0200 | [diff] [blame] | 85 | http-request set-var(txn.after) url |
| 86 | |
| 87 | http-response add-header before %[var(txn.before)] |
| 88 | http-response add-header after %[var(txn.after)] |
| 89 | |
| 90 | default_backend be |
| 91 | |
Maximilian Mader | ff3bb8b | 2021-04-21 00:22:50 +0200 | [diff] [blame] | 92 | frontend fe_dot |
| 93 | bind "fd@${fe_dot}" |
| 94 | |
| 95 | http-request set-var(txn.before) url |
| 96 | http-request normalize-uri path-strip-dot |
| 97 | http-request set-var(txn.after) url |
| 98 | |
| 99 | http-response add-header before %[var(txn.before)] |
| 100 | http-response add-header after %[var(txn.after)] |
| 101 | |
| 102 | default_backend be |
| 103 | |
Tim Duesterhus | 2e4a18e | 2021-04-21 21:20:36 +0200 | [diff] [blame] | 104 | frontend fe_percent_decode_unreserved |
| 105 | bind "fd@${fe_percent_decode_unreserved}" |
| 106 | |
| 107 | http-request set-var(txn.before) url |
| 108 | http-request normalize-uri percent-decode-unreserved |
| 109 | http-request set-var(txn.after) url |
| 110 | |
| 111 | http-response add-header before %[var(txn.before)] |
| 112 | http-response add-header after %[var(txn.after)] |
| 113 | |
| 114 | default_backend be |
| 115 | |
| 116 | frontend fe_percent_decode_unreserved_strict |
| 117 | bind "fd@${fe_percent_decode_unreserved_strict}" |
| 118 | |
| 119 | http-request set-var(txn.before) url |
| 120 | http-request normalize-uri percent-decode-unreserved strict |
| 121 | http-request set-var(txn.after) url |
| 122 | |
| 123 | http-response add-header before %[var(txn.before)] |
| 124 | http-response add-header after %[var(txn.after)] |
| 125 | |
| 126 | default_backend be |
| 127 | |
Tim Duesterhus | c9e05ab | 2021-05-10 17:28:25 +0200 | [diff] [blame] | 128 | frontend fe_fragment_strip |
| 129 | bind "fd@${fe_fragment_strip}" |
| 130 | |
| 131 | http-request set-var(txn.before) url |
| 132 | http-request normalize-uri fragment-strip |
| 133 | http-request set-var(txn.after) url |
| 134 | |
| 135 | http-response add-header before %[var(txn.before)] |
| 136 | http-response add-header after %[var(txn.after)] |
| 137 | |
| 138 | default_backend be |
| 139 | |
Tim Duesterhus | dec1c36 | 2021-05-10 17:28:26 +0200 | [diff] [blame] | 140 | frontend fe_fragment_encode |
| 141 | bind "fd@${fe_fragment_encode}" |
| 142 | |
| 143 | http-request set-var(txn.before) url |
| 144 | http-request normalize-uri fragment-encode |
| 145 | http-request set-var(txn.after) url |
| 146 | |
| 147 | http-response add-header before %[var(txn.before)] |
| 148 | http-response add-header after %[var(txn.after)] |
| 149 | |
| 150 | default_backend be |
| 151 | |
Tim Duesterhus | d371e99 | 2021-04-15 21:45:58 +0200 | [diff] [blame] | 152 | backend be |
| 153 | server s1 ${s1_addr}:${s1_port} |
| 154 | |
| 155 | } -start |
| 156 | |
Tim Duesterhus | 5be6ab2 | 2021-04-17 11:21:10 +0200 | [diff] [blame] | 157 | client c1 -connect ${h1_fe_path_merge_slashes_sock} { |
Tim Duesterhus | d371e99 | 2021-04-15 21:45:58 +0200 | [diff] [blame] | 158 | txreq -url "/foo/bar" |
| 159 | rxresp |
| 160 | expect resp.http.before == "/foo/bar" |
| 161 | expect resp.http.after == "/foo/bar" |
| 162 | |
| 163 | txreq -url "/foo//bar" |
| 164 | rxresp |
| 165 | expect resp.http.before == "/foo//bar" |
| 166 | expect resp.http.after == "/foo/bar" |
| 167 | |
| 168 | txreq -url "/foo///bar" |
| 169 | rxresp |
| 170 | expect resp.http.before == "/foo///bar" |
| 171 | expect resp.http.after == "/foo/bar" |
| 172 | |
| 173 | txreq -url "///foo///bar" |
| 174 | rxresp |
| 175 | expect resp.http.before == "///foo///bar" |
| 176 | expect resp.http.after == "/foo/bar" |
| 177 | |
| 178 | txreq -url "///foo/bar" |
| 179 | rxresp |
| 180 | expect resp.http.before == "///foo/bar" |
| 181 | expect resp.http.after == "/foo/bar" |
| 182 | |
| 183 | txreq -url "///foo///bar///" |
| 184 | rxresp |
| 185 | expect resp.http.before == "///foo///bar///" |
| 186 | expect resp.http.after == "/foo/bar/" |
| 187 | |
| 188 | txreq -url "///" |
| 189 | rxresp |
| 190 | expect resp.http.before == "///" |
| 191 | expect resp.http.after == "/" |
| 192 | |
| 193 | txreq -url "/foo?bar=///" |
| 194 | rxresp |
| 195 | expect resp.http.before == "/foo?bar=///" |
| 196 | expect resp.http.after == "/foo?bar=///" |
| 197 | |
| 198 | txreq -url "//foo?bar=///" |
| 199 | rxresp |
| 200 | expect resp.http.before == "//foo?bar=///" |
| 201 | expect resp.http.after == "/foo?bar=///" |
| 202 | |
| 203 | txreq -req OPTIONS -url "*" |
| 204 | rxresp |
| 205 | expect resp.http.before == "*" |
| 206 | expect resp.http.after == "*" |
| 207 | } -run |
Tim Duesterhus | 9982fc2 | 2021-04-15 21:45:59 +0200 | [diff] [blame] | 208 | |
Tim Duesterhus | 5be6ab2 | 2021-04-17 11:21:10 +0200 | [diff] [blame] | 209 | client c2 -connect ${h1_fe_path_strip_dotdot_sock} { |
Tim Duesterhus | 9982fc2 | 2021-04-15 21:45:59 +0200 | [diff] [blame] | 210 | txreq -url "/foo/bar" |
| 211 | rxresp |
| 212 | expect resp.http.before == "/foo/bar" |
| 213 | expect resp.http.after == "/foo/bar" |
Tim Duesterhus | 560e1a6 | 2021-04-15 21:46:00 +0200 | [diff] [blame] | 214 | expect resp.http.after-full == "/foo/bar" |
Tim Duesterhus | 9982fc2 | 2021-04-15 21:45:59 +0200 | [diff] [blame] | 215 | |
| 216 | txreq -url "/foo/.." |
| 217 | rxresp |
| 218 | expect resp.http.before == "/foo/.." |
| 219 | expect resp.http.after == "/" |
Tim Duesterhus | 560e1a6 | 2021-04-15 21:46:00 +0200 | [diff] [blame] | 220 | expect resp.http.after-full == "/" |
Tim Duesterhus | 9982fc2 | 2021-04-15 21:45:59 +0200 | [diff] [blame] | 221 | |
| 222 | txreq -url "/foo/../" |
| 223 | rxresp |
| 224 | expect resp.http.before == "/foo/../" |
| 225 | expect resp.http.after == "/" |
Tim Duesterhus | 560e1a6 | 2021-04-15 21:46:00 +0200 | [diff] [blame] | 226 | expect resp.http.after-full == "/" |
Tim Duesterhus | 9982fc2 | 2021-04-15 21:45:59 +0200 | [diff] [blame] | 227 | |
| 228 | txreq -url "/foo/bar/../" |
| 229 | rxresp |
| 230 | expect resp.http.before == "/foo/bar/../" |
| 231 | expect resp.http.after == "/foo/" |
Tim Duesterhus | 560e1a6 | 2021-04-15 21:46:00 +0200 | [diff] [blame] | 232 | expect resp.http.after-full == "/foo/" |
Tim Duesterhus | 9982fc2 | 2021-04-15 21:45:59 +0200 | [diff] [blame] | 233 | |
| 234 | txreq -url "/foo/../bar" |
| 235 | rxresp |
| 236 | expect resp.http.before == "/foo/../bar" |
| 237 | expect resp.http.after == "/bar" |
Tim Duesterhus | 560e1a6 | 2021-04-15 21:46:00 +0200 | [diff] [blame] | 238 | expect resp.http.after-full == "/bar" |
Tim Duesterhus | 9982fc2 | 2021-04-15 21:45:59 +0200 | [diff] [blame] | 239 | |
| 240 | txreq -url "/foo/../bar/" |
| 241 | rxresp |
| 242 | expect resp.http.before == "/foo/../bar/" |
| 243 | expect resp.http.after == "/bar/" |
Tim Duesterhus | 560e1a6 | 2021-04-15 21:46:00 +0200 | [diff] [blame] | 244 | expect resp.http.after-full == "/bar/" |
Tim Duesterhus | 9982fc2 | 2021-04-15 21:45:59 +0200 | [diff] [blame] | 245 | |
| 246 | txreq -url "/foo/../../bar/" |
| 247 | rxresp |
| 248 | expect resp.http.before == "/foo/../../bar/" |
| 249 | expect resp.http.after == "/../bar/" |
Tim Duesterhus | 560e1a6 | 2021-04-15 21:46:00 +0200 | [diff] [blame] | 250 | expect resp.http.after-full == "/bar/" |
Tim Duesterhus | 9982fc2 | 2021-04-15 21:45:59 +0200 | [diff] [blame] | 251 | |
| 252 | txreq -url "/foo//../../bar/" |
| 253 | rxresp |
| 254 | expect resp.http.before == "/foo//../../bar/" |
| 255 | expect resp.http.after == "/bar/" |
Tim Duesterhus | 560e1a6 | 2021-04-15 21:46:00 +0200 | [diff] [blame] | 256 | expect resp.http.after-full == "/bar/" |
Tim Duesterhus | 9982fc2 | 2021-04-15 21:45:59 +0200 | [diff] [blame] | 257 | |
| 258 | txreq -url "/foo/?bar=/foo/../" |
| 259 | rxresp |
| 260 | expect resp.http.before == "/foo/?bar=/foo/../" |
| 261 | expect resp.http.after == "/foo/?bar=/foo/../" |
Tim Duesterhus | 560e1a6 | 2021-04-15 21:46:00 +0200 | [diff] [blame] | 262 | expect resp.http.after-full == "/foo/?bar=/foo/../" |
Tim Duesterhus | 9982fc2 | 2021-04-15 21:45:59 +0200 | [diff] [blame] | 263 | |
| 264 | txreq -url "/foo/../?bar=/foo/../" |
| 265 | rxresp |
| 266 | expect resp.http.before == "/foo/../?bar=/foo/../" |
| 267 | expect resp.http.after == "/?bar=/foo/../" |
Tim Duesterhus | 560e1a6 | 2021-04-15 21:46:00 +0200 | [diff] [blame] | 268 | expect resp.http.after-full == "/?bar=/foo/../" |
Tim Duesterhus | 9982fc2 | 2021-04-15 21:45:59 +0200 | [diff] [blame] | 269 | |
| 270 | txreq -req OPTIONS -url "*" |
| 271 | rxresp |
| 272 | expect resp.http.before == "*" |
| 273 | expect resp.http.after == "*" |
Tim Duesterhus | 560e1a6 | 2021-04-15 21:46:00 +0200 | [diff] [blame] | 274 | expect resp.http.after-full == "*" |
Tim Duesterhus | 9982fc2 | 2021-04-15 21:45:59 +0200 | [diff] [blame] | 275 | } -run |
Tim Duesterhus | d7b89be | 2021-04-15 21:46:01 +0200 | [diff] [blame] | 276 | |
Tim Duesterhus | 5be6ab2 | 2021-04-17 11:21:10 +0200 | [diff] [blame] | 277 | client c3 -connect ${h1_fe_sort_query_by_name_sock} { |
Tim Duesterhus | d7b89be | 2021-04-15 21:46:01 +0200 | [diff] [blame] | 278 | txreq -url "/?a=a" |
| 279 | rxresp |
| 280 | expect resp.http.before == "/?a=a" |
| 281 | expect resp.http.after == "/?a=a" |
| 282 | |
| 283 | txreq -url "/?a=a&z=z" |
| 284 | rxresp |
| 285 | expect resp.http.before == "/?a=a&z=z" |
| 286 | expect resp.http.after == "/?a=a&z=z" |
| 287 | |
| 288 | txreq -url "/?z=z&a=a" |
| 289 | rxresp |
| 290 | expect resp.http.before == "/?z=z&a=a" |
| 291 | expect resp.http.after == "/?a=a&z=z" |
| 292 | |
| 293 | txreq -url "/?a=z&z=a" |
| 294 | rxresp |
| 295 | expect resp.http.before == "/?a=z&z=a" |
| 296 | expect resp.http.after == "/?a=z&z=a" |
| 297 | |
| 298 | txreq -url "/?z=a&a=z" |
| 299 | rxresp |
| 300 | expect resp.http.before == "/?z=a&a=z" |
| 301 | expect resp.http.after == "/?a=z&z=a" |
| 302 | |
| 303 | txreq -url "/?c&b&a&z&x&y" |
| 304 | rxresp |
| 305 | expect resp.http.before == "/?c&b&a&z&x&y" |
| 306 | expect resp.http.after == "/?a&b&c&x&y&z" |
| 307 | |
| 308 | txreq -url "/?a=&aa=&aaa=&aaaa=" |
| 309 | rxresp |
| 310 | expect resp.http.before == "/?a=&aa=&aaa=&aaaa=" |
| 311 | expect resp.http.after == "/?a=&aa=&aaa=&aaaa=" |
| 312 | |
| 313 | txreq -url "/?aaaa=&a=&aa=&aaa=" |
| 314 | rxresp |
| 315 | expect resp.http.before == "/?aaaa=&a=&aa=&aaa=" |
| 316 | expect resp.http.after == "/?a=&aa=&aaa=&aaaa=" |
| 317 | |
| 318 | txreq -url "/?a=5&a=3&a=1&a=2&a=4" |
| 319 | rxresp |
| 320 | expect resp.http.before == "/?a=5&a=3&a=1&a=2&a=4" |
| 321 | expect resp.http.after == "/?a=5&a=3&a=1&a=2&a=4" |
| 322 | |
| 323 | txreq -url "/?a=5&b=3&a=1&a=2&b=4" |
| 324 | rxresp |
| 325 | expect resp.http.before == "/?a=5&b=3&a=1&a=2&b=4" |
| 326 | expect resp.http.after == "/?a=5&a=1&a=2&b=3&b=4" |
| 327 | |
| 328 | txreq -url "/" |
| 329 | rxresp |
| 330 | expect resp.http.before == "/" |
| 331 | expect resp.http.after == "/" |
| 332 | |
| 333 | txreq -url "/?" |
| 334 | rxresp |
| 335 | expect resp.http.before == "/?" |
| 336 | expect resp.http.after == "/?" |
| 337 | |
| 338 | txreq -req OPTIONS -url "*" |
| 339 | rxresp |
| 340 | expect resp.http.before == "*" |
| 341 | expect resp.http.after == "*" |
| 342 | } -run |
Tim Duesterhus | a407193 | 2021-04-15 21:46:02 +0200 | [diff] [blame] | 343 | |
Tim Duesterhus | 5be6ab2 | 2021-04-17 11:21:10 +0200 | [diff] [blame] | 344 | client c4 -connect ${h1_fe_percent_to_uppercase_sock} { |
Tim Duesterhus | a407193 | 2021-04-15 21:46:02 +0200 | [diff] [blame] | 345 | txreq -url "/a?a=a" |
| 346 | rxresp |
| 347 | expect resp.http.before == "/a?a=a" |
| 348 | expect resp.http.after == "/a?a=a" |
| 349 | |
| 350 | txreq -url "/%aa?a=%aa" |
| 351 | rxresp |
| 352 | expect resp.http.before == "/%aa?a=%aa" |
| 353 | expect resp.http.after == "/%AA?a=%AA" |
| 354 | |
| 355 | txreq -url "/%zz?a=%zz" |
| 356 | rxresp |
| 357 | expect resp.status == 200 |
| 358 | expect resp.http.before == "/%zz?a=%zz" |
| 359 | expect resp.http.after == "/%zz?a=%zz" |
| 360 | |
| 361 | txreq -req OPTIONS -url "*" |
| 362 | rxresp |
| 363 | expect resp.http.before == "*" |
| 364 | expect resp.http.after == "*" |
| 365 | } -run |
| 366 | |
Tim Duesterhus | 5be6ab2 | 2021-04-17 11:21:10 +0200 | [diff] [blame] | 367 | client c5 -connect ${h1_fe_percent_to_uppercase_strict_sock} { |
Tim Duesterhus | a407193 | 2021-04-15 21:46:02 +0200 | [diff] [blame] | 368 | txreq -url "/a?a=a" |
| 369 | rxresp |
| 370 | expect resp.http.before == "/a?a=a" |
| 371 | expect resp.http.after == "/a?a=a" |
| 372 | |
| 373 | txreq -url "/%aa?a=%aa" |
| 374 | rxresp |
| 375 | expect resp.http.before == "/%aa?a=%aa" |
| 376 | expect resp.http.after == "/%AA?a=%AA" |
| 377 | |
| 378 | txreq -url "/%zz?a=%zz" |
| 379 | rxresp |
| 380 | expect resp.status == 400 |
| 381 | } -run |
Maximilian Mader | ff3bb8b | 2021-04-21 00:22:50 +0200 | [diff] [blame] | 382 | |
| 383 | client c6 -connect ${h1_fe_dot_sock} { |
| 384 | txreq -url "/" |
| 385 | rxresp |
| 386 | expect resp.http.before == "/" |
| 387 | expect resp.http.after == "/" |
| 388 | |
| 389 | txreq -url "/a/b" |
| 390 | rxresp |
| 391 | expect resp.http.before == "/a/b" |
| 392 | expect resp.http.after == "/a/b" |
| 393 | |
| 394 | txreq -url "/." |
| 395 | rxresp |
| 396 | expect resp.http.before == "/." |
| 397 | expect resp.http.after == "/" |
| 398 | |
| 399 | txreq -url "/./" |
| 400 | rxresp |
| 401 | expect resp.http.before == "/./" |
| 402 | expect resp.http.after == "/" |
| 403 | |
| 404 | txreq -url "/a/." |
| 405 | rxresp |
| 406 | expect resp.http.before == "/a/." |
| 407 | expect resp.http.after == "/a/" |
| 408 | |
| 409 | txreq -url "/a." |
| 410 | rxresp |
| 411 | expect resp.http.before == "/a." |
| 412 | expect resp.http.after == "/a." |
| 413 | |
| 414 | txreq -url "/.a" |
| 415 | rxresp |
| 416 | expect resp.http.before == "/.a" |
| 417 | expect resp.http.after == "/.a" |
| 418 | |
| 419 | txreq -url "/a/." |
| 420 | rxresp |
| 421 | expect resp.http.before == "/a/." |
| 422 | expect resp.http.after == "/a/" |
| 423 | |
| 424 | txreq -url "/a/./" |
| 425 | rxresp |
| 426 | expect resp.http.before == "/a/./" |
| 427 | expect resp.http.after == "/a/" |
| 428 | |
| 429 | txreq -url "/a/./a" |
| 430 | rxresp |
| 431 | expect resp.http.before == "/a/./a" |
| 432 | expect resp.http.after == "/a/a" |
| 433 | |
| 434 | txreq -url "/a/../" |
| 435 | rxresp |
| 436 | expect resp.http.before == "/a/../" |
| 437 | expect resp.http.after == "/a/../" |
| 438 | |
| 439 | txreq -url "/a/../a" |
| 440 | rxresp |
| 441 | expect resp.http.before == "/a/../a" |
| 442 | expect resp.http.after == "/a/../a" |
| 443 | |
| 444 | txreq -url "/?a=/./" |
| 445 | rxresp |
| 446 | expect resp.http.before == "/?a=/./" |
| 447 | expect resp.http.after == "/?a=/./" |
| 448 | } -run |
Tim Duesterhus | 2e4a18e | 2021-04-21 21:20:36 +0200 | [diff] [blame] | 449 | |
| 450 | client c7 -connect ${h1_fe_percent_decode_unreserved_sock} { |
| 451 | txreq -url "/a?a=a" |
| 452 | rxresp |
| 453 | expect resp.http.before == "/a?a=a" |
| 454 | expect resp.http.after == "/a?a=a" |
| 455 | |
| 456 | txreq -url "/%61?%61=%61" |
| 457 | rxresp |
| 458 | expect resp.http.before == "/%61?%61=%61" |
| 459 | expect resp.http.after == "/a?a=a" |
| 460 | |
| 461 | txreq -url "/%3F?foo=bar" |
| 462 | rxresp |
| 463 | expect resp.http.before == "/%3F?foo=bar" |
| 464 | expect resp.http.after == "/%3F?foo=bar" |
| 465 | |
| 466 | txreq -url "/%%36%36" |
| 467 | rxresp |
| 468 | expect resp.status == 200 |
| 469 | expect resp.http.before == "/%%36%36" |
| 470 | expect resp.http.after == "/%66" |
| 471 | |
| 472 | txreq -req OPTIONS -url "*" |
| 473 | rxresp |
| 474 | expect resp.http.before == "*" |
| 475 | expect resp.http.after == "*" |
| 476 | } -run |
| 477 | |
| 478 | client c8 -connect ${h1_fe_percent_decode_unreserved_strict_sock} { |
| 479 | txreq -url "/a?a=a" |
| 480 | rxresp |
| 481 | expect resp.http.before == "/a?a=a" |
| 482 | expect resp.http.after == "/a?a=a" |
| 483 | |
| 484 | txreq -url "/%61?%61=%61" |
| 485 | rxresp |
| 486 | expect resp.http.before == "/%61?%61=%61" |
| 487 | expect resp.http.after == "/a?a=a" |
| 488 | |
| 489 | txreq -url "/%3F?foo=bar" |
| 490 | rxresp |
| 491 | expect resp.http.before == "/%3F?foo=bar" |
| 492 | expect resp.http.after == "/%3F?foo=bar" |
| 493 | |
| 494 | txreq -url "/%%36%36" |
| 495 | rxresp |
| 496 | expect resp.status == 400 |
| 497 | } -run |
Tim Duesterhus | c9e05ab | 2021-05-10 17:28:25 +0200 | [diff] [blame] | 498 | |
| 499 | client c9 -connect ${h1_fe_fragment_strip_sock} { |
| 500 | txreq -url "/#foo" |
| 501 | rxresp |
| 502 | expect resp.http.before == "/#foo" |
| 503 | expect resp.http.after == "/" |
| 504 | |
| 505 | txreq -url "/%23foo" |
| 506 | rxresp |
| 507 | expect resp.http.before == "/%23foo" |
| 508 | expect resp.http.after == "/%23foo" |
| 509 | |
| 510 | txreq -req OPTIONS -url "*" |
| 511 | rxresp |
| 512 | expect resp.http.before == "*" |
| 513 | expect resp.http.after == "*" |
| 514 | } -run |
Tim Duesterhus | dec1c36 | 2021-05-10 17:28:26 +0200 | [diff] [blame] | 515 | |
| 516 | client c10 -connect ${h1_fe_fragment_encode_sock} { |
| 517 | txreq -url "/#foo" |
| 518 | rxresp |
| 519 | expect resp.http.before == "/#foo" |
| 520 | expect resp.http.after == "/%23foo" |
| 521 | |
| 522 | txreq -url "/#foo/#foo" |
| 523 | rxresp |
| 524 | expect resp.http.before == "/#foo/#foo" |
| 525 | expect resp.http.after == "/%23foo/%23foo" |
| 526 | |
| 527 | txreq -url "/%23foo" |
| 528 | rxresp |
| 529 | expect resp.http.before == "/%23foo" |
| 530 | expect resp.http.after == "/%23foo" |
| 531 | |
| 532 | txreq -req OPTIONS -url "*" |
| 533 | rxresp |
| 534 | expect resp.http.before == "*" |
| 535 | expect resp.http.after == "*" |
| 536 | } -run |