Mercurial > hg > nginx-tests
annotate http_method.t @ 1828:835630547d35
Tests: dav tests with UTF-8.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Tue, 21 Mar 2023 14:20:54 +0400 |
parents | f3de5730bc06 |
children | 2a0a6035a1af |
rev | line source |
---|---|
1710
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
1 #!/usr/bin/perl |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
2 |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
3 # (C) Sergey Kandaurov |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
4 # (C) Nginx, Inc. |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
5 |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
6 # Tests for HTTP methods. |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
7 |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
8 ############################################################################### |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
9 |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
10 use warnings; |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
11 use strict; |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
12 |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
13 use Test::More; |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
14 |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
15 BEGIN { use FindBin; chdir($FindBin::Bin); } |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
16 |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
17 use lib 'lib'; |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
18 use Test::Nginx; |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
19 |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
20 ############################################################################### |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
21 |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
22 select STDERR; $| = 1; |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
23 select STDOUT; $| = 1; |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
24 |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
25 my $t = Test::Nginx->new()->has(qw/http rewrite/)->plan(2) |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
26 ->write_file_expand('nginx.conf', <<'EOF')->run(); |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
27 |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
28 %%TEST_GLOBALS%% |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
29 |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
30 daemon off; |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
31 |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
32 events { |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
33 } |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
34 |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
35 http { |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
36 %%TEST_GLOBALS_HTTP%% |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
37 |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
38 server { |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
39 listen 127.0.0.1:8080; |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
40 server_name localhost; |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
41 |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
42 location / { |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
43 return 200; |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
44 } |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
45 } |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
46 } |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
47 |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
48 EOF |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
49 |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
50 ############################################################################### |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
51 |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
52 like(http(<<EOF), qr/405 Not Allowed(?!.*200 OK)/s, 'trace'); |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
53 TRACE / HTTP/1.1 |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
54 Host: localhost |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
55 |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
56 GET / HTTP/1.1 |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
57 Host: localhost |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
58 Connection: close |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
59 |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
60 EOF |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
61 |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
62 TODO: { |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
63 local $TODO = 'not yet' unless $t->has_version('1.21.1'); |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
64 |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
65 like(http(<<EOF), qr/405 Not Allowed(?!.*200 OK)/s, 'connect'); |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
66 CONNECT / HTTP/1.1 |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
67 Host: localhost |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
68 |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
69 GET / HTTP/1.1 |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
70 Host: localhost |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
71 Connection: close |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
72 |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
73 EOF |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
74 |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
75 } |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
76 |
f3de5730bc06
Tests: CONNECT and TRACE method tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
77 ############################################################################### |