chiark / gitweb /
util: make http url validity checks more generic, and move them to util.c
[elogind.git] / src / import / import-raw.c
index 80fdbb77819f8fa1a80931c4a678240ee6cfd35f..486157aa9676a7a1c1b61e0a1f11f382be070f24 100644 (file)
@@ -28,9 +28,9 @@
 #include "utf8.h"
 #include "curl-util.h"
 #include "qcow2-util.h"
-#include "import-raw.h"
 #include "strv.h"
 #include "copy.h"
+#include "import-raw.h"
 
 typedef struct RawImportFile RawImportFile;
 
@@ -904,7 +904,7 @@ int raw_import_pull(RawImport *import, const char *url, const char *local, bool
         int r;
 
         assert(import);
-        assert(raw_url_is_valid(url));
+        assert(http_url_is_valid(url));
         assert(!local || machine_name_is_valid(local));
 
         if (hashmap_get(import->files, url))
@@ -949,14 +949,3 @@ int raw_import_pull(RawImport *import, const char *url, const char *local, bool
         f = NULL;
         return 0;
 }
-
-bool raw_url_is_valid(const char *url) {
-        if (isempty(url))
-                return false;
-
-        if (!startswith(url, "http://") &&
-            !startswith(url, "https://"))
-                return false;
-
-        return ascii_is_valid(url);
-}