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

View file

@ -42,7 +42,7 @@
HttpServer *httpServer = NULL;
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
* handler */
HttpServerJoin(httpServer);
HttpServerFree(httpServer);
finish:
Log(lc, LOG_TASK, "Shutting down...");

View file

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