Signed-off-by: Martin Storsjö <martin@martin.st>
Martin Storsjö authored on 2013/02/27 18:45:16387 | 388 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,43 @@ |
0 |
+/* |
|
1 |
+ * Copyright (c) 2013 Martin Storsjo |
|
2 |
+ * |
|
3 |
+ * This file is part of Libav. |
|
4 |
+ * |
|
5 |
+ * Libav is free software; you can redistribute it and/or |
|
6 |
+ * modify it under the terms of the GNU Lesser General Public |
|
7 |
+ * License as published by the Free Software Foundation; either |
|
8 |
+ * version 2.1 of the License, or (at your option) any later version. |
|
9 |
+ * |
|
10 |
+ * Libav is distributed in the hope that it will be useful, |
|
11 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 |
+ * Lesser General Public License for more details. |
|
14 |
+ * |
|
15 |
+ * You should have received a copy of the GNU Lesser General Public |
|
16 |
+ * License along with Libav; if not, write to the Free Software |
|
17 |
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
18 |
+ */ |
|
19 |
+ |
|
20 |
+#include "internal.h" |
|
21 |
+ |
|
22 |
+static void test(const char *pattern, const char *host) |
|
23 |
+{ |
|
24 |
+ int res = ff_http_match_no_proxy(pattern, host); |
|
25 |
+ printf("The pattern \"%s\" %s the hostname %s\n", |
|
26 |
+ pattern ? pattern : "(null)", res ? "matches" : "does not match", |
|
27 |
+ host); |
|
28 |
+} |
|
29 |
+ |
|
30 |
+int main(void) |
|
31 |
+{ |
|
32 |
+ test(NULL, "domain.com"); |
|
33 |
+ test("example.com domain.com", "domain.com"); |
|
34 |
+ test("example.com other.com", "domain.com"); |
|
35 |
+ test("example.com,domain.com", "domain.com"); |
|
36 |
+ test("example.com,domain.com", "otherdomain.com"); |
|
37 |
+ test("example.com, *.domain.com", "sub.domain.com"); |
|
38 |
+ test("example.com, *.domain.com", "domain.com"); |
|
39 |
+ test("example.com, .domain.com", "domain.com"); |
|
40 |
+ test("*", "domain.com"); |
|
41 |
+ return 0; |
|
42 |
+} |
4 | 8 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,9 @@ |
0 |
+The pattern "(null)" does not match the hostname domain.com |
|
1 |
+The pattern "example.com domain.com" matches the hostname domain.com |
|
2 |
+The pattern "example.com other.com" does not match the hostname domain.com |
|
3 |
+The pattern "example.com,domain.com" matches the hostname domain.com |
|
4 |
+The pattern "example.com,domain.com" does not match the hostname otherdomain.com |
|
5 |
+The pattern "example.com, *.domain.com" matches the hostname sub.domain.com |
|
6 |
+The pattern "example.com, *.domain.com" matches the hostname domain.com |
|
7 |
+The pattern "example.com, .domain.com" matches the hostname domain.com |
|
8 |
+The pattern "*" matches the hostname domain.com |