7#ifndef JF_FRAMEWORK_HTTP_H
8#define JF_FRAMEWORK_HTTP_H
16 HTTP_SWITCHING_PROTOCOLS = 101,
17 HTTP_PROCESSING = 102,
22 HTTP_NO_CONTENT = 204,
23 HTTP_PARTIAL_CONTENT = 206,
25 HTTP_MULTIPLE_CHOICES = 300,
26 HTTP_MOVED_PERMANENTLY = 301,
29 HTTP_NOT_MODIFIED = 304,
30 HTTP_TEMPORARY_REDIRECT = 307,
31 HTTP_PERMANENT_REDIRECT = 308,
33 HTTP_BAD_REQUEST = 400,
34 HTTP_UNAUTHORIZED = 401,
37 HTTP_METHOD_NOT_ALLOWED = 405,
38 HTTP_REQUEST_TIMEOUT = 408,
41 HTTP_LENGTH_REQUIRED = 411,
42 HTTP_PAYLOAD_TOO_LARGE = 413,
43 HTTP_UNSUPPORTED_MEDIA_TYPE = 415,
44 HTTP_TOO_MANY_REQUESTS = 429,
46 HTTP_INTERNAL_SERVER_ERROR = 500,
47 HTTP_NOT_IMPLEMENTED = 501,
48 HTTP_BAD_GATEWAY = 502,
49 HTTP_SERVICE_UNAVAILABLE = 503,
50 HTTP_GATEWAY_TIMEOUT = 504,
51 HTTP_VERSION_NOT_SUPPORTED = 505
61 char contentType[128];
80 char contentType[128];
94JF_EXPORT
void jf_Send(
HttpResponse* httpResponse,
const char* contentType,
const char* body, HttpStatus status);
void jf_SendHTMLFile(HttpResponse *httpResponse, const char *path, HttpStatus status)
Wrapper for jf_Send.
Definition http.c:210
void jf_SendJson(HttpResponse *httpResponse, const char *json, HttpStatus status)
Wrapper for jf_Send.
Definition http.c:262
void jf_SendHTML(HttpResponse *httpResponse, const char *html, HttpStatus status)
Wrapper for jf_Send.
Definition http.c:253
uint32_t jf_AddHeader(HttpResponse *httpResponse, const char *name, const char *value)
Set HTTP response headers.
Definition http.c:283
const char * jf_GetParameter(const HttpRequest *httpRequest, const char *key)
Retreives parameter from http request.
Definition http.c:305
void jf_Send(HttpResponse *httpResponse, const char *contentType, const char *body, HttpStatus status)
Sends HTTP response.
Definition http.c:184
void jf_Redirect(HttpResponse *httpResponse, const char *destination, HttpStatus status)
Wrapper for jf_Send.
Definition http.c:271
void jf_SendString(HttpResponse *httpResponse, const char *string, HttpStatus status)
Wrapper for jf_Send.
Definition http.c:201
void jf_InitHttpResponse(HttpResponse *response)
Initializes response struct.
Definition http.c:118
uint32_t jf_SendHttpResponse(int32_t sockfd, const HttpResponse *response)
Sends HTTP response.
Definition http.c:139
uint32_t jf_ParseHttpRequest(HttpRequest *httpRequest, const char *buffer, size_t length)
Parses the HTTP request.
Definition http.c:26