If file non existant crashing resolved
This commit is contained in:
35
http/http_server.h
Normal file
35
http/http_server.h
Normal file
@@ -0,0 +1,35 @@
|
||||
#ifndef HTTP_SERVER_H
|
||||
#define HTTP_SERVER_H
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#ifndef DEFAULT_HTML
|
||||
#define DEFAULT_HTML "index.html"
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
HTTP_SRS_RUNNING = 0,
|
||||
HTTP_SRS_SETUP,
|
||||
HTTP_SRS_STOPPED,
|
||||
HTTP_SRS_SOCKET_FAILED,
|
||||
HTTP_SRS_SETSOCKOPT_FAILED,
|
||||
HTTP_SRS_BIND_FAILED,
|
||||
HTTP_SRS_LISTEN_FAILED,
|
||||
HTTP_SRS_ACCEPT_FAILED,
|
||||
HTTP_SRS_READ_FAILED,
|
||||
HTTP_SRS_HANDLE_REQUEST_FAILED,
|
||||
} HttpServerRunStatus;
|
||||
|
||||
typedef struct {
|
||||
int port;
|
||||
int server_fd;
|
||||
unsigned int workers;
|
||||
struct sockaddr_in *address;
|
||||
} HttpServer;
|
||||
|
||||
HttpServerRunStatus http_server_setup(HttpServer *s);
|
||||
HttpServerRunStatus http_server_run(HttpServer *s);
|
||||
HttpServerRunStatus http_server_stop(HttpServer *s);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user