From 5bc891206dd8eb4e4df58f502b0184b8426caf22 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Thu, 10 Jul 2014 01:39:49 -0400 Subject: [PATCH] journal-remote: let user specify just the main part of the url We can append /upload ourselves. --- src/journal-remote/journal-upload.c | 10 +++++++++- src/journal-remote/journal-upload.h | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/journal-remote/journal-upload.c b/src/journal-remote/journal-upload.c index 95be9a0e2..c5a3e1907 100644 --- a/src/journal-remote/journal-upload.c +++ b/src/journal-remote/journal-upload.c @@ -396,7 +396,13 @@ static int setup_uploader(Uploader *u, const char *url, const char *state_file) memzero(u, sizeof(Uploader)); u->input = -1; - u->url = url; + if (!startswith(url, "http://") && !startswith(url, "https://")) + url = strappenda("https://", url); + + u->url = strappend(url, "/upload"); + if (!u->url) + return log_oom(); + u->state_file = state_file; r = sd_event_default(&u->events); @@ -424,6 +430,8 @@ static void destroy_uploader(Uploader *u) { free(u->last_cursor); free(u->current_cursor); + free(u->url); + u->input_event = sd_event_source_unref(u->input_event); close_fd_input(u); diff --git a/src/journal-remote/journal-upload.h b/src/journal-remote/journal-upload.h index 9ccad102a..3b46fa8cb 100644 --- a/src/journal-remote/journal-upload.h +++ b/src/journal-remote/journal-upload.h @@ -23,7 +23,7 @@ typedef struct Uploader { sd_event *events; sd_event_source *sigint_event, *sigterm_event; - const char *url; + char *url; CURL *easy; bool uploading; char error[CURL_ERROR_SIZE]; -- 2.30.2