#include "http.h"
+static int debug = 1;
+
struct ucontent {
char *data;
size_t len;
void http_init()
{
- curl = curl_easy_init();
+ if (!curl)
+ curl = curl_easy_init();
}
void http_cleanup()
in = json_object_to_json_string(j);
out = http_get(url, in);
+
+ if (debug)
+ printf("HTTP request= %s\n",
+ json_object_to_json_string(j));
if (out) {
result = json_tokener_parse(out);
+ if (debug)
+ printf("HTTP reply= %s\n", out);
free(out);
return result;
- }
+ }
return NULL;
}