This commit is contained in:
@@ -177,7 +177,7 @@ static bool contain(const char *src, const char *dest, int len)
|
||||
int restd_rest_handler(short event, restd_conn_t *conn, void *userdata)
|
||||
{
|
||||
int reason = RESTD_ERROR_PATH_NOT_FOUND;
|
||||
// DEBUG("restd_rest_handler: event 0x%x", event);
|
||||
DEBUG("********restd_rest_handler: event 0x%x", event);
|
||||
restd_http_t *http = (restd_http_t *)restd_conn_get_extra(conn);
|
||||
char *root_path;
|
||||
qlist_t *hooks = conn->server->hooks;
|
||||
|
||||
@@ -25,13 +25,47 @@
|
||||
|
||||
/*------------------------------- INCLUDES ----------------------------------*/
|
||||
|
||||
#include <event2/buffer.h>
|
||||
|
||||
#include "devices/devices_manager.h"
|
||||
|
||||
#include "rest_devices_handlers.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
int outlet_create_handler(short event, restd_conn_t *conn, void *userdata)
|
||||
{
|
||||
return 0;
|
||||
if (event & RESTD_EVENT_INIT)
|
||||
{
|
||||
printf("==> RESTD_EVENT_INIT");
|
||||
|
||||
// Attach to this connection.
|
||||
//ad_conn_set_userdata(conn, cdata, my_userdata_free_cb);
|
||||
}
|
||||
|
||||
else if (event & RESTD_EVENT_READ)
|
||||
{
|
||||
printf("==> RESTD_EVENT_READ");
|
||||
}
|
||||
|
||||
#if 0
|
||||
devices_manager_t *dm = (devices_manager_t *)userdata;
|
||||
struct evbuffer *buffer;
|
||||
|
||||
size_t size = 0;
|
||||
void *data = restd_http_get_content(conn, 0, &size);
|
||||
|
||||
printf(">>>>>>>>>>>>>>>>>>>> %ld\n", size);
|
||||
|
||||
restd_http_response(conn, 200, "application/json", data, size);
|
||||
|
||||
//restd_http_response(conn, 200, "application/json", "{\"status\":\"error\"}", 18);
|
||||
|
||||
return RESTD_CLOSE; // Close connection.
|
||||
|
||||
#endif
|
||||
// Return AD_OK will let the hook loop to continue.
|
||||
return RESTD_OK;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
@@ -57,6 +57,8 @@ int setup_rest_server(restd_server_t *rest_server, const char *port, const char
|
||||
restd_server_set_option(rest_server, "server.port", port);
|
||||
restd_server_set_option(rest_server, "server.root_path", root_path);
|
||||
|
||||
printf (">>>>>>>>>>\n");
|
||||
|
||||
restd_server_register_request_handler(rest_server, restd_rest_handler);
|
||||
restd_server_register_error_handler(rest_server, my_error_handler);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user