#include "utf8.h"
#include "curl-util.h"
#include "qcow2-util.h"
-#include "import-raw.h"
#include "strv.h"
#include "copy.h"
+#include "import-util.h"
+#include "import-raw.h"
typedef struct RawImportFile RawImportFile;
free(f->temp_path);
}
+ lzma_end(&f->lzma);
free(f->url);
free(f->local);
free(f->etag);
if (converted_fd < 0)
return log_error_errno(errno, "Failed to create %s: %m", t);
+ log_info("Unpacking QCOW2 file.");
+
r = qcow2_convert(f->disk_fd, converted_fd);
if (r < 0) {
unlink(t);
return 0;
}
-static bool etag_is_valid(const char *etag) {
-
- if (!endswith(etag, "\""))
- return false;
-
- if (!startswith(etag, "\"") && !startswith(etag, "W/\""))
- return false;
-
- return true;
-}
-
static int raw_import_file_find_old_etags(RawImportFile *f) {
_cleanup_free_ char *escaped_url = NULL;
_cleanup_closedir_ DIR *d = NULL;
if (!u)
return -ENOMEM;
- if (!etag_is_valid(u)) {
+ if (!http_etag_is_valid(u)) {
free(u);
continue;
}
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))
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);
-}