Commit Graph

36 Commits

Author SHA1 Message Date
Matthew Holt
a0c8428f8c Can issue and use SSL certs and serve sites
Code is a huge mess; much cleanup to follow.
2015-10-16 23:30:00 -06:00
Matthew Holt
0a1e472fc2 Merge branch 'configfix' into letsencrypt
Conflicts:
	config/config.go
2015-10-16 11:40:44 -06:00
Matthew Holt
4e92c71259 LE flags, modified tis directive, moved LE stuff to own file 2015-10-16 11:38:56 -06:00
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
691204ceed OncePerServerBlock may now return an error 2015-10-15 11:38:17 -06:00
Matthew Holt
e0fdddc73f Don't share sync.Once with all directives
If each server block had only one sync.Once then all directives would refer to it and only the first directive would be able to use it! So this commit changes it to a map of sync.Once instances, keyed by directive. So by creating a new map for every server block, each directive in that block can get its own sync.Once which is exactly what is needed. They won't step on each other this way.
2015-10-15 00:07:26 -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
79de2a5de2 Stubbed out basic code to obtain Let's Encrypt cert 2015-09-26 18:16:14 -06: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
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
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
d8391d6fbd core: Handle address lookup and bind errors more gracefully (fixes #136 and #164)
Addresses which fail to resolve are handled more gracefully in the two most common cases: the hostname doesn't resolve or the port is unknown (like "http" on a system that doesn't support that port name). If the hostname doesn't resolve, the host is served on the listener at host 0.0.0.0. If the port is unknown, we attempt to rewrite it as a number manually and try again.
2015-06-23 22:01:37 -06:00
Zac Bergquist
41e1f1ffa5 Update error strings (start with lowercase letters) 2015-06-07 20:49:17 -04:00
Zac Bergquist
e4b50aa814 Fix more lint warnings 2015-05-24 22:52:34 -04:00
Matthew Holt
ee754b4a47 Bug fixes 2015-05-21 00:40:05 -06:00
Matthew Holt
5f72b7438a Created app package, and better TLS compatibility with HTTP/2 2015-05-21 00:06:53 -06:00
Matthew Holt
21c26f48d0 Ensure a default root is always set in the configs 2015-05-05 15:48:40 -06:00
Matthew Holt
2dbd14b6dc Consistent app name/version info; pipe config data through stdin 2015-05-04 16:23:16 -06:00
Matthew Holt
995edf0566 Bringing in latest from master; refactoring under way 2015-05-04 11:02:46 -06:00
Matthew Holt
3bc4e84ed3 Default host is now 0.0.0.0 (wildcard)
Doesn't break using localhost to access the site
2015-04-29 22:30:03 -06:00
Matthew Holt
d00bb87f17 -port flag to override default port
Default port used if none is specified in config
2015-04-28 22:13:00 -06:00
Matthew Holt
24d9d23743 Default port is 2015 2015-04-25 14:28:56 -06:00
Matthew Holt
aa89b95075 Replaced cpu directive with command line flag 2015-04-24 20:08:14 -06:00
Matthew Holt
d088194585 Default port is now 80 2015-04-22 13:22:03 -06:00
Matthew Holt
7d96cfa424 Turn off log timestamp for parse errors (easier to read) 2015-04-15 23:17:56 -06:00
Matthew Holt
feec7c5b40 Virtual hosts and SNI support 2015-04-15 14:11:32 -06:00
Matthew Holt
b7c8afab2f Respond with 404 if requesting server's config file 2015-04-12 17:44:02 -06:00
Matthew Holt
2fbfafc408 New startup and shutdown directives 2015-03-26 09:52:03 -06:00
Matthew Holt
cdfc67db01 Some godoc 2015-03-21 11:04:08 -06:00
Matthew Holt
974acbf38c Partial support for location contexts in config files 2015-03-03 09:49:01 -07:00
Matthew Holt
fe1978c6f5 New 'cpu' directive; now uses all cores by default (if needed) 2015-01-21 14:10:52 -07:00
Matthew Holt
eae024027f Parser fixes, and now using base filename 2015-01-21 13:19:25 -07:00
Matthew Holt
24fc2ae59e Major refactoring; more modular middleware 2015-01-18 23:11:21 -07:00
Matthew Holt
4497a16fb0 Early prototype; initial commit 2015-01-13 12:43:45 -07:00