30#include "microhttpd.h"
39 return 0 == strncmp (
namespace, url, strlen (
namespace));
46 struct MHD_Response *resp;
56 resp = MHD_create_response_from_buffer (len,
58 MHD_RESPMEM_MUST_COPY);
74 while (NULL !=
handlers[count].method)
78 if (url[strlen (url) - 1] ==
'/')
79 url[strlen (url) - 1] =
'\0';
80 for (i = 0; i < count; i++)
84 if (strlen (url) < strlen (
handlers[i].
namespace))
89 handlers[i].proc (conn, (
const char *) url, cls);
struct GNUNET_MQ_MessageHandlers handlers[]
static char * data
The data to insert into the dht.
API for helper library to parse/create REST.
int int GNUNET_asprintf(char **buf, const char *format,...) __attribute__((format(printf
Like asprintf, just portable.
#define GNUNET_free(ptr)
Wrapper around free.
int GNUNET_REST_handle_request(struct GNUNET_REST_RequestHandle *conn, const struct GNUNET_REST_RequestHandler *handlers, struct GNUNET_REST_RequestHandlerError *err, void *cls)
int GNUNET_REST_namespace_match(const char *url, const char *namespace)
REST Utilities.
struct MHD_Response * GNUNET_REST_create_response(const char *data)
Create REST MHD response.
@ MHD_HTTP_BAD_REQUEST
Bad Request [RFC7231, Section 6.5.1].
const char * url
The url as string.
const char * method
The HTTP method as MHD value (see microhttpd.h)