Commit Graph

12 Commits

Author SHA1 Message Date
Matthew Holt
2236780190 Add ServerBlockIndex and ServerBlockHosts to Controller
This way, Setup functions have access to the list of hosts that share the server block, and also, if needed for some reason, the index of the server block in the input
2015-10-15 23:34:54 -06:00
Matthew Holt
0c07f7adcc Epic revert of 0ac8bf5 and adding OncePerServerBlock
Turns out having each server block share a single server.Config during initialization when the Setup functions are being called was a bad idea. Sure, startup and shutdown functions were only executed once, but they had no idea what their hostname or port was. So here we revert to the old way of doing things where Setup may be called multiple times per server block (once per host associated with the block, to be precise), but the Setup functions now know their host and port since the config belongs to exactly one virtualHost. To have something happen just once per server block, use OncePerServerBlock, a new function available on each Controller.
2015-10-14 23:45:28 -06:00
Zac Bergquist
f9bc74626d Address various lint and gocyclo warnings. Fixes #253 2015-10-11 16:28:02 -04: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
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
Matthew Holt
d3c229375c Fixed import command, added tests 2015-07-07 22:38:48 -06:00
Matthew Holt
11ddb5c6ca Tests for the parser 2015-05-21 18:46:42 -06:00
Matthew Holt
b37fed4cc8 Beginning some tests for the parser 2015-05-21 16:31:01 -06:00
Matthew Holt
ee754b4a47 Bug fixes 2015-05-21 00:40:05 -06:00
Matthew Holt
5e8491cf7f Allow IPv6 address without port (fixes #80) 2015-05-20 20:15:39 -06:00
Matthew Holt
63ccc626f9 Fix parsing bug for one-line Caddyfiles 2015-05-06 08:58:15 -06:00
Matthew Holt
6029973bdc Major refactoring of middleware and parser in progress 2015-05-04 11:04:37 -06:00