summaryrefslogtreecommitdiff
path: root/src/libpiano
diff options
context:
space:
mode:
Diffstat (limited to 'src/libpiano')
-rw-r--r--src/libpiano/request.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/libpiano/request.c b/src/libpiano/request.c
index 6d0c8e5..cad0907 100644
--- a/src/libpiano/request.c
+++ b/src/libpiano/request.c
@@ -26,12 +26,11 @@ THE SOFTWARE.
#define _DARWIN_C_SOURCE /* strdup() on OS X */
#endif
+#include <curl/curl.h>
#include <json.h>
#include <assert.h>
#include <stdio.h>
#include <string.h>
-/* needed for urlencode */
-#include <waitress.h>
#include "piano.h"
#include "crypt.h"
@@ -100,13 +99,16 @@ PianoReturn_t PianoRequest (PianoHandle_t *ph, PianoRequest_t *req,
json_object_object_add (j, "syncTime",
json_object_new_int (timestamp));
- urlencAuthToken = WaitressUrlEncode (ph->partner.authToken);
+ CURL * const curl = curl_easy_init ();
+ urlencAuthToken = curl_easy_escape (curl,
+ ph->partner.authToken, 0);
assert (urlencAuthToken != NULL);
snprintf (req->urlPath, sizeof (req->urlPath),
PIANO_RPC_PATH "method=auth.userLogin&"
"auth_token=%s&partner_id=%i", urlencAuthToken,
ph->partner.id);
- free (urlencAuthToken);
+ curl_free (urlencAuthToken);
+ curl_easy_cleanup (curl);
break;
}
@@ -432,14 +434,17 @@ PianoReturn_t PianoRequest (PianoHandle_t *ph, PianoRequest_t *req,
assert (ph->user.authToken != NULL);
- urlencAuthToken = WaitressUrlEncode (ph->user.authToken);
+ CURL * const curl = curl_easy_init ();
+ urlencAuthToken = curl_easy_escape (curl,
+ ph->user.authToken, 0);
assert (urlencAuthToken != NULL);
snprintf (req->urlPath, sizeof (req->urlPath), PIANO_RPC_PATH
"method=%s&auth_token=%s&partner_id=%i&user_id=%s", method,
urlencAuthToken, ph->partner.id, ph->user.listenerId);
- free (urlencAuthToken);
+ curl_free (urlencAuthToken);
+ curl_easy_cleanup (curl);
json_object_object_add (j, "userAuthToken",
json_object_new_string (ph->user.authToken));