summaryrefslogtreecommitdiff
path: root/src/import/import-job.c
diff options
context:
space:
mode:
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;
}