aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/caddy.go4
-rw-r--r--core/parse/parsing.go9
2 files changed, 11 insertions, 2 deletions
diff --git a/core/caddy.go b/core/caddy.go
index df84e679a..5b336a77e 100644
--- a/core/caddy.go
+++ b/core/caddy.go
@@ -390,8 +390,8 @@ type Input interface {
}
// TestServer returns a test server.
-// The port can be retreived with ... . The testserver itself can be stopped
-// with Stop(). It just takes a normal Corefile input, but doesn't use the port.
+// The ports can be retreived with server.LocalAddr(). The testserver itself can be stopped
+// with Stop(). It just takes a normal Corefile as input.
func TestServer(t *testing.T, corefile string) (*server.Server, error) {
cdyfile := CaddyfileInput{Contents: []byte(corefile)}
diff --git a/core/parse/parsing.go b/core/parse/parsing.go
index 6e73bd584..712695b22 100644
--- a/core/parse/parsing.go
+++ b/core/parse/parsing.go
@@ -1,6 +1,7 @@
package parse
import (
+ "fmt"
"net"
"os"
"path/filepath"
@@ -320,6 +321,14 @@ func standardAddress(str string) (address, error) {
// no error check here; return err at end of function
}
+ if len(host) > 255 {
+ return address{}, fmt.Errorf("specified address is too long: %d > 255", len(host))
+ }
+ _, d := dns.IsDomainName(host)
+ if !d {
+ return address{}, fmt.Errorf("host is not a valid domain: %s", host)
+ }
+
// see if we can set port based off scheme
if port == "" {
port = "53"