diff options
author | Omar Polo <op@omarpolo.com> | 2023-06-05 16:18:57 +0000 |
---|---|---|
committer | Omar Polo <op@omarpolo.com> | 2023-06-05 16:18:57 +0000 |
commit | a01a91db06a943ef0cc8fbb7294786814a63b65c (patch) | |
tree | e3c2076b225b147c99df44957cf487d936486b33 /ge.c | |
parent | 9a821f8c0f04bf9135bff60cc3ae3f4d109a02ee (diff) |
move some server-related code to server.c
Diffstat (limited to 'ge.c')
-rw-r--r-- | ge.c | 16 |
1 files changed, 7 insertions, 9 deletions
@@ -41,6 +41,12 @@ static const struct option opts[] = { }; void +drop_priv(void) +{ + return; +} + +void load_local_cert(struct vhost *h, const char *hostname, const char *dir) { char *cert, *key; @@ -176,8 +182,7 @@ serve(const char *host, int port, const char *dir, struct tls *ctx) freeaddrinfo(res0); log_notice(NULL, "serving %s on port %d", dir, port); - loop(ctx, sock, -1, NULL); - return 0; + return server_main(ctx, NULL, sock, -1); } static __dead void @@ -241,10 +246,6 @@ main(int argc, char **argv) if (certs_dir == NULL) certs_dir = data_dir(); - if (load_default_mime(&conf.mime) == -1) - fatal("can't load default mime types"); - sort_mime(&conf.mime); - /* set up the implicit vhost and location */ host = xcalloc(1, sizeof(*host)); @@ -272,9 +273,6 @@ main(int argc, char **argv) free(tmp); } - if ((loc->dirfd = open(loc->dir, O_RDONLY|O_DIRECTORY)) == -1) - fatal("can't open %s", loc->dir); - /* setup tls */ if ((tlsconf = tls_config_new()) == NULL) |