Rename Necronda server to Sesimos
This commit is contained in:
14
Makefile
14
Makefile
@ -11,16 +11,16 @@ packages:
|
|||||||
@echo "Finished downloading!"
|
@echo "Finished downloading!"
|
||||||
|
|
||||||
permit:
|
permit:
|
||||||
sudo setcap 'cap_net_bind_service=+ep' "$(shell pwd)/bin/necronda-server"
|
sudo setcap 'cap_net_bind_service=+ep' "$(shell pwd)/bin/sesimos"
|
||||||
|
|
||||||
compile:
|
compile:
|
||||||
@mkdir -p bin
|
@mkdir -p bin
|
||||||
$(CC) src/lib/*.c -o bin/libnecrondaserver.so --shared -fPIC $(CFLAGS) $(LIBS)
|
$(CC) src/lib/*.c -o bin/libsesimos.so --shared -fPIC $(CFLAGS) $(LIBS)
|
||||||
$(CC) src/server.c src/client.c -o bin/necronda-server $(CFLAGS) $(LIBS) \
|
$(CC) src/server.c src/client.c -o bin/sesimos $(CFLAGS) $(LIBS) \
|
||||||
-Lbin -lnecrondaserver -Wl,-rpath=$(shell pwd)/bin
|
-Lbin -lsesimos -Wl,-rpath=$(shell pwd)/bin
|
||||||
|
|
||||||
compile-prod:
|
compile-prod:
|
||||||
@mkdir -p bin
|
@mkdir -p bin
|
||||||
$(CC) src/lib/*.c -o bin/libnecrondaserver.so --shared -fPIC $(CFLAGS) $(LIBS) $(DEBIAN_OPTS) -O3
|
$(CC) src/lib/*.c -o bin/libsesimos.so --shared -fPIC $(CFLAGS) $(LIBS) $(DEBIAN_OPTS) -O3
|
||||||
$(CC) src/server.c src/client.c -o bin/necronda-server $(CFLAGS) $(LIBS) $(DEBIAN_OPTS) -O3 \
|
$(CC) src/server.c src/client.c -o bin/sesimos $(CFLAGS) $(LIBS) $(DEBIAN_OPTS) -O3 \
|
||||||
-Lbin -lnecrondaserver -Wl,-rpath=$(shell pwd)/bin
|
-Lbin -lsesimos -Wl,-rpath=$(shell pwd)/bin
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
Necronda web server
|
Sesimos – Secure, simple, modern web server
|
||||||
===================
|
===========================================
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
/**
|
/**
|
||||||
* Necronda Web Server
|
* sesimos - secure, simple, modern web server
|
||||||
* Client connection and request handlers
|
* Client connection and request handlers
|
||||||
* src/client.c
|
* src/client.c
|
||||||
* Lorenz Stechauner, 2020-12-03
|
* Lorenz Stechauner, 2020-12-03
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "necronda.h"
|
#include "defs.h"
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "server.h"
|
#include "server.h"
|
||||||
|
|
||||||
@ -374,7 +374,7 @@ int client_request_handler(sock *client, unsigned long client_num, unsigned int
|
|||||||
} else {
|
} else {
|
||||||
int mode;
|
int mode;
|
||||||
if (strcmp(uri.filename + strlen(uri.filename) - 4, ".ncr") == 0) {
|
if (strcmp(uri.filename + strlen(uri.filename) - 4, ".ncr") == 0) {
|
||||||
mode = FASTCGI_NECRONDA;
|
mode = FASTCGI_SESIMOS;
|
||||||
} else if (strcmp(uri.filename + strlen(uri.filename) - 4, ".php") == 0) {
|
} else if (strcmp(uri.filename + strlen(uri.filename) - 4, ".php") == 0) {
|
||||||
mode = FASTCGI_PHP;
|
mode = FASTCGI_PHP;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/**
|
/**
|
||||||
* Necronda Web Server
|
* sesimos - secure, simple, modern web server
|
||||||
* Client connection and request handlers (header file)
|
* Client connection and request handlers (header file)
|
||||||
* src/client.h
|
* src/client.h
|
||||||
* Lorenz Stechauner, 2022-08-16
|
* Lorenz Stechauner, 2022-08-16
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef NECRONDA_SERVER_NECRONDA_CLIENT_H
|
#ifndef SESIMOS_CLIENT_H
|
||||||
#define NECRONDA_SERVER_NECRONDA_CLIENT_H
|
#define SESIMOS_CLIENT_H
|
||||||
|
|
||||||
#include "lib/config.h"
|
#include "lib/config.h"
|
||||||
#include "lib/sock.h"
|
#include "lib/sock.h"
|
||||||
@ -17,4 +17,4 @@ host_config *get_host_config(const char *host);
|
|||||||
|
|
||||||
int client_handler(sock *client, unsigned long client_num, struct sockaddr_in6 *client_addr);
|
int client_handler(sock *client, unsigned long client_num, struct sockaddr_in6 *client_addr);
|
||||||
|
|
||||||
#endif //NECRONDA_SERVER_NECRONDA_CLIENT_H
|
#endif //SESIMOS_CLIENT_H
|
||||||
|
25
src/defs.h
Normal file
25
src/defs.h
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
/**
|
||||||
|
* sesimos - secure, simple, modern web server
|
||||||
|
* Definitions
|
||||||
|
* src/defs.h
|
||||||
|
* Lorenz Stechauner, 2021-05-04
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SESIMOS_DEF_H
|
||||||
|
#define SESIMOS_DEF_H
|
||||||
|
|
||||||
|
#define SERVER_VERSION "4.5"
|
||||||
|
#define SERVER_STR "Sesimos/" SERVER_VERSION
|
||||||
|
#define SERVER_STR_HTML "Sesimos web server " SERVER_VERSION
|
||||||
|
|
||||||
|
#define CHUNK_SIZE 8192
|
||||||
|
|
||||||
|
#ifndef DEFAULT_HOST
|
||||||
|
# define DEFAULT_HOST "www.necronda.net"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef SERVER_NAME
|
||||||
|
# define SERVER_NAME DEFAULT_HOST
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif //SESIMOS_DEF_H
|
@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Necronda Web Server
|
* sesimos - secure, simple, modern web server
|
||||||
* File cache implementation
|
* File cache implementation
|
||||||
* src/lib/cache.c
|
* src/lib/cache.c
|
||||||
* Lorenz Stechauner, 2020-12-19
|
* Lorenz Stechauner, 2020-12-19
|
||||||
@ -59,17 +59,17 @@ int cache_process() {
|
|||||||
}
|
}
|
||||||
cache = shm_rw;
|
cache = shm_rw;
|
||||||
|
|
||||||
if (mkdir("/var/necronda/", 0755) < 0 && errno != EEXIST) {
|
if (mkdir("/var/sesimos/", 0755) < 0 && errno != EEXIST) {
|
||||||
fprintf(stderr, ERR_STR "Unable to create directory '/var/necronda/': %s" CLR_STR "\n", strerror(errno));
|
fprintf(stderr, ERR_STR "Unable to create directory '/var/sesimos/': %s" CLR_STR "\n", strerror(errno));
|
||||||
return -3;
|
return -3;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mkdir("/var/necronda/server/", 0755) < 0 && errno != EEXIST) {
|
if (mkdir("/var/sesimos/server/", 0755) < 0 && errno != EEXIST) {
|
||||||
fprintf(stderr, ERR_STR "Unable to create directory '/var/necronda/server/': %s" CLR_STR "\n", strerror(errno));
|
fprintf(stderr, ERR_STR "Unable to create directory '/var/sesimos/server/': %s" CLR_STR "\n", strerror(errno));
|
||||||
return -3;
|
return -3;
|
||||||
}
|
}
|
||||||
|
|
||||||
FILE *cache_file = fopen("/var/necronda/server/cache", "rb");
|
FILE *cache_file = fopen("/var/sesimos/server/cache", "rb");
|
||||||
if (cache_file != NULL) {
|
if (cache_file != NULL) {
|
||||||
fread(cache, sizeof(cache_entry), CACHE_ENTRIES, cache_file);
|
fread(cache, sizeof(cache_entry), CACHE_ENTRIES, cache_file);
|
||||||
fclose(cache_file);
|
fclose(cache_file);
|
||||||
@ -104,13 +104,13 @@ int cache_process() {
|
|||||||
FILE *comp_file_gz = NULL;
|
FILE *comp_file_gz = NULL;
|
||||||
FILE *comp_file_br = NULL;
|
FILE *comp_file_br = NULL;
|
||||||
if (compress) {
|
if (compress) {
|
||||||
sprintf(buf, "%.*s/.necronda-server", cache[i].webroot_len, cache[i].filename);
|
sprintf(buf, "%.*s/.sesimos", cache[i].webroot_len, cache[i].filename);
|
||||||
if (mkdir(buf, 0755) != 0 && errno != EEXIST) {
|
if (mkdir(buf, 0755) != 0 && errno != EEXIST) {
|
||||||
fprintf(stderr, ERR_STR "Unable to create directory %s: %s" CLR_STR "\n", buf, strerror(errno));
|
fprintf(stderr, ERR_STR "Unable to create directory %s: %s" CLR_STR "\n", buf, strerror(errno));
|
||||||
goto comp_err;
|
goto comp_err;
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(buf, "%.*s/.necronda-server/cache", cache[i].webroot_len, cache[i].filename);
|
sprintf(buf, "%.*s/.sesimos/cache", cache[i].webroot_len, cache[i].filename);
|
||||||
if (mkdir(buf, 0700) != 0 && errno != EEXIST) {
|
if (mkdir(buf, 0700) != 0 && errno != EEXIST) {
|
||||||
fprintf(stderr, ERR_STR "Unable to create directory %s: %s" CLR_STR "\n", buf, strerror(errno));
|
fprintf(stderr, ERR_STR "Unable to create directory %s: %s" CLR_STR "\n", buf, strerror(errno));
|
||||||
goto comp_err;
|
goto comp_err;
|
||||||
@ -125,10 +125,10 @@ int cache_process() {
|
|||||||
buf[strlen(rel_path)] = 0;
|
buf[strlen(rel_path)] = 0;
|
||||||
|
|
||||||
p_len_gz = snprintf(filename_comp_gz, sizeof(filename_comp_gz),
|
p_len_gz = snprintf(filename_comp_gz, sizeof(filename_comp_gz),
|
||||||
"%.*s/.necronda-server/cache/%s.gz",
|
"%.*s/.sesimos/cache/%s.gz",
|
||||||
cache[i].webroot_len, cache[i].filename, buf);
|
cache[i].webroot_len, cache[i].filename, buf);
|
||||||
p_len_br = snprintf(filename_comp_br, sizeof(filename_comp_br),
|
p_len_br = snprintf(filename_comp_br, sizeof(filename_comp_br),
|
||||||
"%.*s/.necronda-server/cache/%s.br",
|
"%.*s/.sesimos/cache/%s.br",
|
||||||
cache[i].webroot_len, cache[i].filename, buf);
|
cache[i].webroot_len, cache[i].filename, buf);
|
||||||
if (p_len_gz < 0 || p_len_gz >= sizeof(filename_comp_gz) ||
|
if (p_len_gz < 0 || p_len_gz >= sizeof(filename_comp_gz) ||
|
||||||
p_len_br < 0 || p_len_br >= sizeof(filename_comp_br))
|
p_len_br < 0 || p_len_br >= sizeof(filename_comp_br))
|
||||||
@ -203,7 +203,7 @@ int cache_process() {
|
|||||||
|
|
||||||
if (cache_changed) {
|
if (cache_changed) {
|
||||||
cache_changed = 0;
|
cache_changed = 0;
|
||||||
cache_file = fopen("/var/necronda/server/cache", "wb");
|
cache_file = fopen("/var/sesimos/server/cache", "wb");
|
||||||
if (cache_file == NULL) {
|
if (cache_file == NULL) {
|
||||||
fprintf(stderr, ERR_STR "Unable to open cache file: %s" CLR_STR "\n", strerror(errno));
|
fprintf(stderr, ERR_STR "Unable to open cache file: %s" CLR_STR "\n", strerror(errno));
|
||||||
free(buf);
|
free(buf);
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/**
|
/**
|
||||||
* Necronda Web Server
|
* sesimos - secure, simple, modern web server
|
||||||
* File cache implementation (header file)
|
* File cache implementation (header file)
|
||||||
* src/lib/cache.h
|
* src/lib/cache.h
|
||||||
* Lorenz Stechauner, 2020-12-19
|
* Lorenz Stechauner, 2020-12-19
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef NECRONDA_SERVER_CACHE_H
|
#ifndef SESIMOS_CACHE_H
|
||||||
#define NECRONDA_SERVER_CACHE_H
|
#define SESIMOS_CACHE_H
|
||||||
|
|
||||||
#include "uri.h"
|
#include "uri.h"
|
||||||
|
|
||||||
@ -46,4 +46,4 @@ int cache_filename_comp_invalid(const char *filename);
|
|||||||
|
|
||||||
int uri_cache_init(http_uri *uri);
|
int uri_cache_init(http_uri *uri);
|
||||||
|
|
||||||
#endif //NECRONDA_SERVER_CACHE_H
|
#endif //SESIMOS_CACHE_H
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Necronda Web Server
|
* sesimos - secure, simple, modern web server
|
||||||
* Compression interface
|
* Compression interface
|
||||||
* src/lib/compress.c
|
* src/lib/compress.c
|
||||||
* Lorenz Stechauner, 2021-05-05
|
* Lorenz Stechauner, 2021-05-05
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/**
|
/**
|
||||||
* Necronda Web Server
|
* sesimos - secure, simple, modern web server
|
||||||
* Compression interface (header file)
|
* Compression interface (header file)
|
||||||
* src/lib/compress.h
|
* src/lib/compress.h
|
||||||
* Lorenz Stechauner, 2021-05-05
|
* Lorenz Stechauner, 2021-05-05
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef NECRONDA_SERVER_COMPRESS_H
|
#ifndef SESIMOS_COMPRESS_H
|
||||||
#define NECRONDA_SERVER_COMPRESS_H
|
#define SESIMOS_COMPRESS_H
|
||||||
|
|
||||||
#include <zlib.h>
|
#include <zlib.h>
|
||||||
#include <brotli/encode.h>
|
#include <brotli/encode.h>
|
||||||
@ -34,4 +34,4 @@ int compress_compress_mode(compress_ctx *ctx, int mode, const char *in, unsigned
|
|||||||
|
|
||||||
int compress_free(compress_ctx *ctx);
|
int compress_free(compress_ctx *ctx);
|
||||||
|
|
||||||
#endif //NECRONDA_SERVER_COMPRESS_H
|
#endif //SESIMOS_COMPRESS_H
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Necronda Web Server
|
* sesimos - secure, simple, modern web server
|
||||||
* Configuration file loader
|
* Configuration file loader
|
||||||
* src/lib/config.c
|
* src/lib/config.c
|
||||||
* Lorenz Stechauner, 2021-01-05
|
* Lorenz Stechauner, 2021-01-05
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/**
|
/**
|
||||||
* Necronda Web Server
|
* sesimos - secure, simple, modern web server
|
||||||
* Configuration file loader (header file)
|
* Configuration file loader (header file)
|
||||||
* src/lib/config.h
|
* src/lib/config.h
|
||||||
* Lorenz Stechauner, 2021-01-05
|
* Lorenz Stechauner, 2021-01-05
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef NECRONDA_SERVER_CONFIG_H
|
#ifndef SESIMOS_CONFIG_H
|
||||||
#define NECRONDA_SERVER_CONFIG_H
|
#define SESIMOS_CONFIG_H
|
||||||
|
|
||||||
#include "uri.h"
|
#include "uri.h"
|
||||||
|
|
||||||
@ -19,7 +19,7 @@
|
|||||||
#define CONFIG_TYPE_REVERSE_PROXY 2
|
#define CONFIG_TYPE_REVERSE_PROXY 2
|
||||||
|
|
||||||
#ifndef DEFAULT_CONFIG_FILE
|
#ifndef DEFAULT_CONFIG_FILE
|
||||||
# define DEFAULT_CONFIG_FILE "/etc/necronda/server.conf"
|
# define DEFAULT_CONFIG_FILE "/etc/sesimos/sesimos.conf"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -61,4 +61,4 @@ int config_load(const char *filename);
|
|||||||
|
|
||||||
int config_unload();
|
int config_unload();
|
||||||
|
|
||||||
#endif //NECRONDA_SERVER_CONFIG_H
|
#endif //SESIMOS_CONFIG_H
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Necronda Web Server
|
* sesimos - secure, simple, modern web server
|
||||||
* FastCGI interface implementation
|
* FastCGI interface implementation
|
||||||
* src/lib/fastcgi.c
|
* src/lib/fastcgi.c
|
||||||
* Lorenz Stechauner, 2020-12-26
|
* Lorenz Stechauner, 2020-12-26
|
||||||
@ -73,8 +73,8 @@ int fastcgi_init(fastcgi_conn *conn, int mode, unsigned int client_num, unsigned
|
|||||||
conn->socket = fcgi_sock;
|
conn->socket = fcgi_sock;
|
||||||
|
|
||||||
struct sockaddr_un sock_addr = {AF_UNIX};
|
struct sockaddr_un sock_addr = {AF_UNIX};
|
||||||
if (conn->mode == FASTCGI_NECRONDA) {
|
if (conn->mode == FASTCGI_SESIMOS) {
|
||||||
snprintf(sock_addr.sun_path, sizeof(sock_addr.sun_path) - 1, "%s", NECRONDA_BACKEND_SOCKET);
|
snprintf(sock_addr.sun_path, sizeof(sock_addr.sun_path) - 1, "%s", SESIMOS_BACKEND_SOCKET);
|
||||||
} else if (conn->mode == FASTCGI_PHP) {
|
} else if (conn->mode == FASTCGI_PHP) {
|
||||||
snprintf(sock_addr.sun_path, sizeof(sock_addr.sun_path) - 1, "%s", PHP_FPM_SOCKET);
|
snprintf(sock_addr.sun_path, sizeof(sock_addr.sun_path) - 1, "%s", PHP_FPM_SOCKET);
|
||||||
}
|
}
|
||||||
@ -344,7 +344,7 @@ int fastcgi_header(fastcgi_conn *conn, http_res *res, char *err_msg) {
|
|||||||
free(content);
|
free(content);
|
||||||
return 1;
|
return 1;
|
||||||
} else if (header.type == FCGI_STDERR) {
|
} else if (header.type == FCGI_STDERR) {
|
||||||
// TODO implement Necronda backend error handling
|
// TODO implement Sesimos backend error handling
|
||||||
if (conn->mode == FASTCGI_PHP) {
|
if (conn->mode == FASTCGI_PHP) {
|
||||||
err = err || fastcgi_php_error(conn, content, content_len, err_msg);
|
err = err || fastcgi_php_error(conn, content, content_len, err_msg);
|
||||||
}
|
}
|
||||||
@ -485,7 +485,7 @@ int fastcgi_send(fastcgi_conn *conn, sock *client, int flags) {
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
} else if (header.type == FCGI_STDERR) {
|
} else if (header.type == FCGI_STDERR) {
|
||||||
// TODO implement Necronda backend error handling
|
// TODO implement Sesimos backend error handling
|
||||||
if (conn->mode == FASTCGI_PHP) {
|
if (conn->mode == FASTCGI_PHP) {
|
||||||
fastcgi_php_error(conn, content, content_len, buf0);
|
fastcgi_php_error(conn, content, content_len, buf0);
|
||||||
}
|
}
|
||||||
@ -571,7 +571,7 @@ int fastcgi_dump(fastcgi_conn *conn, char *buf, long len) {
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
} else if (header.type == FCGI_STDERR) {
|
} else if (header.type == FCGI_STDERR) {
|
||||||
// TODO implement Necronda backend error handling
|
// TODO implement Sesimos backend error handling
|
||||||
if (conn->mode == FASTCGI_PHP) {
|
if (conn->mode == FASTCGI_PHP) {
|
||||||
fastcgi_php_error(conn, content, content_len, buf0);
|
fastcgi_php_error(conn, content, content_len, buf0);
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/**
|
/**
|
||||||
* Necronda Web Server
|
* sesimos - secure, simple, modern web server
|
||||||
* FastCGI interface implementation (header file)
|
* FastCGI interface implementation (header file)
|
||||||
* src/lib/fastcgi.h
|
* src/lib/fastcgi.h
|
||||||
* Lorenz Stechauner, 2020-12-26
|
* Lorenz Stechauner, 2020-12-26
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef NECRONDA_SERVER_FASTCGI_H
|
#ifndef SESIMOS_FASTCGI_H
|
||||||
#define NECRONDA_SERVER_FASTCGI_H
|
#define SESIMOS_FASTCGI_H
|
||||||
|
|
||||||
#include "include/fastcgi.h"
|
#include "include/fastcgi.h"
|
||||||
#include "http.h"
|
#include "http.h"
|
||||||
@ -19,13 +19,13 @@
|
|||||||
#define FASTCGI_COMPRESS_HOLD 8
|
#define FASTCGI_COMPRESS_HOLD 8
|
||||||
|
|
||||||
#define FASTCGI_PHP 1
|
#define FASTCGI_PHP 1
|
||||||
#define FASTCGI_NECRONDA 2
|
#define FASTCGI_SESIMOS 2
|
||||||
|
|
||||||
#ifndef PHP_FPM_SOCKET
|
#ifndef PHP_FPM_SOCKET
|
||||||
# define PHP_FPM_SOCKET "/var/run/php-fpm/php-fpm.sock"
|
# define PHP_FPM_SOCKET "/var/run/php-fpm/php-fpm.sock"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define NECRONDA_BACKEND_SOCKET "/var/run/necronda/necronda-backend.sock"
|
#define SESIMOS_BACKEND_SOCKET "/var/run/sesimos/backend.sock"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int mode;
|
int mode;
|
||||||
@ -54,4 +54,4 @@ int fastcgi_dump(fastcgi_conn *conn, char *buf, long len);
|
|||||||
|
|
||||||
int fastcgi_receive(fastcgi_conn *conn, sock *client, unsigned long len);
|
int fastcgi_receive(fastcgi_conn *conn, sock *client, unsigned long len);
|
||||||
|
|
||||||
#endif //NECRONDA_SERVER_FASTCGI_H
|
#endif //SESIMOS_FASTCGI_H
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Necronda Web Server
|
* sesimos - secure, simple, modern web server
|
||||||
* MaxMind GeoIP Database interface
|
* MaxMind GeoIP Database interface
|
||||||
* src/lib/geoip.c
|
* src/lib/geoip.c
|
||||||
* Lorenz Stechauner, 2021-05-04
|
* Lorenz Stechauner, 2021-05-04
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
/**
|
/**
|
||||||
* Necronda Web Server
|
* sesimos - secure, simple, modern web server
|
||||||
* MaxMind GeoIP Database interface (header file)
|
* MaxMind GeoIP Database interface (header file)
|
||||||
* src/lib/geoip.h
|
* src/lib/geoip.h
|
||||||
* Lorenz Stechauner, 2021-05-04
|
* Lorenz Stechauner, 2021-05-04
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef NECRONDA_SERVER_GEOIP_H
|
#ifndef SESIMOS_GEOIP_H
|
||||||
#define NECRONDA_SERVER_GEOIP_H
|
#define SESIMOS_GEOIP_H
|
||||||
|
|
||||||
#include <maxminddb.h>
|
#include <maxminddb.h>
|
||||||
|
|
||||||
@ -15,4 +15,4 @@
|
|||||||
|
|
||||||
MMDB_entry_data_list_s *mmdb_json(MMDB_entry_data_list_s *list, char *str, long *str_off, long str_len);
|
MMDB_entry_data_list_s *mmdb_json(MMDB_entry_data_list_s *list, char *str, long *str_off, long str_len);
|
||||||
|
|
||||||
#endif //NECRONDA_SERVER_GEOIP_H
|
#endif //SESIMOS_GEOIP_H
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Necronda Web Server
|
* sesimos - secure, simple, modern web server
|
||||||
* HTTP implementation
|
* HTTP implementation
|
||||||
* src/lib/http.c
|
* src/lib/http.c
|
||||||
* Lorenz Stechauner, 2020-12-09
|
* Lorenz Stechauner, 2020-12-09
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/**
|
/**
|
||||||
* Necronda Web Server
|
* sesimos - secure, simple, modern web server
|
||||||
* HTTP implementation (header file)
|
* HTTP implementation (header file)
|
||||||
* src/lib/http.h
|
* src/lib/http.h
|
||||||
* Lorenz Stechauner, 2020-12-09
|
* Lorenz Stechauner, 2020-12-09
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef NECRONDA_SERVER_HTTP_H
|
#ifndef SESIMOS_HTTP_H
|
||||||
#define NECRONDA_SERVER_HTTP_H
|
#define SESIMOS_HTTP_H
|
||||||
|
|
||||||
#include "sock.h"
|
#include "sock.h"
|
||||||
|
|
||||||
@ -39,11 +39,11 @@
|
|||||||
#define HTTP_MAX_HEADER_FIELD_NUM 64
|
#define HTTP_MAX_HEADER_FIELD_NUM 64
|
||||||
|
|
||||||
#ifndef SERVER_STR
|
#ifndef SERVER_STR
|
||||||
# define SERVER_STR "Necronda"
|
# define SERVER_STR "Sesimos"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef SERVER_STR_HTML
|
#ifndef SERVER_STR_HTML
|
||||||
# define SERVER_STR_HTML "Necronda web server"
|
# define SERVER_STR_HTML "Sesimos web server"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -179,4 +179,4 @@ const http_doc_info *http_get_status_info(const http_status *status);
|
|||||||
|
|
||||||
int http_get_compression(const http_req *req, const http_res *res);
|
int http_get_compression(const http_req *req, const http_res *res);
|
||||||
|
|
||||||
#endif //NECRONDA_SERVER_HTTP_H
|
#endif //SESIMOS_HTTP_H
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
/**
|
/**
|
||||||
* Necronda Web Server
|
* sesimos - secure, simple, modern web server
|
||||||
* HTTP static implementation
|
* HTTP static implementation
|
||||||
* src/lib/http_static.c
|
* src/lib/http_static.c
|
||||||
* Lorenz Stechauner, 2021-05-03
|
* Lorenz Stechauner, 2021-05-03
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../necronda.h"
|
#include "../defs.h"
|
||||||
#include "http.h"
|
#include "http.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/**
|
/**
|
||||||
* Necronda Web Server
|
* sesimos - secure, simple, modern web server
|
||||||
* FastCGI header file
|
* FastCGI header file
|
||||||
* src/lib/include/fastcgi.h
|
* src/lib/include/fastcgi.h
|
||||||
* Lorenz Stechauner, 2021-05-03
|
* Lorenz Stechauner, 2021-05-03
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef NECRONDA_SERVER_EXTERN_FASTCGI_H
|
#ifndef SESIMOS_EXTERN_FASTCGI_H
|
||||||
#define NECRONDA_SERVER_EXTERN_FASTCGI_H
|
#define SESIMOS_EXTERN_FASTCGI_H
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Listening socket file number
|
* Listening socket file number
|
||||||
@ -119,4 +119,4 @@ typedef struct {
|
|||||||
FCGI_UnknownTypeBody body;
|
FCGI_UnknownTypeBody body;
|
||||||
} FCGI_UnknownTypeRecord;
|
} FCGI_UnknownTypeRecord;
|
||||||
|
|
||||||
#endif //NECRONDA_SERVER_EXTERN_FASTCGI_H
|
#endif //SESIMOS_EXTERN_FASTCGI_H
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
/**
|
/**
|
||||||
* Necronda Web Server
|
* sesimos - secure, simple, modern web server
|
||||||
* Reverse proxy
|
* Reverse proxy
|
||||||
* src/lib/rev_proxy.c
|
* src/lib/rev_proxy.c
|
||||||
* Lorenz Stechauner, 2021-01-07
|
* Lorenz Stechauner, 2021-01-07
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../necronda.h"
|
#include "../defs.h"
|
||||||
#include "../server.h"
|
#include "../server.h"
|
||||||
#include "rev_proxy.h"
|
#include "rev_proxy.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/**
|
/**
|
||||||
* Necronda Web Server
|
* sesimos - secure, simple, modern web server
|
||||||
* Reverse proxy (header file)
|
* Reverse proxy (header file)
|
||||||
* src/lib/rev_proxy.h
|
* src/lib/rev_proxy.h
|
||||||
* Lorenz Stechauner, 2021-01-07
|
* Lorenz Stechauner, 2021-01-07
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef NECRONDA_SERVER_REV_PROXY_H
|
#ifndef SESIMOS_REV_PROXY_H
|
||||||
#define NECRONDA_SERVER_REV_PROXY_H
|
#define SESIMOS_REV_PROXY_H
|
||||||
|
|
||||||
#define REV_PROXY_CHUNKED 1
|
#define REV_PROXY_CHUNKED 1
|
||||||
#define REV_PROXY_COMPRESS_GZ 2
|
#define REV_PROXY_COMPRESS_GZ 2
|
||||||
@ -35,4 +35,4 @@ int rev_proxy_send(sock *client, unsigned long len_to_send, int flags);
|
|||||||
|
|
||||||
int rev_proxy_dump(char *buf, long len);
|
int rev_proxy_dump(char *buf, long len);
|
||||||
|
|
||||||
#endif //NECRONDA_SERVER_REV_PROXY_H
|
#endif //SESIMOS_REV_PROXY_H
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Necronda Web Server
|
* sesimos - secure, simple, modern web server
|
||||||
* Basic TCP and TLS socket
|
* Basic TCP and TLS socket
|
||||||
* src/lib/sock.c
|
* src/lib/sock.c
|
||||||
* Lorenz Stechauner, 2021-01-07
|
* Lorenz Stechauner, 2021-01-07
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/**
|
/**
|
||||||
* Necronda Web Server
|
* sesimos - secure, simple, modern web server
|
||||||
* Basic TCP and TLS socket (header file)
|
* Basic TCP and TLS socket (header file)
|
||||||
* src/lib/sock.h
|
* src/lib/sock.h
|
||||||
* Lorenz Stechauner, 2021-01-07
|
* Lorenz Stechauner, 2021-01-07
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef NECRONDA_SERVER_SOCK_H
|
#ifndef SESIMOS_SOCK_H
|
||||||
#define NECRONDA_SERVER_SOCK_H
|
#define SESIMOS_SOCK_H
|
||||||
|
|
||||||
#include <openssl/crypto.h>
|
#include <openssl/crypto.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
@ -44,4 +44,4 @@ int sock_poll_read(sock *sockets[], sock *readable[], int n_sock, int timeout_ms
|
|||||||
|
|
||||||
int sock_poll_write(sock *sockets[], sock *writable[], int n_sock, int timeout_ms);
|
int sock_poll_write(sock *sockets[], sock *writable[], int n_sock, int timeout_ms);
|
||||||
|
|
||||||
#endif //NECRONDA_SERVER_SOCK_H
|
#endif //SESIMOS_SOCK_H
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Necronda Web Server
|
* sesimos - secure, simple, modern web server
|
||||||
* URI and path handlers
|
* URI and path handlers
|
||||||
* src/lib/uri.c
|
* src/lib/uri.c
|
||||||
* Lorenz Stechauner, 2020-12-13
|
* Lorenz Stechauner, 2020-12-13
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/**
|
/**
|
||||||
* Necronda Web Server
|
* sesimos - secure, simple, modern web server
|
||||||
* URI and path handlers (header file)
|
* URI and path handlers (header file)
|
||||||
* src/lib/uri.h
|
* src/lib/uri.h
|
||||||
* Lorenz Stechauner, 2020-12-13
|
* Lorenz Stechauner, 2020-12-13
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef NECRONDA_SERVER_URI_H
|
#ifndef SESIMOS_URI_H
|
||||||
#define NECRONDA_SERVER_URI_H
|
#define SESIMOS_URI_H
|
||||||
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
@ -44,4 +44,4 @@ int uri_init_cache(http_uri *uri);
|
|||||||
|
|
||||||
void uri_free(http_uri *uri);
|
void uri_free(http_uri *uri);
|
||||||
|
|
||||||
#endif //NECRONDA_SERVER_URI_H
|
#endif //SESIMOS_URI_H
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Necronda Web Server
|
* sesimos - secure, simple, modern web server
|
||||||
* Utilities
|
* Utilities
|
||||||
* src/lib/utils.c
|
* src/lib/utils.c
|
||||||
* Lorenz Stechauner, 2020-12-03
|
* Lorenz Stechauner, 2020-12-03
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/**
|
/**
|
||||||
* Necronda Web Server
|
* sesimos - secure, simple, modern web server
|
||||||
* Utilities (header file)
|
* Utilities (header file)
|
||||||
* src/lib/utils.h
|
* src/lib/utils.h
|
||||||
* Lorenz Stechauner, 2020-12-03
|
* Lorenz Stechauner, 2020-12-03
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef NECRONDA_SERVER_UTILS_H
|
#ifndef SESIMOS_UTILS_H
|
||||||
#define NECRONDA_SERVER_UTILS_H
|
#define SESIMOS_UTILS_H
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
@ -52,4 +52,4 @@ int str_trim_lws(char **start, char **end);
|
|||||||
|
|
||||||
int base64_encode(void *data, unsigned long data_len, char *output, unsigned long *output_len);
|
int base64_encode(void *data, unsigned long data_len, char *output, unsigned long *output_len);
|
||||||
|
|
||||||
#endif //NECRONDA_SERVER_UTILS_H
|
#endif //SESIMOS_UTILS_H
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
/**
|
/**
|
||||||
* Necronda Web Server
|
* sesimos - secure, simple, modern web server
|
||||||
* WebSocket reverse proxy
|
* WebSocket reverse proxy
|
||||||
* src/lib/websocket.c
|
* src/lib/websocket.c
|
||||||
* Lorenz Stechauner, 2022-08-16
|
* Lorenz Stechauner, 2022-08-16
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../necronda.h"
|
#include "../defs.h"
|
||||||
#include "websocket.h"
|
#include "websocket.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/**
|
/**
|
||||||
* Necronda Web Server
|
* sesimos - secure, simple, modern web server
|
||||||
* WebSocket reverse proxy (header file)
|
* WebSocket reverse proxy (header file)
|
||||||
* src/lib/websocket.h
|
* src/lib/websocket.h
|
||||||
* Lorenz Stechauner, 2022-08-16
|
* Lorenz Stechauner, 2022-08-16
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef NECRONDA_SERVER_WEBSOCKET_H
|
#ifndef SESIMOS_WEBSOCKET_H
|
||||||
#define NECRONDA_SERVER_WEBSOCKET_H
|
#define SESIMOS_WEBSOCKET_H
|
||||||
|
|
||||||
#include "sock.h"
|
#include "sock.h"
|
||||||
|
|
||||||
@ -33,4 +33,4 @@ int ws_send_frame_header(sock *s, ws_frame *frame);
|
|||||||
|
|
||||||
int ws_handle_connection(sock *s1, sock *s2);
|
int ws_handle_connection(sock *s1, sock *s2);
|
||||||
|
|
||||||
#endif // NECRONDA_SERVER_WEBSOCKET_H
|
#endif //SESIMOS_WEBSOCKET_H
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
/**
|
|
||||||
* Necronda Web Server
|
|
||||||
* Definitions
|
|
||||||
* src/necronda.h
|
|
||||||
* Lorenz Stechauner, 2021-05-04
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef NECRONDA_SERVER_NECRONDA_H
|
|
||||||
#define NECRONDA_SERVER_NECRONDA_H
|
|
||||||
|
|
||||||
#define NECRONDA_VERSION "4.5"
|
|
||||||
#define SERVER_STR "Necronda/" NECRONDA_VERSION
|
|
||||||
#define SERVER_STR_HTML "Necronda web server " NECRONDA_VERSION
|
|
||||||
|
|
||||||
#define CHUNK_SIZE 8192
|
|
||||||
|
|
||||||
#ifndef DEFAULT_HOST
|
|
||||||
# define DEFAULT_HOST "www.necronda.net"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef SERVER_NAME
|
|
||||||
# define SERVER_NAME DEFAULT_HOST
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif //NECRONDA_SERVER_NECRONDA_H
|
|
10
src/server.c
10
src/server.c
@ -1,13 +1,13 @@
|
|||||||
/**
|
/**
|
||||||
* Necronda Web Server
|
* Sesimos - secure, simple, modern web server
|
||||||
* Main executable
|
* Main executable
|
||||||
* src/necronda-server.c
|
* src/server.c
|
||||||
* Lorenz Stechauner, 2020-12-03
|
* Lorenz Stechauner, 2020-12-03
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
#define _POSIX_C_SOURCE 199309L
|
||||||
|
|
||||||
#include "necronda.h"
|
#include "defs.h"
|
||||||
#include "server.h"
|
#include "server.h"
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
|
|
||||||
@ -178,7 +178,7 @@ int main(int argc, const char *argv[]) {
|
|||||||
fprintf(stderr, ERR_STR "Unable to set stdout to line-buffered mode: %s" CLR_STR, strerror(errno));
|
fprintf(stderr, ERR_STR "Unable to set stdout to line-buffered mode: %s" CLR_STR, strerror(errno));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
printf("Necronda Web Server " NECRONDA_VERSION "\n");
|
printf("Sesimos web server " SERVER_VERSION "\n");
|
||||||
|
|
||||||
ret = config_init();
|
ret = config_init();
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
@ -189,7 +189,7 @@ int main(int argc, const char *argv[]) {
|
|||||||
for (int i = 1; i < argc; i++) {
|
for (int i = 1; i < argc; i++) {
|
||||||
const char *arg = argv[i];
|
const char *arg = argv[i];
|
||||||
if (strcmp(arg, "-h") == 0 || strcmp(arg, "--help") == 0) {
|
if (strcmp(arg, "-h") == 0 || strcmp(arg, "--help") == 0) {
|
||||||
printf("Usage: necronda-server [-h] [-c <CONFIG-FILE>]\n"
|
printf("Usage: sesimos [-h] [-c <CONFIG-FILE>]\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Options:\n"
|
"Options:\n"
|
||||||
" -c, --config <CONFIG-FILE> path to the config file. If not provided, default will be used\n"
|
" -c, --config <CONFIG-FILE> path to the config file. If not provided, default will be used\n"
|
||||||
|
10
src/server.h
10
src/server.h
@ -1,12 +1,12 @@
|
|||||||
/**
|
/**
|
||||||
* Necronda Web Server
|
* sesimos - secure, simple, modern web server
|
||||||
* Main executable (header file)
|
* Main executable (header file)
|
||||||
* src/necronda-server.h
|
* src/server.h
|
||||||
* Lorenz Stechauner, 2020-12-03
|
* Lorenz Stechauner, 2020-12-03
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef NECRONDA_SERVER_SERVER_H
|
#ifndef SESIMOS_SERVER_H
|
||||||
#define NECRONDA_SERVER_SERVER_H
|
#define SESIMOS_SERVER_H
|
||||||
|
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <maxminddb.h>
|
#include <maxminddb.h>
|
||||||
@ -30,4 +30,4 @@ extern char *log_client_prefix, *log_conn_prefix, *log_req_prefix, *client_geoip
|
|||||||
extern char *client_addr_str, *client_addr_str_ptr, *server_addr_str, *server_addr_str_ptr, *client_host_str;
|
extern char *client_addr_str, *client_addr_str_ptr, *server_addr_str, *server_addr_str_ptr, *client_host_str;
|
||||||
extern struct timeval client_timeout;
|
extern struct timeval client_timeout;
|
||||||
|
|
||||||
#endif //NECRONDA_SERVER_SERVER_H
|
#endif //SESIMOS_SERVER_H
|
||||||
|
Reference in New Issue
Block a user