From 4b75f3e2f09b77b98783ea4d6602391c7283f984 Mon Sep 17 00:00:00 2001 From: Francis Lavoie Date: Fri, 25 Mar 2022 00:48:45 -0400 Subject: [PATCH] chore: Clean up adapt test line endings (#4660) Lots of the files were using CRLF instead of LF. Mostly my fault cause sometimes I make the files on Windows and VSCode for some reason kept making them with the wrong line endings. Sigh. Since .txt files typically default to spaces for indentation, I'm also adding an .editorconfig to ensure they use tabs instead --- .editorconfig | 5 + .../caddyfile_adapt/file_server_pass_thru.txt | 64 ++-- .../php_fastcgi_handle_response.txt | 288 +++++++++--------- .../php_fastcgi_try_files_override.txt | 248 +++++++-------- .../reverse_proxy_trusted_proxies.txt | 112 +++---- .../sort_directives_within_handle.txt | 264 ++++++++-------- .../caddyfile_adapt/tls_internal_options.txt | 106 +++---- 7 files changed, 546 insertions(+), 541 deletions(-) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..7134bf7e --- /dev/null +++ b/.editorconfig @@ -0,0 +1,5 @@ +[*] +end_of_line = lf + +[caddytest/integration/caddyfile_adapt/*.txt] +indent_style = tab \ No newline at end of file diff --git a/caddytest/integration/caddyfile_adapt/file_server_pass_thru.txt b/caddytest/integration/caddyfile_adapt/file_server_pass_thru.txt index 476b165d..cc7051b2 100644 --- a/caddytest/integration/caddyfile_adapt/file_server_pass_thru.txt +++ b/caddytest/integration/caddyfile_adapt/file_server_pass_thru.txt @@ -1,32 +1,32 @@ -:80 - -file_server { - pass_thru -} ----------- -{ - "apps": { - "http": { - "servers": { - "srv0": { - "listen": [ - ":80" - ], - "routes": [ - { - "handle": [ - { - "handler": "file_server", - "hide": [ - "./Caddyfile" - ], - "pass_thru": true - } - ] - } - ] - } - } - } - } -} +:80 + +file_server { + pass_thru +} +---------- +{ + "apps": { + "http": { + "servers": { + "srv0": { + "listen": [ + ":80" + ], + "routes": [ + { + "handle": [ + { + "handler": "file_server", + "hide": [ + "./Caddyfile" + ], + "pass_thru": true + } + ] + } + ] + } + } + } + } +} diff --git a/caddytest/integration/caddyfile_adapt/php_fastcgi_handle_response.txt b/caddytest/integration/caddyfile_adapt/php_fastcgi_handle_response.txt index 42fb6558..dbb08719 100644 --- a/caddytest/integration/caddyfile_adapt/php_fastcgi_handle_response.txt +++ b/caddytest/integration/caddyfile_adapt/php_fastcgi_handle_response.txt @@ -1,145 +1,145 @@ -:8881 { - php_fastcgi app:9000 { - env FOO bar - - @error status 4xx - handle_response @error { - root * /errors - rewrite * /{http.reverse_proxy.status_code}.html - file_server - } - } -} ----------- -{ - "apps": { - "http": { - "servers": { - "srv0": { - "listen": [ - ":8881" - ], - "routes": [ - { - "match": [ - { - "file": { - "try_files": [ - "{http.request.uri.path}/index.php" - ] - }, - "not": [ - { - "path": [ - "*/" - ] - } - ] - } - ], - "handle": [ - { - "handler": "static_response", - "headers": { - "Location": [ - "{http.request.uri.path}/" - ] - }, - "status_code": 308 - } - ] - }, - { - "match": [ - { - "file": { - "try_files": [ - "{http.request.uri.path}", - "{http.request.uri.path}/index.php", - "index.php" - ], - "split_path": [ - ".php" - ] - } - } - ], - "handle": [ - { - "handler": "rewrite", - "uri": "{http.matchers.file.relative}" - } - ] - }, - { - "match": [ - { - "path": [ - "*.php" - ] - } - ], - "handle": [ - { - "handle_response": [ - { - "match": { - "status_code": [ - 4 - ] - }, - "routes": [ - { - "handle": [ - { - "handler": "vars", - "root": "/errors" - } - ] - }, - { - "group": "group0", - "handle": [ - { - "handler": "rewrite", - "uri": "/{http.reverse_proxy.status_code}.html" - } - ] - }, - { - "handle": [ - { - "handler": "file_server", - "hide": [ - "./Caddyfile" - ] - } - ] - } - ] - } - ], - "handler": "reverse_proxy", - "transport": { - "env": { - "FOO": "bar" - }, - "protocol": "fastcgi", - "split_path": [ - ".php" - ] - }, - "upstreams": [ - { - "dial": "app:9000" - } - ] - } - ] - } - ] - } - } - } - } +:8881 { + php_fastcgi app:9000 { + env FOO bar + + @error status 4xx + handle_response @error { + root * /errors + rewrite * /{http.reverse_proxy.status_code}.html + file_server + } + } +} +---------- +{ + "apps": { + "http": { + "servers": { + "srv0": { + "listen": [ + ":8881" + ], + "routes": [ + { + "match": [ + { + "file": { + "try_files": [ + "{http.request.uri.path}/index.php" + ] + }, + "not": [ + { + "path": [ + "*/" + ] + } + ] + } + ], + "handle": [ + { + "handler": "static_response", + "headers": { + "Location": [ + "{http.request.uri.path}/" + ] + }, + "status_code": 308 + } + ] + }, + { + "match": [ + { + "file": { + "try_files": [ + "{http.request.uri.path}", + "{http.request.uri.path}/index.php", + "index.php" + ], + "split_path": [ + ".php" + ] + } + } + ], + "handle": [ + { + "handler": "rewrite", + "uri": "{http.matchers.file.relative}" + } + ] + }, + { + "match": [ + { + "path": [ + "*.php" + ] + } + ], + "handle": [ + { + "handle_response": [ + { + "match": { + "status_code": [ + 4 + ] + }, + "routes": [ + { + "handle": [ + { + "handler": "vars", + "root": "/errors" + } + ] + }, + { + "group": "group0", + "handle": [ + { + "handler": "rewrite", + "uri": "/{http.reverse_proxy.status_code}.html" + } + ] + }, + { + "handle": [ + { + "handler": "file_server", + "hide": [ + "./Caddyfile" + ] + } + ] + } + ] + } + ], + "handler": "reverse_proxy", + "transport": { + "env": { + "FOO": "bar" + }, + "protocol": "fastcgi", + "split_path": [ + ".php" + ] + }, + "upstreams": [ + { + "dial": "app:9000" + } + ] + } + ] + } + ] + } + } + } + } } \ No newline at end of file diff --git a/caddytest/integration/caddyfile_adapt/php_fastcgi_try_files_override.txt b/caddytest/integration/caddyfile_adapt/php_fastcgi_try_files_override.txt index 2f4ef767..43427862 100644 --- a/caddytest/integration/caddyfile_adapt/php_fastcgi_try_files_override.txt +++ b/caddytest/integration/caddyfile_adapt/php_fastcgi_try_files_override.txt @@ -1,124 +1,124 @@ -:8884 - -php_fastcgi localhost:9000 { - # some php_fastcgi-specific subdirectives - split .php .php5 - env VAR1 value1 - env VAR2 value2 - root /var/www - try_files {path} {path}/index.php =404 - dial_timeout 3s - read_timeout 10s - write_timeout 20s - - # passed through to reverse_proxy (directive order doesn't matter!) - lb_policy random -} ----------- -{ - "apps": { - "http": { - "servers": { - "srv0": { - "listen": [ - ":8884" - ], - "routes": [ - { - "match": [ - { - "file": { - "try_files": [ - "{http.request.uri.path}/index.php" - ] - }, - "not": [ - { - "path": [ - "*/" - ] - } - ] - } - ], - "handle": [ - { - "handler": "static_response", - "headers": { - "Location": [ - "{http.request.uri.path}/" - ] - }, - "status_code": 308 - } - ] - }, - { - "match": [ - { - "file": { - "try_files": [ - "{http.request.uri.path}", - "{http.request.uri.path}/index.php", - "=404" - ], - "split_path": [ - ".php", - ".php5" - ] - } - } - ], - "handle": [ - { - "handler": "rewrite", - "uri": "{http.matchers.file.relative}" - } - ] - }, - { - "match": [ - { - "path": [ - "*.php", - "*.php5" - ] - } - ], - "handle": [ - { - "handler": "reverse_proxy", - "load_balancing": { - "selection_policy": { - "policy": "random" - } - }, - "transport": { - "dial_timeout": 3000000000, - "env": { - "VAR1": "value1", - "VAR2": "value2" - }, - "protocol": "fastcgi", - "read_timeout": 10000000000, - "root": "/var/www", - "split_path": [ - ".php", - ".php5" - ], - "write_timeout": 20000000000 - }, - "upstreams": [ - { - "dial": "localhost:9000" - } - ] - } - ] - } - ] - } - } - } - } -} +:8884 + +php_fastcgi localhost:9000 { + # some php_fastcgi-specific subdirectives + split .php .php5 + env VAR1 value1 + env VAR2 value2 + root /var/www + try_files {path} {path}/index.php =404 + dial_timeout 3s + read_timeout 10s + write_timeout 20s + + # passed through to reverse_proxy (directive order doesn't matter!) + lb_policy random +} +---------- +{ + "apps": { + "http": { + "servers": { + "srv0": { + "listen": [ + ":8884" + ], + "routes": [ + { + "match": [ + { + "file": { + "try_files": [ + "{http.request.uri.path}/index.php" + ] + }, + "not": [ + { + "path": [ + "*/" + ] + } + ] + } + ], + "handle": [ + { + "handler": "static_response", + "headers": { + "Location": [ + "{http.request.uri.path}/" + ] + }, + "status_code": 308 + } + ] + }, + { + "match": [ + { + "file": { + "try_files": [ + "{http.request.uri.path}", + "{http.request.uri.path}/index.php", + "=404" + ], + "split_path": [ + ".php", + ".php5" + ] + } + } + ], + "handle": [ + { + "handler": "rewrite", + "uri": "{http.matchers.file.relative}" + } + ] + }, + { + "match": [ + { + "path": [ + "*.php", + "*.php5" + ] + } + ], + "handle": [ + { + "handler": "reverse_proxy", + "load_balancing": { + "selection_policy": { + "policy": "random" + } + }, + "transport": { + "dial_timeout": 3000000000, + "env": { + "VAR1": "value1", + "VAR2": "value2" + }, + "protocol": "fastcgi", + "read_timeout": 10000000000, + "root": "/var/www", + "split_path": [ + ".php", + ".php5" + ], + "write_timeout": 20000000000 + }, + "upstreams": [ + { + "dial": "localhost:9000" + } + ] + } + ] + } + ] + } + } + } + } +} diff --git a/caddytest/integration/caddyfile_adapt/reverse_proxy_trusted_proxies.txt b/caddytest/integration/caddyfile_adapt/reverse_proxy_trusted_proxies.txt index 5e112847..f1e685c0 100644 --- a/caddytest/integration/caddyfile_adapt/reverse_proxy_trusted_proxies.txt +++ b/caddytest/integration/caddyfile_adapt/reverse_proxy_trusted_proxies.txt @@ -1,56 +1,56 @@ -:8884 - -reverse_proxy 127.0.0.1:65535 { - trusted_proxies 127.0.0.1 -} - -reverse_proxy 127.0.0.1:65535 { - trusted_proxies private_ranges -} ----------- -{ - "apps": { - "http": { - "servers": { - "srv0": { - "listen": [ - ":8884" - ], - "routes": [ - { - "handle": [ - { - "handler": "reverse_proxy", - "trusted_proxies": [ - "127.0.0.1" - ], - "upstreams": [ - { - "dial": "127.0.0.1:65535" - } - ] - }, - { - "handler": "reverse_proxy", - "trusted_proxies": [ - "192.168.0.0/16", - "172.16.0.0/12", - "10.0.0.0/8", - "127.0.0.1/8", - "fd00::/8", - "::1" - ], - "upstreams": [ - { - "dial": "127.0.0.1:65535" - } - ] - } - ] - } - ] - } - } - } - } -} +:8884 + +reverse_proxy 127.0.0.1:65535 { + trusted_proxies 127.0.0.1 +} + +reverse_proxy 127.0.0.1:65535 { + trusted_proxies private_ranges +} +---------- +{ + "apps": { + "http": { + "servers": { + "srv0": { + "listen": [ + ":8884" + ], + "routes": [ + { + "handle": [ + { + "handler": "reverse_proxy", + "trusted_proxies": [ + "127.0.0.1" + ], + "upstreams": [ + { + "dial": "127.0.0.1:65535" + } + ] + }, + { + "handler": "reverse_proxy", + "trusted_proxies": [ + "192.168.0.0/16", + "172.16.0.0/12", + "10.0.0.0/8", + "127.0.0.1/8", + "fd00::/8", + "::1" + ], + "upstreams": [ + { + "dial": "127.0.0.1:65535" + } + ] + } + ] + } + ] + } + } + } + } +} diff --git a/caddytest/integration/caddyfile_adapt/sort_directives_within_handle.txt b/caddytest/integration/caddyfile_adapt/sort_directives_within_handle.txt index 10ff6da3..0cf9d880 100644 --- a/caddytest/integration/caddyfile_adapt/sort_directives_within_handle.txt +++ b/caddytest/integration/caddyfile_adapt/sort_directives_within_handle.txt @@ -1,133 +1,133 @@ -*.example.com { - @foo host foo.example.com - handle @foo { - handle_path /strip* { - respond "this should be first" - } - handle { - respond "this should be second" - } - } - handle { - respond "this should be last" - } -} ----------- -{ - "apps": { - "http": { - "servers": { - "srv0": { - "listen": [ - ":443" - ], - "routes": [ - { - "match": [ - { - "host": [ - "*.example.com" - ] - } - ], - "handle": [ - { - "handler": "subroute", - "routes": [ - { - "group": "group5", - "handle": [ - { - "handler": "subroute", - "routes": [ - { - "group": "group2", - "handle": [ - { - "handler": "subroute", - "routes": [ - { - "handle": [ - { - "handler": "rewrite", - "strip_path_prefix": "/strip" - } - ] - }, - { - "handle": [ - { - "body": "this should be first", - "handler": "static_response" - } - ] - } - ] - } - ], - "match": [ - { - "path": [ - "/strip*" - ] - } - ] - }, - { - "group": "group2", - "handle": [ - { - "handler": "subroute", - "routes": [ - { - "handle": [ - { - "body": "this should be second", - "handler": "static_response" - } - ] - } - ] - } - ] - } - ] - } - ], - "match": [ - { - "host": [ - "foo.example.com" - ] - } - ] - }, - { - "group": "group5", - "handle": [ - { - "handler": "subroute", - "routes": [ - { - "handle": [ - { - "body": "this should be last", - "handler": "static_response" - } - ] - } - ] - } - ] - } - ] - } - ], - "terminal": true - } - ] - } - } - } - } +*.example.com { + @foo host foo.example.com + handle @foo { + handle_path /strip* { + respond "this should be first" + } + handle { + respond "this should be second" + } + } + handle { + respond "this should be last" + } +} +---------- +{ + "apps": { + "http": { + "servers": { + "srv0": { + "listen": [ + ":443" + ], + "routes": [ + { + "match": [ + { + "host": [ + "*.example.com" + ] + } + ], + "handle": [ + { + "handler": "subroute", + "routes": [ + { + "group": "group5", + "handle": [ + { + "handler": "subroute", + "routes": [ + { + "group": "group2", + "handle": [ + { + "handler": "subroute", + "routes": [ + { + "handle": [ + { + "handler": "rewrite", + "strip_path_prefix": "/strip" + } + ] + }, + { + "handle": [ + { + "body": "this should be first", + "handler": "static_response" + } + ] + } + ] + } + ], + "match": [ + { + "path": [ + "/strip*" + ] + } + ] + }, + { + "group": "group2", + "handle": [ + { + "handler": "subroute", + "routes": [ + { + "handle": [ + { + "body": "this should be second", + "handler": "static_response" + } + ] + } + ] + } + ] + } + ] + } + ], + "match": [ + { + "host": [ + "foo.example.com" + ] + } + ] + }, + { + "group": "group5", + "handle": [ + { + "handler": "subroute", + "routes": [ + { + "handle": [ + { + "body": "this should be last", + "handler": "static_response" + } + ] + } + ] + } + ] + } + ] + } + ], + "terminal": true + } + ] + } + } + } + } } \ No newline at end of file diff --git a/caddytest/integration/caddyfile_adapt/tls_internal_options.txt b/caddytest/integration/caddyfile_adapt/tls_internal_options.txt index 7298a370..50bbfec2 100644 --- a/caddytest/integration/caddyfile_adapt/tls_internal_options.txt +++ b/caddytest/integration/caddyfile_adapt/tls_internal_options.txt @@ -1,54 +1,54 @@ -a.example.com { - tls { - issuer internal { - ca foo - lifetime 24h - sign_with_root - } - } -} ----------- -{ - "apps": { - "http": { - "servers": { - "srv0": { - "listen": [ - ":443" - ], - "routes": [ - { - "match": [ - { - "host": [ - "a.example.com" - ] - } - ], - "terminal": true - } - ] - } - } - }, - "tls": { - "automation": { - "policies": [ - { - "subjects": [ - "a.example.com" - ], - "issuers": [ - { - "ca": "foo", - "lifetime": 86400000000000, - "module": "internal", - "sign_with_root": true - } - ] - } - ] - } - } - } +a.example.com { + tls { + issuer internal { + ca foo + lifetime 24h + sign_with_root + } + } +} +---------- +{ + "apps": { + "http": { + "servers": { + "srv0": { + "listen": [ + ":443" + ], + "routes": [ + { + "match": [ + { + "host": [ + "a.example.com" + ] + } + ], + "terminal": true + } + ] + } + } + }, + "tls": { + "automation": { + "policies": [ + { + "subjects": [ + "a.example.com" + ], + "issuers": [ + { + "ca": "foo", + "lifetime": 86400000000000, + "module": "internal", + "sign_with_root": true + } + ] + } + ] + } + } + } } \ No newline at end of file