diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-01-19 20:45:27 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-01-20 15:06:58 +0100 |
commit | a2e0337875addaf08225fbf9b231435ba12a88b5 (patch) | |
tree | 2d8db845ca71eef64593bc564931d9f21fc1fe9b /src/import/import-raw.c | |
parent | 6c8f2e7d78b1fe280588dc91beae90cdf36fcd49 (diff) |
util: make http url validity checks more generic, and move them to util.c
Diffstat (limited to 'src/import/import-raw.c')
-rw-r--r-- | src/import/import-raw.c | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/src/import/import-raw.c b/src/import/import-raw.c index 80fdbb7781..486157aa96 100644 --- a/src/import/import-raw.c +++ b/src/import/import-raw.c @@ -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); -} |