work in progress
[src/app-framework-binder.git] / src / http-svc.c
index 9fa6e84..9235bf8 100644 (file)
  */
 
 #define _GNU_SOURCE
-#include <microhttpd.h>
+
+#include <stdio.h>
+#include <string.h>
 #include <assert.h>
 #include <poll.h>
+#include <fcntl.h>
 #include <sys/stat.h>
 
-#include "../include/local-def.h"
+#include <microhttpd.h>
+
+#include "local-def.h"
 #include "afb-method.h"
 #include "afb-hreq.h"
 #include "afb-websock.h"
@@ -146,7 +151,7 @@ static struct AFB_clientCtx *afb_hreq_context(struct afb_hreq *hreq)
                        uuid = afb_hreq_get_argument(hreq, uuid_arg);
                if (uuid == NULL)
                        uuid = afb_hreq_get_cookie(hreq, uuid_cookie);
-               hreq->context = _ctxClientGet(uuid);
+               hreq->context = ctxClientGet(uuid);
        }
        return hreq->context;
 }
@@ -175,11 +180,11 @@ static int afb_hreq_rest_api(struct afb_hreq *hreq, void *data)
        const char *api, *verb;
        size_t lenapi, lenverb;
 
-       api = hreq->tail;
-       lenapi = strspn(api, "/");
-       verb = &hreq->tail[lenapi];
-       verb = &verb[strcspn(verb, "/")];
-       lenverb = strspn(verb, "/");
+       api = &hreq->tail[strspn(hreq->tail, "/")];
+       lenapi = strcspn(api, "/");
+       verb = &api[lenapi];
+       verb = &verb[strspn(verb, "/")];
+       lenverb = strcspn(verb, "/");
 
        if (!(*api && *verb && lenapi && lenverb))
                return 0;