summaryrefslogtreecommitdiff
path: root/client.c
diff options
context:
space:
mode:
Diffstat (limited to 'client.c')
-rw-r--r--client.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/client.c b/client.c
index f6fdc4a..179825c 100644
--- a/client.c
+++ b/client.c
@@ -1,5 +1,5 @@
-#include <stdlib.h>
#include <stdbool.h>
+#include <stdlib.h>
#include "request.h"
#include "rtclient/client.h"
@@ -17,8 +17,12 @@ bool rtclient_init(const char *url)
#ifdef DEBUG
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
#endif
- server_url = malloc(strlen(url) + 1);
+ size_t length = strlen(url);
+ bool append = !(bool)(url[length - 1] == '/');
+ server_url = malloc(length + (size_t)append + 1);
strcpy(server_url, url);
+ if (append)
+ strcat(server_url, "/");
}
return (bool)curl;