-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Mohammed Al Sahaf <[email protected]>
- Loading branch information
1 parent
0ecb1ba
commit 6d4992e
Showing
6 changed files
with
132 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Index.html Title</title> | ||
</head> | ||
<body> | ||
Index.html | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
index.txt |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
# Configure Caddy with default configuration | ||
POST http://localhost:2019/load | ||
Content-Type: text/caddyfile | ||
``` | ||
{ | ||
skip_install_trust | ||
http_port 9080 | ||
https_port 9443 | ||
local_certs | ||
debug | ||
} | ||
localhost { | ||
root {{indexed_root}} | ||
file_server | ||
} | ||
``` | ||
|
||
# requests without specific file receive index file per | ||
# the default index list: index.html, index.txt | ||
GET https://localhost:9443 | ||
[Options] | ||
insecure: true | ||
HTTP 200 | ||
[Asserts] | ||
``` | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Index.html Title</title> | ||
</head> | ||
<body> | ||
Index.html | ||
</body> | ||
</html>``` | ||
|
||
|
||
# if index.txt is specifically requested, we expect index.txt | ||
GET https://localhost:9443/index.txt | ||
[Options] | ||
insecure: true | ||
HTTP 200 | ||
[Asserts] | ||
body == "index.txt" | ||
|
||
# requests for sub-folder followed by .. result in sanitized path | ||
GET https://localhost:9443/non-existent/../index.txt | ||
[Options] | ||
insecure: true | ||
HTTP 200 | ||
[Asserts] | ||
body == "index.txt" | ||
|
||
# results out of root folder are sanitized, | ||
# and conform to default index list sequence. | ||
GET https://localhost:9443/../ | ||
[Options] | ||
insecure: true | ||
HTTP 200 | ||
[Asserts] | ||
``` | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Index.html Title</title> | ||
</head> | ||
<body> | ||
Index.html | ||
</body> | ||
</html>``` | ||
|
||
|
||
# Configure Caddy with custsom index "index.txt" | ||
POST http://localhost:2019/load | ||
Content-Type: text/caddyfile | ||
``` | ||
{ | ||
skip_install_trust | ||
http_port 9080 | ||
https_port 9443 | ||
local_certs | ||
debug | ||
} | ||
localhost { | ||
root {{indexed_root}} | ||
file_server { | ||
index index.txt | ||
} | ||
} | ||
``` | ||
|
||
GET https://localhost:9443 | ||
[Options] | ||
insecure: true | ||
HTTP 200 | ||
[Asserts] | ||
body == "index.txt" | ||
|
||
|
||
# Configure with a root not containing index files | ||
POST http://localhost:2019/load | ||
Content-Type: text/caddyfile | ||
``` | ||
{ | ||
skip_install_trust | ||
http_port 9080 | ||
https_port 9443 | ||
local_certs | ||
debug | ||
} | ||
localhost { | ||
root {{unindexed_root}} | ||
file_server | ||
} | ||
``` | ||
|
||
GET https://localhost:9443 | ||
[Options] | ||
insecure: true | ||
HTTP 404 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
indexed_root=./caddytest/spec/http/file_server/assets/indexed | ||
unindexed_root=./caddytest/spec/http/file_server/assets/unindexed |