summaryrefslogtreecommitdiff
path: root/src/import/import-job.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-01-21 20:03:57 +0100
committerLennart Poettering <lennart@poettering.net>2015-01-21 20:05:31 +0100
commitff2670ad11a1a29d483b7a246c95b159ddc1137c (patch)
tree2e040aa8272705fe4102d712f4e96480728b49fe /src/import/import-job.c
parent8b71fce8c2bb0e0a8c2317a34f8f114ff10e6aa6 (diff)
import: simplify dkr importer, by making use of generic import-job logic, used by the raw and tar importers
This gets us progress output as well xz/bzip2 support.
Diffstat (limited to 'src/import/import-job.c')
-rw-r--r--src/import/import-job.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/import/import-job.c b/src/import/import-job.c
index 337a5c5a22..cde40b0f97 100644
--- a/src/import/import-job.c
+++ b/src/import/import-job.c
@@ -573,6 +573,12 @@ static size_t import_job_header_callback(void *contents, size_t size, size_t nme
return sz;
}
+ if (j->on_header) {
+ r = j->on_header(j, contents, sz);
+ if (r < 0)
+ goto fail;
+ }
+
return sz;
fail:
@@ -672,10 +678,22 @@ int import_job_begin(ImportJob *j) {
if (!hdr)
return -ENOMEM;
- j->request_header = curl_slist_new(hdr, NULL);
- if (!j->request_header)
- return -ENOMEM;
+ if (!j->request_header) {
+ j->request_header = curl_slist_new(hdr, NULL);
+ if (!j->request_header)
+ return -ENOMEM;
+ } else {
+ struct curl_slist *l;
+
+ l = curl_slist_append(j->request_header, hdr);
+ if (!l)
+ return -ENOMEM;
+
+ j->request_header = l;
+ }
+ }
+ if (j->request_header) {
if (curl_easy_setopt(j->curl, CURLOPT_HTTPHEADER, j->request_header) != CURLE_OK)
return -EIO;
}