summary refs log tree commit diff homepage
path: root/src/http.cr
diff options
context:
space:
mode:
Diffstat (limited to 'src/http.cr')
-rw-r--r--src/http.cr13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/http.cr b/src/http.cr
index ac688fb..912a46c 100644
--- a/src/http.cr
+++ b/src/http.cr
@@ -71,18 +71,17 @@ class Server
           if uri.scheme != "http" && uri.scheme != "https"
             next errors["opennic"] = "Must be HTTP/S"
           end
-          host = uri.host
-          unless OPENNIC_TLD.includes? Path[host].extension
+          unless OPENNIC_TLD.includes? Path[uri.host.not_nil!].extension
             next errors["opennic"] = "Must be under OpenNIC domain"
-          end if host
+          end
         when "icann"
           uri = URI.parse value
           next errors["icann"] = "Must be absolute URL" unless uri.absolute?
           next errors["icann"] = "Must be HTTPS" unless uri.scheme == "https"
-          host = uri.host # impractical to check for ICANN TLD
-          if OPENNIC_TLD.includes? Path[host].extension
+          # impractical to check for ICANN TLD
+          if OPENNIC_TLD.includes? Path[uri.host.not_nil!].extension
             next errors["icann"] = "Must not be under OpenNIC domain"
-          end if host
+          end
         when "host"
         else
           break invalid_param = true
@@ -110,7 +109,7 @@ class Server
         @db.add_applicant params["nick"], params["opennic"], params["icann"]
         # TODO: write feed
       else
-        context.response.status_code = 400 unless errors.empty?
+        context.response.status_code = 400
       end
       context.response.content_type = "application/xhtml+xml"
       if params["host"] == @opennic_host