0
Fork 0
mirror of https://github.com/caddyserver/caddy.git synced 2024-12-23 22:27:38 -05:00
Commit graph

505 commits

Author SHA1 Message Date
W-Mark Kubacki
239f6825f7 browse: When sorting by size, offset directories
Assigns negative sizes to directories in order to have them listed reliably
before any zero-sized files. That order is what most users expect when
sorting by size.

As side effect directories will appear before files on all filesystem
implementations. To give an example: before this change directories had a size
of 4 KiB when using Linux with ext4 or tmpfs, and with ZFS a size resembling
an estimation of the number of leaves within said directory.
2016-04-19 00:20:44 +02:00
W-Mark Kubacki
1d38d113f8 browse: Move predicate 'limit' to ServeListing
This keeps the interface of all available formatters honest,
and allows for truncated listings all formats.
2016-04-19 00:20:44 +02:00
W-Mark Kubacki
6908136092 browse: Split ServeHTTP into small specialized functions 2016-04-19 00:20:44 +02:00
Matt Holt
da016f8d5a Merge pull request #760 from Burmudar/hostname-placeholder
Add hostname placeholder. Headers use replacer
2016-04-18 15:54:31 -06:00
W. Mark Kubacki
2f2d357fb6 browse: Fix known bugs (#770)
* browse: Catch the case of a directory disappearing before having been read

* browse: Revert to old pass-through behaviour

PROPFIND is a request for an alternate view on a directory's contents, which
response is indeed not implemented but ideally allowed to ask for.
OPTIONS would ideally return (at least) what methods the requestor could use,
which is an allowed request method, too.

This addresses #767.
2016-04-18 11:42:36 -06:00
Matthew Holt
924b53eb3c Minor changes 2016-04-18 09:43:28 -06:00
W-Mark Kubacki
c05c5163e2 browse: Don't leak Cookies to sessions in HTTP from HTTPS 2016-04-17 01:16:17 +02:00
W-Mark Kubacki
3513b6f2f7 fileserver: When out of filedescriptors, spread retry attempts 2016-04-17 01:16:17 +02:00
W-Mark Kubacki
4a6121f989 Tell usage of 'path' from 'filepath' and fix *path checking 2016-04-17 01:16:16 +02:00
William Bezuidenhout
a762bec06d Add hostname placeholder. Header uses replacer
On matched header rules, replacer is used to replace any placeholders
defined in header rules iex. X-Backend {hostname} where {hostname} will
be replaced by the hostname key present in the replacer

hostname key added to replacer. The value is determined by the output of
`os.Hostname()`
2016-04-16 19:06:39 +02:00
W-Mark Kubacki
4e98cc3005 browse: Return HTTP errors on unhandled HTTP methods
For example, a HTTP POST should not be answered with StatusOK,
and a response to HTTP OPTIONS should not carry any contents.
2016-04-15 18:22:51 +02:00
Thomas Boerger
ef95173827
Dropped LinkedPath and updated browse template
As discussed with @mholt I have dropped the old LinkedPath function and
replaced it within the browse template with the new BreadcrumbMap
function. Visually it looks exactly the same as before, now the template
functionality is just more powerful.

Signed-off-by: Thomas Boerger <tboerger@suse.de>
2016-04-12 17:18:21 +02:00
Thomas Boerger
e0b63d92f4
Added breadcrumb map function to browse
In order to being able to really build a custom template for the browse
directive I have added another function to build even custom breadcrumb
paths. The other function `LinkedPath` is not that easy styleable as
this map function. That way we are able to build the breadcrumb path
matching different CSS frameworks like Bootstrap.

Signed-off-by: Thomas Boerger <thomas@webhippie.de>
2016-04-11 21:47:44 +02:00
Thomas Boerger
004a7f84ef Make test case less dependent on exact error string (#741) 2016-04-11 13:08:30 -06:00
Matt Holt
0a7ca64f53 gzipResponseWriter should also be a Flusher
To be consistent with 3faad41b43 and c64cf218b0
2016-04-11 00:24:26 -06:00
Tw
c64cf218b0 http.CloseNotifier implementation for http.ResponseWriter wrapper
Signed-off-by: Tw <tw19881113@gmail.com>
2016-04-11 14:10:33 +08:00
Matt Holt
6a7b777f14 panic if not a Flusher
Caddy recovers panics that occur in the middleware stack so this is not a risk to process termination. This way is also preferable to hiding the error. See 3faad41b43 (commitcomment-17035158)
2016-04-09 22:11:36 -06:00
Matthew Holt
3faad41b43
middleware: ResponseRecorder now is an http.Flusher (fixes #677)
Flush every 250ms. This should keep latency somewhat low but there is
still buffering; maybe in the future we can make this configurable.
2016-04-09 00:17:15 -06:00
Matt Holt
a14fce0b1e Merge pull request #707 from jupiter/caching-headers
Add Etag header
2016-04-03 15:01:33 -06:00
Pieter Raubenheimer
93d982a5a4 Improve readability and fully comply with RFC7232 2016-04-03 20:14:10 +01:00
Ruben Callewaert
1a9f700287 Allow mixed case Upgrade headers
Caddy expects websocket to be completely lowercase.
Some applications send websocket upgrade headers like the following:
`Upgrade: WebSocket`

This change allows all variations of websocket.
2016-04-03 17:48:53 +02:00
Pieter Raubenheimer
3441cdef64 Add Etag header 2016-04-02 08:51:08 +01:00
Craig Peterson
f28d8b8601 Adding some useful utility functions for templates 2016-03-28 20:53:51 -06:00
eiszfuchs
cbd9b814b9 fixed req.URL.Path for unix: sockets 2016-03-28 22:18:14 +02:00
buddhamagnet
61cf8b79bc drop unused md variable 2016-03-26 21:14:54 +00:00
buddhamagnet
bb6764fd22 drop unused len variable 2016-03-26 21:14:22 +00:00
buddhamagnet
c981b08b23 correct unused assignments 2016-03-26 21:05:19 +00:00
Marcelo E. Magallon
b94e513116 Add expvar middleware
Right now it has a very simple configuration:

	expvar /debug/vars

It will return a JSON object with memory statistics and the command line
used to start caddy, which are the two expvars that expvar registers by
default.
2016-03-21 21:46:41 -06:00
Matthew Holt
f23d8cb37f Add {upstream} placeholder when proxy middleware is used (closes #531)
Middlewares can now make their own placeholders that may be useful in
logging, on a per-request basis. Proxy is the first one to do this.
2016-03-20 21:56:13 -06:00
Abiola Ibrahim
e7001e6538 Add except to FastCGI. Minor refactor in proxy. 2016-03-20 08:02:17 +01:00
Matthew Holt
4d9741dda6 pprof: Only handle if path matches /debug/pprof, add tests 2016-03-19 20:02:05 -06:00
Abiola Ibrahim
9f9fbf2e1b Support for case insensitive paths using CASE_SENSITIVE_PATH environment variable. 2016-03-19 08:45:23 +01:00
Craig Peterson
640a0ef956 Adding pprof middleware for debugging purposes 2016-03-18 10:39:29 -06:00
Abiola Ibrahim
6b801b111b Merge pull request #684 from abiosoft/master
Fix for #659.
2016-03-18 07:08:24 +01:00
Matthew Holt
37d050922b Fix typo, clarify readme 2016-03-17 16:42:28 -06:00
Abiola Ibrahim
04514fb791 Fix for #659. 2016-03-17 22:29:58 +01:00
Matt Holt
4f5fe2de24 Merge pull request #662 from mholt/md-include-fix
markdown: Included files in Markdown templates have access to document vars
2016-03-16 13:56:06 -06:00
Matthew Holt
90c24d2f32 Included files in Markdown templates have access to document vars (fixes #660)
Refactor how middleware.Context includes files
2016-03-16 13:42:16 -06:00
Tobias Weingartner
b471b7e835 Fixup mime middleware to use a map and error on duplicate extensions.
- The mime middleware used filepath where it should arguably use path.
 - Changed the configuration to use a map instead of scanning an array
   during every request.  The map is static (after configuration), so
   should be fine for concurrent access.
 - Catch duplicate extensions within a configuration and error out.
 - Add tests for new error case.
2016-03-15 23:11:19 -07:00
Matt Holt
b79ff7403f Merge pull request #664 from jupiter/max-connections
proxy: Add max_conns parameter for per-host maximum connections
2016-03-14 15:25:44 -06:00
Matthew Holt
35e4c1a7bf Sanity checkL this defer does not leak fds; comment added 2016-03-12 16:32:12 -07:00
Abiola Ibrahim
25bfdfe92c Merge pull request #672 from abiosoft/master
Hide only the currently used Caddyfile
2016-03-12 20:46:20 +01:00
Abiola Ibrahim
008ad398ce Hopefully, this is the final nail on the coffin. 2016-03-12 17:47:53 +01:00
Abiola Ibrahim
e92a911e7d Add more tests. 2016-03-11 23:44:50 +01:00
Abiola Ibrahim
84845a66ab Fix broken build. 2016-03-11 23:11:21 +01:00
Abiola Ibrahim
f3a183ecc1 Use filepath.Clean for fileserver. 2016-03-11 15:39:13 +01:00
Shawn Smith
e958686ae4 capitalize struct name in comment 2016-03-11 23:16:28 +09:00
Pieter Raubenheimer
1f7d8d8ab0 Add test for UpstreamHost defaults 2016-03-10 14:45:23 +00:00
Pieter Raubenheimer
a7766c9033 Add common method for checking host availability 2016-03-10 14:42:19 +00:00
Pieter Raubenheimer
ce8ee831b3 Add check for per-host maximum connections 2016-03-08 16:25:05 +00:00