Fix compile and runtime errors

This commit is contained in:
Jordan Bancino 2022-08-26 20:15:27 -04:00
parent 1dc4261f6f
commit 43c46fd45c
3 changed files with 12 additions and 9 deletions

View file

@ -23,10 +23,12 @@
*/ */
#include <Http.h> #include <Http.h>
#include <string.h>
const char * const char *
HttpRequestMethodToString(const HttpStatus status) HttpRequestMethodToString(const HttpRequestMethod method)
{ {
switch (status) switch (method)
{ {
case HTTP_GET: case HTTP_GET:
return "GET"; return "GET";
@ -176,7 +178,7 @@ HttpStatusToString(const HttpStatus status)
case HTTP_EXPECTATION_FAILED: case HTTP_EXPECTATION_FAILED:
return "Expectation Failed"; return "Expectation Failed";
case HTTP_TEAPOT: case HTTP_TEAPOT:
return "I'm a Teapot": return "I'm a Teapot";
case HTTP_UPGRADE_REQUIRED: case HTTP_UPGRADE_REQUIRED:
return "Upgrade Required"; return "Upgrade Required";
case HTTP_PRECONDITION_REQUIRED: case HTTP_PRECONDITION_REQUIRED:

View file

@ -42,7 +42,7 @@
HttpServer *httpServer = NULL; HttpServer *httpServer = NULL;
static void static void
TelodendriaHttpHandler(HttpRequest * req, HttpResponse * res, void *args) TelodendriaHttpHandler(HttpServerContext *, void *args)
{ {
} }
@ -380,7 +380,6 @@ main(int argc, char **argv)
/* Block this thread until the server is terminated by a signal /* Block this thread until the server is terminated by a signal
* handler */ * handler */
HttpServerJoin(httpServer); HttpServerJoin(httpServer);
HttpServerFree(httpServer);
finish: finish:
Log(lc, LOG_TASK, "Shutting down..."); Log(lc, LOG_TASK, "Shutting down...");

View file

@ -26,10 +26,15 @@
#include <Http.h> #include <Http.h>
#include <stdio.h>
#include <HashMap.h> #include <HashMap.h>
typedef struct HttpServer HttpServer; typedef struct HttpServer HttpServer;
typedef struct HttpServerContext HttpServerContext;
typedef void (HttpHandler) (HttpServerContext *, void *);
extern HttpServer * extern HttpServer *
HttpServerCreate(unsigned short, unsigned int, unsigned int, HttpHandler *, void *); HttpServerCreate(unsigned short, unsigned int, unsigned int, HttpHandler *, void *);
@ -45,14 +50,11 @@ extern void
extern void extern void
HttpServerStop(HttpServer *); HttpServerStop(HttpServer *);
typedef struct HttpServerContext HttpServerContext;
typedef void (HttpHandler) (HttpServerContext *, void *);
extern HashMap * extern HashMap *
HttpRequestHeaders(HttpServerContext *); HttpRequestHeaders(HttpServerContext *);
extern HttpRequestMethod extern HttpRequestMethod
HttpRequestMethod(HttpServerContext *); HttpRequestMethodGet(HttpServerContext *);
extern char * extern char *
HttpRequestPath(HttpServerContext *); HttpRequestPath(HttpServerContext *);