add response (with html + css)
This commit is contained in:
@@ -1,11 +1,7 @@
|
||||
#ifndef CWS_HTTP_H
|
||||
#define CWS_HTTP_H
|
||||
|
||||
#include <stdio.h> /* Debug */
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define WWW "../www/" /**< Directory used to get html files */
|
||||
#define WWW "../www" /**< Directory used to get html files */
|
||||
/** In the future I'll move conf stuff under a server struct, I can skip just because I want something that works */
|
||||
#define LOCATION_LEN 1024
|
||||
#define HTTP_VERSION_LEN 8
|
||||
@@ -25,6 +21,7 @@ enum http_method {
|
||||
typedef struct http {
|
||||
enum http_method method; /**< HTTP request method */
|
||||
char location[LOCATION_LEN]; /**< Resource requested */
|
||||
char location_path[LOCATION_LEN]; /**< Resource path */
|
||||
char http_version[HTTP_VERSION_LEN]; /**< HTTP version */
|
||||
char user_agent[USER_AGENT_LEN]; /**< User-Agent */
|
||||
char host[HOST_LEN]; /**< Host */
|
||||
@@ -42,7 +39,8 @@ typedef struct http {
|
||||
http_t *http_parse(char *request_str);
|
||||
|
||||
void http_parse_method(http_t *request, const char *method);
|
||||
void http_send_response(http_t *request, int sockfd);
|
||||
void http_get_content_type(http_t *request, char *content_type);
|
||||
void http_free(http_t *request);
|
||||
void http_send_response(http_t *request);
|
||||
|
||||
#endif
|
||||
@@ -16,9 +16,6 @@
|
||||
|
||||
#include "utils/hashmap.h"
|
||||
|
||||
/* On which port the server will run */
|
||||
#define PORT 3030
|
||||
|
||||
/* Clients max queue */
|
||||
#define BACKLOG 10
|
||||
|
||||
@@ -94,6 +91,4 @@ int handle_new_client(int sockfd, struct sockaddr_storage *their_sa, socklen_t *
|
||||
*/
|
||||
void close_fds(bucket_t *bucket);
|
||||
|
||||
void send_html_test(int sockfd);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
/**
|
||||
* @brief Hash map struct
|
||||
*
|
||||
*
|
||||
*/
|
||||
typedef struct bucket {
|
||||
int sockfd; /**< Client socket descriptor */
|
||||
|
||||
Reference in New Issue
Block a user