Commit Graph

214 Commits

Author SHA1 Message Date
Zac Bergquist
f7fcd7447a Fix test failure on non-Windows OS.
NewTestController now sets the site root to '.' to accomodate Windows.  This introduced a failure on Linux because we join "." and an absolute path in /tmp/ and end up looking for the temp file in the wrong place.  This change puts the temp file under the current working directory, which should resolve the issue.
2015-10-13 20:16:43 -04:00
Zac Bergquist
e158cda057 Fix test failures on Windows.
Most of the Windows test failures are due to the path separator not being "/".  The general approach I took here was to keep paths in "URL form" (ie using "/" separators) as much as possible, and only convert to native paths when we attempt to open a file.  This will allow the most consistency between different host OS.  For example, data structures that store paths still store them with "/" delimiters.  Functions that accepted paths as input and return them as outputs still use "/".

There are still a few test failures that need to be sorted out.

- config/setup/TestRoot (I hear this has already been fixed by someone else)
- middleware/basicauth/TestBrowseTemplate and middleware/templates/Test (a line endings issue that I'm still working through)
2015-10-13 19:49:53 -04:00
Zac Bergquist
f9bc74626d Address various lint and gocyclo warnings. Fixes #253 2015-10-11 16:28:02 -04:00
Makpoc
e66aa25fce Fail the test if the configuration fails. 2015-10-10 04:15:25 +03:00
makpoc
af42d2a54a Add tests for root.go 2015-10-09 18:20:28 +03:00
pyed
bd14171b88 allow consecutive spaces for browse 2015-10-07 19:16:49 +03:00
Matt Holt
87efc67f48 Merge pull request #259 from abiosoft/master
New core middleware, MIME.
2015-10-01 09:56:56 -07:00
Abiola Ibrahim
9e2da6ec48 New core middleware, MIME. 2015-09-30 18:37:10 +01:00
Matthew Holt
3f9f675c43 redir: Include scheme in redirect rules
And added tests for status code and scheme
2015-09-30 08:38:31 -06:00
Matthew Holt
698399e61f Move controller_test.go into controller.go
Turns out the stuff in the test file needs to be exported so external add-ons can use them
2015-09-28 21:16:40 -06:00
Matthew Holt
4f5a29d6d1 errors: New 'visible' mode to write stack trace to response
Also updated change list and added/improved tests
2015-09-24 16:21:28 -06:00
Matthew Holt
10ab037833 Moved fileServer and browse.IndexPages into middleware package 2015-09-19 20:35:48 -06:00
Henrique Dias
4c642e9d3c browse IgnoreIndexes option 2015-09-17 20:37:49 +01:00
Alexander Morozov
1236e492a9 Fix format verbs for funcs
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-09-10 19:59:19 -07:00
Alexander Morozov
80db177f5a Fix vet warnings about unkeyed fields
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-09-10 19:57:23 -07:00
Alexander Morozov
3d1cac313c Use %v instead of %p to calm vet
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-09-10 19:52:23 -07:00
Alexander Morozov
da7b9a6bbc Use markdown.Config as pointer everywhere
* As value mutex was copied and therefore synchronization worked wrong
* It's pretty big structure with reference types, so copying create unnecessary
  pressure on GC

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-09-10 15:12:50 -07:00
Alexander Morozov
c468b114e4 Fix format call in tests
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-09-10 14:04:33 -07:00
Karthic Rao
ed4148f20e Complete test coverage for replacer for Go 2015-09-10 10:28:13 +05:30
Matthew Holt
4e1717db4c basicauth: htpasswd path now relative to site root 2015-09-05 16:04:30 -06:00
Matt Holt
159b68aab4 Merge pull request #228 from tgulacsi/htpasswd
basicauth: Add htpasswd support
2015-09-05 14:56:23 -06:00
Maxime
69950e57f0 Use localtime for the log roller timestamp 2015-09-04 19:18:01 +02:00
Alexander Morozov
b199825c3b Fix formatting directives in tests
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-09-04 08:34:58 -07:00
Maxime
bdcbd11d65 Merge branch 'master' of https://github.com/mholt/caddy 2015-09-02 15:16:06 +02:00
Maxime
008160998a Added LogRoller parser and entity.
The errors and logs can now have log rolling if provided by the user.
The current customisable parameter of it are:
The maximal size of the file before rolling.
The maximal age/time of the file before rolling.
The number of backups to keep.
2015-09-02 15:13:31 +02:00
Tamás Gulácsi
392f1d70eb Add htpasswd support for basic auth
If the password arg starts with htpasswd=, then the rest is treated as
the file name of the htpasswd file, and used for md5 and sha1 hashes.
2015-08-30 20:08:42 +02:00
Karthic Rao
679668e3c0 removed redundant comment lines 2015-08-30 18:57:20 +05:30
Maxime
bb5a322ce2 Added lumberjack library for log rolling 2015-08-08 16:13:10 +02:00
Matthew Holt
7796ff0f69 core: Disable TLS for http sites (again)
Fixes bug introduced in 0ac8bf5 - Also note that setup functions no longer have access to server port. Will need to fix later.
2015-08-05 11:33:51 -06:00
Matt Holt
afd6b7ea27 Merge pull request #210 from evermax/master
log, errors: Support system log (except Windows)

Specify log file of 'syslog' to output to system log
2015-08-05 10:25:49 -06:00
Matthew Holt
2e8a74ecff markdown: Prefix log messages, and slight refactor
Also change sha1 to md5 for the directory scans; slightly faster.
2015-08-05 08:15:52 -06:00
Matthew Holt
e4643f048a core: Bind all listeners to wildcard host by default (closes #208)
This behavior can still be overridden by bind directive
2015-08-05 07:37:51 -06:00
Abiola Ibrahim
3b910645e7 Markdown: generate static sites after links. 2015-08-05 09:55:04 +01:00
Abiola Ibrahim
1d3d705aae Markdown: Rename 'development' to 'dev' in config. 2015-08-05 00:49:42 +01:00
Abiola Ibrahim
2ab466599d Markdown: Modify development mode to generate links on page requests. 2015-08-05 00:41:04 +01:00
Abiola Ibrahim
851026d3fa Markdown: Watch for file changes. Removed sitegen dependency for links. 2015-08-04 23:35:09 +01:00
Matthew Holt
d8c50264cc Fix parser when address is empty token
Bug detected by go-fuzz (more fuzzing is required; need larger corpus)
2015-08-03 17:31:10 -06:00
Maxime
f1f1eb040a Changed the facility of syslog to be LOCAL0 2015-08-03 12:00:17 +02:00
Matthew Holt
e63b83c8c4 markdown: report errors during initial sitegen 2015-08-01 13:08:55 -06:00
Matthew Holt
0ac8bf58ea core: Run startup/shutdown functions only once
Even if defined for multiple hosts. Startup or shutdown callbacks registered by any directive (startup, shutdown, markdown, git, log, etc.) will only run as many times as it appears in the Caddyfile, not repeated for each host that shares that server block. Fixing this involved refactoring three packages (yeesh) and we need to restore some tests that are no longer valid (that used to verify splitting a multiServerBlock into multiple serverBlocks).
2015-08-01 13:08:31 -06:00
Maxime
7fb1c7e91d Change access log level to INFO 2015-07-30 22:01:15 +02:00
Maxime
4b92808bbf Add syslog support for log and errors directives 2015-07-30 20:29:41 +02:00
Maxime
ec51e14451 Merge branch 'master' of https://github.com/mholt/caddy 2015-07-29 23:43:26 +02:00
Maxime
0168a627a4 Added test on markdown static files generation 2015-07-29 16:21:35 +02:00
Abiola Ibrahim
e240cd5ba2 Metadata variables flattened.
Fix race condition on parsers.
Added page links generator.
2015-07-28 05:21:09 +01:00
Karthic Rao
094436c23a Complete Test set For config/setup/fastcgi.go 2015-07-27 20:19:20 +05:30
Matthew Holt
53b7b131cb Update change list, and note in comment 2015-07-25 15:18:10 -06:00
Matthew Holt
bec9b9a3f7 redir: Redirect tables
Open a redir block to bulk-specify a bunch of redirects that share a status code
2015-07-25 15:18:10 -06:00
Matt Holt
bf47951f3a Merge pull request #196 from evermax/master
markdown, browse: Integrated Context struct for templating
2015-07-25 15:15:51 -06:00
Karthic Rao
665f24d85f initial test for config/setup/fastcgi.go 2015-07-23 10:27:42 +05:30