diff options
author | ꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id> | 2019-09-07 17:51:50 +0800 |
---|---|---|
committer | ꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id> | 2019-09-07 17:51:50 +0800 |
commit | 3143fc2733736a52ed94e07827993fe32be90ff3 (patch) | |
tree | 1469e58e89bf8ba93857fb88b2293bf9bafbab9b | |
parent | 61465725017ac7e24c953b6d4b953a62ace8e1b4 (diff) |
Unified the get requests for now
-rw-r--r-- | rtclient.c | 14 |
1 files changed, 5 insertions, 9 deletions
@@ -63,8 +63,10 @@ void rtclient_login(const char *name, const char *password) #endif // DEBUG } -static inline void request(const char *url) +static inline void request(const char *path, const char *suffix) { + char url[strlen(server_url) + strlen(path) + strlen(suffix) + 1]; + sprintf(url, "%s%s%s", server_url, path, suffix); curl_easy_setopt(curl, CURLOPT_URL, url); curl_easy_setopt(curl, CURLOPT_HTTPGET, 1L); curl_easy_perform(curl); @@ -72,18 +74,12 @@ static inline void request(const char *url) void rtclient_user(const char *name) { - static const char *path = "/REST/1.0/user/"; - char url[strlen(server_url) + strlen(path) + strlen(name) + 1]; - sprintf(url, "%s%s%s", server_url, path, name); - request(url); + request("/REST/1.0/user/", name); } void rtclient_search(const char *query) { - static const char *path = "/REST/1.0/search/ticket?query="; - char url[strlen(server_url) + strlen(path) + strlen(query) + 1]; - sprintf(url, "%s%s%s", server_url, path, query); - request(url); + request("/REST/1.0/search/ticket?query=", query); } void rtclient_cleanup() |