summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/fileserver
AgeCommit message (Collapse)Author
2023-04-02fileserver: Add color-scheme meta tag (#5475)Kid
2023-03-27log: Make sink logs encodable (#5441)Mohammed Al Sahaf
* log: make `sink` encodable * deduplicate logger fields * extract common fields into `BaseLog` and embed it into `SinkLog` * amend godoc on `BaseLog` and `SinkLog` * minor style change --------- Co-authored-by: Francis Lavoie <lavofr@gmail.com>
2023-03-10fileserver: New file browse template (#5427)Matt Holt
* fileserver: New file browse template * Redo extension/icon logic; minor color tweaks * Fine-tune image display
2023-03-03fileserver: Remove trailing slash on fs filenames (#5417)esell
2023-02-24cmd: Expand cobra support, add short flags (#5379)Francis Lavoie
* cmd: Expand cobra support * Convert commands to cobra, add short flags * Fix version command typo Co-authored-by: Emily Lange <git@indeednotjames.com> * Apply suggestions from code review Co-authored-by: Matt Holt <mholt@users.noreply.github.com> --------- Co-authored-by: Emily Lange <git@indeednotjames.com> Co-authored-by: Matt Holt <mholt@users.noreply.github.com>
2023-02-08go.mod: Upgrade various dependencies (#5362)Francis Lavoie
* chore: Upgrade various dependencies * Support CEL file matcher with no args * Document `http.request.orig_uri.path.*`, reorder placeholders in docs --------- Co-authored-by: Matt Holt <mholt@users.noreply.github.com>
2023-01-04fileserver: Add a couple test casesMatthew Holt
With placeholders
2022-10-24fileserver: Reject non-GET/HEAD requests (close #5166) (#5167)Matt Holt
* fileserver: Reject non-GET/HEAD requests (close #5166) * Set Allow header according to RFC 9110 10.2.1
2022-10-18fileserver: Reject ADS and short name paths; trim trailing dots and spaces ↵Matt Holt
on Windows (#5148) * fileserver: Reject ADS and short name paths * caddyhttp: Trim trailing space and dot on Windows Windows ignores trailing dots and spaces in filenames. * Fix test * Adjust path filters * Revert Windows test * Actually revert the test * Just check for colons
2022-10-08fileserver: stop listing dir when request context is cancelled (#5131)Abdussamet Koçak
Prevents caddy from performing disk IO needlessly when the request is cancelled before the listing is finished. Closes #5129
2022-10-04fileserver: Treat invalid file path as NotFound (#5099)xufanglu
treat invalid file path as notFound so that PassThru can work
2022-10-01fileserver: better dark mode visited link contrast (#5105)iliana etaoin
PR #4066 added a dark color scheme to the file_server browse template. PR #4356 later set the links for the `:visited` pseudo-class, but did not set anything for the dark mode, resulting in poor contrast. I selected some new colors by feel. This commit also adds an `a:visited:hover` for both, to go along with the normal blue hover colors.
2022-09-20fileserver: Reinstate --debug flagMatthew Holt
I think it got lost during a rebase or something
2022-09-16core: Variadic Context.Logger(); soft deprecationMatthew Holt
Ideally I'd just remove the parameter to caddy.Context.Logger(), but this would break most Caddy plugins. Instead, I'm making it variadic and marking it as partially deprecated. In the future, I might completely remove the parameter once most plugins have updated.
2022-09-15caddyhttp: Add --debug flag to commandsMatthew Holt
file-server and reverse-proxy This might be useful!
2022-09-07fileserver: Ignore EOF when browsing empty dirMatthew Holt
Thanks to @WeidiDeng for reporting this
2022-09-05Drop requirement for filesystems to implement fs.StatFSDave Henderson
Signed-off-by: Dave Henderson <dhenderson@gmail.com>
2022-09-05fileserver: Support glob expansion in file matcher (#4993)Matt Holt
* fileserver: Support glob expansion in file matcher * Fix tests * Fix bugs and tests * Attempt Windows fix, sigh * debug Windows, WIP * Continue debugging Windows * Another attempt at Windows * Plz Windows * Cmon... * Clean up, hope I didn't break anything
2022-08-16caddyhttp: Smarter path matching and rewriting (#4948)Matt Holt
Co-authored-by: RussellLuo <luopeng.he@gmail.com>
2022-08-15fileserver: reset buffer before using it (#4962) (#4963)Abdussamet Koçak
2022-08-08fileserver: Better fix for Etag of compressed filesMatthew Holt
2022-08-08fileserver: Generate Etag from sidecar fileMatthew Holt
Don't use the primary/uncompressed file for Etag when serving sidecars. This was just overlooked initially.
2022-08-02chore: Bump up to Go 1.19, minimum 1.18 (#4925)Francis Lavoie
2022-08-01caddyhttp: Implement `caddy respond` command (#4870)Matt Holt
2022-07-31fileserver: Support virtual file system in CaddyfileMatthew Holt
2022-07-30fileserver: Support virtual file systems (#4909)Matt Holt
* fileserver: Support virtual file systems (close #3720) This change replaces the hard-coded use of os.Open() and os.Stat() with the use of the new (Go 1.16) io/fs APIs, enabling virtual file systems. It introduces a new module namespace, caddy.fs, for such file systems. Also improve documentation for the file server. I realized it was one of the first modules written for Caddy 2, and the docs hadn't really been updated since! * Virtualize FS for file matcher; minor tweaks * Fix tests and rename dirFS -> osFS (Since we do not use a root directory, it is dynamic.)
2022-07-28Finish fixing lint errors from ea8df6ffMatthew Holt
Follows up #4915
2022-07-28caddyhttp: Use new CEL APIs (fix #4915)Matthew Holt
Hahaha this is the ultimate "I have no idea what I'm doing" commit but it compiles and the tests pass and I declare victory! ... probably broke something, should be tested more. It is nice that the protobuf dependency becomes indirect now.
2022-07-07fileserver: Use safe redirects in file browserMatthew Holt
2022-06-22Expose several Caddy HTTP Matchers to the CEL Matcher (#4715)Tristan Swadell
Co-authored-by: Francis Lavoie <lavofr@gmail.com>
2022-04-25httpcaddyfile: Deprecate paths in site addresses; use zap logs (#4728)Francis Lavoie
2022-04-07staticfiles: Expand placeholder for index files (#4679)Y.Horie
2022-03-04fileserver: Add `pass_thru` Caddyfile option (#4613)Francis Lavoie
2022-03-01fileserver: Canonical redir when whole path is stripped (#4549)Francis Lavoie
2021-12-11fileserver: do not double-escape paths (#4447)Mohammed Al Sahaf
2021-12-05docs: use backticks to not italicise glob path (#4460)Adam Burgess
2021-11-23fileserver: browse: do not encode the paths in breadcrumbs and page title ↵Mohammed Al Sahaf
(#4410)
2021-11-22fileserver: Fix handling of symlink sizes in directory listings (#4415)Jeremy Lin
2021-11-15fileserver: Move default browse template into a separate file (#4417)Jeremy Lin
This makes it easier for users to find the default browse template if they want to create a custom template based on that. It also makes it easier to view the template with proper syntax highlighting.
2021-10-20fileserver: Prevent focusing filter from scrolling on page load (#4393)Klaus Helenius
2021-09-19fileserver: Make file listing links purple once visited (#4356)Slavik
2021-09-18fileserver: Fix displayed file size if it is symlink (#4354)HayatoShiba
* Fix file size if it is symlink * change the variable name for readability
2021-09-17caddyhttp: Add support for triggering errors from `try_files` (#4346)Francis Lavoie
* caddyhttp: Add support for triggering errors from `try_files` * caddyhttp: Use vars instead of placeholders/replacer for matcher errors * caddyhttp: Add comment for matcher error var key
2021-09-16fileserver: properly handle escaped/non-ascii paths (#4332)Mohammed Al Sahaf
* fileserver: properly handle escaped/non-ascii paths * fileserver: tests: accommodate Windows hate of colons in files names
2021-07-07fileserver: Fix browse name_dir_first sorting (#4218)diamondburned
This commit fixes the `sortByNameDirFirst` variable inside fileserver to match what browse's default template has. Co-authored-by: Francis Lavoie <lavofr@gmail.com>
2021-07-01fileserver: Add `disable_canonical_uris` Caddyfile subdirective (#4222)mritd
* feat(fileserver): add 'canonical_uris' parameter to caddyfile add 'canonical_uris' parameter to caddyfile reference #2741 Signed-off-by: mritd <mritd@linux.com> * feat(file_server): rename subdirective canonical_uris to disable_canonical_uris rename subdirective canonical_uris to disable_canonical_uris Signed-off-by: mritd <mritd@linux.com> * test(caddyfile_adapt): add disable_canonical_uris subdirective test file add disable_canonical_uris subdirective test file Signed-off-by: mritd <mritd@linux.com>
2021-06-25fileserver: Clarify docs about canonicalizationMatthew Holt
Related to https://github.com/caddyserver/caddy/issues/4205.
2021-06-17caddyhttp: Refactor and export SanitizedPathJoin for use in fastcgi (#4207)Matt Holt
2021-06-17fileserver: Only redirect if filename not rewritten (fix #4205)Matthew Holt
This is the more correct implementation of 23dadc0d86dd75dad7559c25f20c9641bc7bc30f (#4179)... I think. This commit effectively undoes the revert in 8848df9c5d372a559d01512b7a4ef00e38867b55, but with corrections to the logic. We *do* need to use the original request path (the path the browser knows) for redirects, since they are external, and rewrites are only internal. However, if the path was rewritten to a non-canonical path, we should not redirect to canonicalize that, since rewrites are intentional by the site owner. Canonicalizing the path involves modifying only the suffix (base element, or filename) of the path. Thus, if a rewrite involves only the prefix (like how handle_path strips a path prefix), then we can (hopefully!) safely redirect using the original URI since the filename was not rewritten. So basically, if rewrites modify the filename, we should not canonicalize those requests. If rewrites only modify another part of the path (commonly a prefix), we should be OK to redirect.
2021-06-16fileserver: Don't persist parsed template (fix #4202)Matthew Holt
Templates are parsed at request-time (like they are in the templates middleware) to allow live changes to the template while the server is running. Fixes race condition. Also refactored use of a buffer so a buffer put back in the pool will not continue to be used (written to client) in the meantime. A couple of benchmarks removed due to refactor, which is fine, since we know pooling helps here.