diff --git a/url.go b/url.go index faedbbb..343cdbb 100644 --- a/url.go +++ b/url.go @@ -37,7 +37,7 @@ type Url struct { // an error (or nil). func MakeUrl(u string) (Url, error) { var out Url - re := regexp.MustCompile(`^((?Pgopher|telnet|http|https|gemini):\/\/)?(?P[\w\-\.\d]+)(?::(?P\d+)?)?(?:/(?P[01345679gIhisp])?)?(?P.*)?$`) + re := regexp.MustCompile(`^((?P[a-zA-Z]+):\/\/)?(?P[\w\-\.\d]+)(?::(?P\d+)?)?(?:/(?P[01345679gIhisp])?)?(?P.*)?$`) match := re.FindStringSubmatch(u) if valid := re.MatchString(u); !valid { @@ -58,6 +58,7 @@ func MakeUrl(u string) (Url, error) { out.Resource = match[i] } } + out.Scheme = strings.ToLower(out.Scheme) if out.Scheme == "" { out.Scheme = "gopher"