+ task = talloc_zero(ctx, struct load_task);
+ task->url = url;
+ task->async = async_cb != NULL;
+ task->result = talloc_zero(ctx, struct load_url_result);
+ task->result->task = task;
+ task->result->url = url;
+ task->process = process_create(task);
+ if (task->async) {
+ task->async_cb = async_cb;
+ task->async_data = async_data;
+ task->process->exit_cb = load_url_process_exit;
+ task->process->data = task;
+ task->process->stdout_cb = stdout_cb;
+ task->process->stdout_data = stdout_data;
+ }
+
+ if (!stdout_cb && stdout_data && have_busybox())
+ task->process->stdout_cb = busybox_progress_cb;
+
+ /* Make sure we save output for any task that has a custom handler */
+ if (task->process->stdout_cb) {
+ task->process->add_stderr = true;
+ task->process->keep_stdout = true;
+ }
+
+ /* If the url is remote but network is not yet available queue up this
+ * load for later */
+ if (!system_info_network_available() && url->scheme != pb_url_file) {
+ pb_log("load task for %s queued pending network\n", url->full);
+ pending_network_jobs_add(task, flags);
+ task->result->status = LOAD_ASYNC;
+ return task->result;
+ }
+