From b8c3267b27e97951bb3ae5a918e0f3b77e48c202 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Tue, 28 Sep 2021 18:31:16 -0400 Subject: [PATCH] Put the site name and room name in the top header bar --- webcit-ng/ssl.c | 108 ++++++++++++++++------------------- webcit-ng/static.c | 10 ++-- webcit-ng/static/index.html | 7 ++- webcit-ng/static/js/views.js | 6 +- webcit-ng/tcp_sockets.c | 62 ++++++++++---------- webcit-ng/text2html.c | 24 +++----- webcit-ng/user_functions.c | 44 +++++--------- webcit-ng/util.c | 27 ++++----- webcit-ng/webserver.c | 49 +++++++--------- 9 files changed, 143 insertions(+), 194 deletions(-) diff --git a/webcit-ng/ssl.c b/webcit-ng/ssl.c index abc1e0ec7..b8d53d278 100644 --- a/webcit-ng/ssl.c +++ b/webcit-ng/ssl.c @@ -22,25 +22,20 @@ char *ssl_cipher_list = DEFAULT_SSL_CIPHER_LIST; void ssl_lock(int mode, int n, const char *file, int line); -/* - * OpenSSL wants a callback function to identify the currently running thread. - * Since we are a pthreads program, we convert the output of pthread_self() to a long. - */ -static unsigned long id_callback(void) -{ +// OpenSSL wants a callback function to identify the currently running thread. +// Since we are a pthreads program, we convert the output of pthread_self() to a long. +static unsigned long id_callback(void) { return (unsigned long) pthread_self(); } -/* - * OpenSSL wants a callback function to set and clear various types of locks. - * Since we are a pthreads program, we use mutexes. - */ -void ssl_lock(int mode, int n, const char *file, int line) -{ +// OpenSSL wants a callback function to set and clear various types of locks. +// Since we are a pthreads program, we use mutexes. +void ssl_lock(int mode, int n, const char *file, int line) { if (mode & CRYPTO_LOCK) { pthread_mutex_lock(SSLCritters[n]); - } else { + } + else { pthread_mutex_unlock(SSLCritters[n]); } } @@ -49,8 +44,7 @@ void ssl_lock(int mode, int n, const char *file, int line) /* * Generate a private key for SSL */ -void generate_key(char *keyfilename) -{ +void generate_key(char *keyfilename) { int ret = 0; RSA *rsa = NULL; BIGNUM *bne = NULL; @@ -80,14 +74,14 @@ void generate_key(char *keyfilename) fp = fopen(keyfilename, "w"); if (fp != NULL) { chmod(keyfilename, 0600); - if (PEM_write_RSAPrivateKey(fp, /* the file */ - rsa, /* the key */ - NULL, /* no enc */ - NULL, /* no passphr */ - 0, /* no passphr */ - NULL, /* no callbk */ - NULL /* no callbk */ - ) != 1) { + if (PEM_write_RSAPrivateKey(fp, // the file */ + rsa, // the key */ + NULL, // no enc */ + NULL, // no passphrase + 0, // no passphrase + NULL, // no callback + NULL // no callbk + ) != 1) { syslog(LOG_ERR, "crypto: cannot write key: %s", ERR_reason_error_string(ERR_get_error())); unlink(keyfilename); } @@ -100,11 +94,8 @@ void generate_key(char *keyfilename) } -/* - * Initialize ssl engine, load certs and initialize openssl internals - */ -void init_ssl(void) -{ +// Initialize ssl engine, load certs and initialize openssl internals +void init_ssl(void) { const SSL_METHOD *ssl_method; RSA *rsa = NULL; X509_REQ *req = NULL; @@ -120,7 +111,8 @@ void init_ssl(void) if (!SSLCritters) { syslog(LOG_ERR, "citserver: can't allocate memory!!"); exit(1); - } else { + } + else { int a; for (a = 0; a < CRYPTO_num_locks(); a++) { SSLCritters[a] = malloc(sizeof(pthread_mutex_t)); @@ -132,9 +124,7 @@ void init_ssl(void) } } - /* - * Initialize SSL transport layer - */ + // Initialize SSL transport layer SSL_library_init(); SSL_load_error_strings(); ssl_method = SSLv23_server_method(); @@ -152,22 +142,16 @@ void init_ssl(void) CRYPTO_set_locking_callback(ssl_lock); CRYPTO_set_id_callback(id_callback); - /* - * Get our certificates in order. - * First, create the key/cert directory if it's not there already... - */ + // Get our certificates in order. + // First, create the key/cert directory if it's not there already... mkdir(CTDL_CRYPTO_DIR, 0700); - /* - * If we still don't have a private key, generate one. - */ + // If we still don't have a private key, generate one. generate_key(CTDL_KEY_PATH); - /* - * If there is no certificate file on disk, we will be generating a self-signed certificate - * in the next step. Therefore, if we have neither a CSR nor a certificate, generate - * the CSR in this step so that the next step may commence. - */ + // If there is no certificate file on disk, we will be generating a self-signed certificate + // in the next step. Therefore, if we have neither a CSR nor a certificate, generate + // the CSR in this step so that the next step may commence. if ((access(CTDL_CER_PATH, R_OK) != 0) && (access(CTDL_CSR_PATH, R_OK) != 0)) { syslog(LOG_INFO, "Generating a certificate signing request."); @@ -205,14 +189,16 @@ void init_ssl(void) /* Sign the CSR */ if (!X509_REQ_sign(req, pk, EVP_md5())) { syslog(LOG_WARNING, "X509_REQ_sign(): error"); - } else { + } + else { /* Write it to disk. */ fp = fopen(CTDL_CSR_PATH, "w"); if (fp != NULL) { chmod(CTDL_CSR_PATH, 0600); PEM_write_X509_REQ(fp, req); fclose(fp); - } else { + } + else { syslog(LOG_WARNING, "Cannot write key: %s", CTDL_CSR_PATH); exit(1); } @@ -221,7 +207,8 @@ void init_ssl(void) } } RSA_free(rsa); - } else { + } + else { syslog(LOG_WARNING, "Unable to read private key."); } } @@ -271,13 +258,15 @@ void init_ssl(void) /* Sign the cert */ if (!X509_sign(cer, pk, EVP_md5())) { syslog(LOG_WARNING, "X509_sign(): error"); - } else { /* Write it to disk. */ + } + else { /* Write it to disk. */ fp = fopen(CTDL_CER_PATH, "w"); if (fp != NULL) { chmod(CTDL_CER_PATH, 0600); PEM_write_X509(fp, cer); fclose(fp); - } else { + } + else { syslog(LOG_WARNING, "Cannot write key: %s", CTDL_CER_PATH); exit(1); } @@ -306,8 +295,7 @@ void init_ssl(void) /* * starts SSL/TLS encryption for the current session. */ -void starttls(struct client_handle *ch) -{ +void starttls(struct client_handle *ch) { int retval, bits, alg_bits; if (!ssl_ctx) { @@ -331,7 +319,8 @@ void starttls(struct client_handle *ch) ssl_error_reason = ERR_reason_error_string(ERR_get_error()); if (ssl_error_reason == NULL) { syslog(LOG_WARNING, "SSL_accept failed: errval=%ld, retval=%d %s", errval, retval, strerror(errval)); - } else { + } + else { syslog(LOG_WARNING, "SSL_accept failed: %s\n", ssl_error_reason); } sleep(1); @@ -345,13 +334,15 @@ void starttls(struct client_handle *ch) ssl_error_reason = ERR_reason_error_string(ERR_get_error()); if (ssl_error_reason == NULL) { syslog(LOG_WARNING, "SSL_accept failed: errval=%ld, retval=%d (%s)", errval, retval, strerror(errval)); - } else { + } + else { syslog(LOG_WARNING, "SSL_accept failed: %s", ssl_error_reason); } SSL_free(ch->ssl_handle); ch->ssl_handle = NULL; return; - } else { + } + else { syslog(LOG_INFO, "SSL_accept success"); } bits = SSL_CIPHER_get_bits(SSL_get_current_cipher(ch->ssl_handle), &alg_bits); @@ -366,8 +357,7 @@ void starttls(struct client_handle *ch) /* * shuts down the TLS connection */ -void endtls(struct client_handle *ch) -{ +void endtls(struct client_handle *ch) { syslog(LOG_INFO, "Ending SSL/TLS"); if (ch->ssl_handle != NULL) { SSL_shutdown(ch->ssl_handle); @@ -381,8 +371,7 @@ void endtls(struct client_handle *ch) /* * Send binary data to the client encrypted. */ -int client_write_ssl(struct client_handle *ch, char *buf, int nbytes) -{ +int client_write_ssl(struct client_handle *ch, char *buf, int nbytes) { int retval; int nremain; char junk[1]; @@ -422,8 +411,7 @@ int client_write_ssl(struct client_handle *ch, char *buf, int nbytes) /* * read data from the encrypted layer. */ -int client_read_ssl(struct client_handle *ch, char *buf, int nbytes) -{ +int client_read_ssl(struct client_handle *ch, char *buf, int nbytes) { int bytes_read = 0; int rlen = 0; char junk[1]; diff --git a/webcit-ng/static.c b/webcit-ng/static.c index eb5d9c185..bd8d3cda8 100644 --- a/webcit-ng/static.c +++ b/webcit-ng/static.c @@ -16,11 +16,8 @@ #include "webcit.h" -/* - * Called from perform_request() to handle the /ctdl/s/ prefix -- always static content. - */ -void output_static(struct http_transaction *h) -{ +// Called from perform_request() to handle the /ctdl/s/ prefix -- always static content. +void output_static(struct http_transaction *h) { char filename[PATH_MAX]; struct stat statbuf; @@ -42,7 +39,8 @@ void output_static(struct http_transaction *h) h->response_body = malloc(h->response_body_length); if (h->response_body != NULL) { fread(h->response_body, h->response_body_length, 1, fp); - } else { + } + else { h->response_body_length = 0; } fclose(fp); // Content is now in memory. diff --git a/webcit-ng/static/index.html b/webcit-ng/static/index.html index a36787f2b..81b45b27e 100644 --- a/webcit-ng/static/index.html +++ b/webcit-ng/static/index.html @@ -19,11 +19,16 @@ diff --git a/webcit-ng/static/js/views.js b/webcit-ng/static/js/views.js index e6fde7a2d..00f68b0b1 100644 --- a/webcit-ng/static/js/views.js +++ b/webcit-ng/static/js/views.js @@ -168,12 +168,12 @@ function forum_render_one(div, msgnum, scroll_to) { + "" // end avatar + "
" // begin content + "
" // begin header - + "" // FIXME link to user profile + + "" // FIXME link to user profile + msg.from - + " " + + "" + "" + msg.time - + " " + + "" + "
" // end header + "
" // begin body + msg.text diff --git a/webcit-ng/tcp_sockets.c b/webcit-ng/tcp_sockets.c index e47b1bc7a..1e005a546 100644 --- a/webcit-ng/tcp_sockets.c +++ b/webcit-ng/tcp_sockets.c @@ -15,12 +15,9 @@ #include "webcit.h" -/* - * lingering_close() a`la Apache. see - * http://httpd.apache.org/docs/2.0/misc/fin_wait_2.html for rationale - */ -int lingering_close(int fd) -{ +// lingering_close() a`la Apache. see +// http://httpd.apache.org/docs/2.0/misc/fin_wait_2.html for rationale +int lingering_close(int fd) { char buf[SIZ]; int i; fd_set set; @@ -54,16 +51,13 @@ int lingering_close(int fd) } -/* - * This is a generic function to set up a master socket for listening on - * a TCP port. The server shuts down if the bind fails. (IPv4/IPv6 version) - * - * ip_addr IP address to bind - * port_number port number to bind - * queue_len number of incoming connections to allow in the queue - */ -int webcit_tcp_server(const char *ip_addr, int port_number, int queue_len) -{ +// This is a generic function to set up a master socket for listening on +// a TCP port. The server shuts down if the bind fails. (IPv4/IPv6 version) +// +// ip_addr IP address to bind +// port_number port number to bind +// queue_len number of incoming connections to allow in the queue +int webcit_tcp_server(const char *ip_addr, int port_number, int queue_len) { const char *ipv4broadcast = "0.0.0.0"; int IsDefault = 0; struct protoent *p; @@ -72,29 +66,32 @@ int webcit_tcp_server(const char *ip_addr, int port_number, int queue_len) int s, i, b; int ip_version = 6; - retry: +retry: memset(&sin6, 0, sizeof(sin6)); memset(&sin4, 0, sizeof(sin4)); sin6.sin6_family = AF_INET6; sin4.sin_family = AF_INET; - if ((ip_addr == NULL) /* any IPv6 */ - ||(IsEmptyStr(ip_addr)) - || (!strcmp(ip_addr, "*")) - ) { + if ( (ip_addr == NULL) // any IPv6 + || (IsEmptyStr(ip_addr)) + || (!strcmp(ip_addr, "*")) + ) { IsDefault = 1; ip_version = 6; sin6.sin6_addr = in6addr_any; - } else if (!strcmp(ip_addr, "0.0.0.0")) { /* any IPv4 */ + } + else if (!strcmp(ip_addr, "0.0.0.0")) { // any IPv4 ip_version = 4; sin4.sin_addr.s_addr = INADDR_ANY; - } else if ((strchr(ip_addr, '.')) && (!strchr(ip_addr, ':'))) { /* specific IPv4 */ + } + else if ((strchr(ip_addr, '.')) && (!strchr(ip_addr, ':'))) { // specific IPv4 ip_version = 4; if (inet_pton(AF_INET, ip_addr, &sin4.sin_addr) <= 0) { syslog(LOG_WARNING, "Error binding to [%s] : %s\n", ip_addr, strerror(errno)); return (-1); } - } else { /* specific IPv6 */ + } + else { // specific IPv6 ip_version = 6; if (inet_pton(AF_INET6, ip_addr, &sin6.sin6_addr) <= 0) { @@ -122,13 +119,15 @@ int webcit_tcp_server(const char *ip_addr, int port_number, int queue_len) syslog(LOG_WARNING, "Can't create a listening socket: %s\n", strerror(errno)); return (-1); } - /* Set some socket options that make sense. */ + + // Set some socket options that make sense. i = 1; setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &i, sizeof(i)); if (ip_version == 6) { b = bind(s, (struct sockaddr *) &sin6, sizeof(sin6)); - } else { + } + else { b = bind(s, (struct sockaddr *) &sin4, sizeof(sin4)); } @@ -147,13 +146,10 @@ int webcit_tcp_server(const char *ip_addr, int port_number, int queue_len) } -/* - * Create a Unix domain socket and listen on it - * sockpath - file name of the unix domain socket - * queue_len - Number of incoming connections to allow in the queue - */ -int webcit_uds_server(char *sockpath, int queue_len) -{ +// Create a Unix domain socket and listen on it +// sockpath - file name of the unix domain socket +// queue_len - Number of incoming connections to allow in the queue +int webcit_uds_server(char *sockpath, int queue_len) { struct sockaddr_un addr; int s; int i; diff --git a/webcit-ng/text2html.c b/webcit-ng/text2html.c index 9f85e1271..44053abe8 100644 --- a/webcit-ng/text2html.c +++ b/webcit-ng/text2html.c @@ -16,11 +16,8 @@ #include "webcit.h" -/* - * Convert a text/plain message to text/html - */ -StrBuf *text2html(const char *supplied_charset, int treat_as_wiki, char *roomname, long msgnum, StrBuf * Source) -{ +// Convert a text/plain message to text/html +StrBuf *text2html(const char *supplied_charset, int treat_as_wiki, char *roomname, long msgnum, StrBuf * Source) { StrBuf *sj = NULL; sj = NewStrBuf(); @@ -36,11 +33,8 @@ StrBuf *text2html(const char *supplied_charset, int treat_as_wiki, char *roomnam } -/* - * Convert a text/x-citadel-variformat message to text/html - */ -StrBuf *variformat2html(StrBuf * Source) -{ +// Convert a text/x-citadel-variformat message to text/html +StrBuf *variformat2html(StrBuf * Source) { StrBuf *Target = NULL; Target = NewStrBuf(); @@ -82,11 +76,9 @@ StrBuf *variformat2html(StrBuf * Source) } } - /* - * Quoted text should be displayed in italics and in a - * different colour. This code understands Citadel-style - * " >" quotes and will convert to
tags. - */ + // Quoted text should be displayed in italics and in a + // different colour. This code understands Citadel-style + // " >" quotes and will convert to
tags. if (i > 0) StrBufCutLeft(Line, i); @@ -99,7 +91,7 @@ StrBuf *variformat2html(StrBuf * Source) if (StrLength(Line) == 0) continue; - /* Activate embedded URL's */ + // Activate embedded URL's UrlizeText(Line1, Line, Line2); StrEscAppend(Target, Line1, NULL, 0, 0); diff --git a/webcit-ng/user_functions.c b/webcit-ng/user_functions.c index 579a4dbd0..a0519d627 100644 --- a/webcit-ng/user_functions.c +++ b/webcit-ng/user_functions.c @@ -16,11 +16,8 @@ #include "webcit.h" -/* - * Fetch a user photo (avatar) - */ -void fetch_user_photo(struct http_transaction *h, struct ctdlsession *c, char *username) -{ +// Fetch a user photo (avatar) +void fetch_user_photo(struct http_transaction *h, struct ctdlsession *c, char *username) { char buf[1024]; int content_length = 0; char content_type[1024]; @@ -52,20 +49,14 @@ void fetch_user_photo(struct http_transaction *h, struct ctdlsession *c, char *u } -/* - * Fetch a user bio (profile) - */ -void fetch_user_bio(struct http_transaction *h, struct ctdlsession *c, char *username) -{ +// Fetch a user bio (profile) +void fetch_user_bio(struct http_transaction *h, struct ctdlsession *c, char *username) { do_404(h); // FIXME finish this } -/* - * Client requested an object related to a user. - */ -void object_in_user(struct http_transaction *h, struct ctdlsession *c, char *requested_username) -{ +// Client requested an object related to a user. +void object_in_user(struct http_transaction *h, struct ctdlsession *c, char *requested_username) { char object_name[1024]; extract_token(object_name, h->uri, 4, '/', sizeof object_name); @@ -85,30 +76,21 @@ void object_in_user(struct http_transaction *h, struct ctdlsession *c, char *req } -/* - * Handle REST/DAV requests for the user itself (such as /ctdl/u/username - * or /ctdl/i/username/ but *not* specific properties of the user) - */ -void the_user_itself(struct http_transaction *h, struct ctdlsession *c, char *username) -{ +// Handle REST/DAV requests for the user itself (such as /ctdl/u/username +// or /ctdl/i/username/ but *not* specific properties of the user) +void the_user_itself(struct http_transaction *h, struct ctdlsession *c, char *username) { do_404(h); } -/* - * Dispatcher for "/ctdl/u" and "/ctdl/u/" for the user list - */ -void user_list(struct http_transaction *h, struct ctdlsession *c) -{ +// Dispatcher for "/ctdl/u" and "/ctdl/u/" for the user list +void user_list(struct http_transaction *h, struct ctdlsession *c) { do_404(h); } -/* - * Dispatcher for paths starting with /ctdl/u/ - */ -void ctdl_u(struct http_transaction *h, struct ctdlsession *c) -{ +// Dispatcher for paths starting with /ctdl/u/ +void ctdl_u(struct http_transaction *h, struct ctdlsession *c) { char requested_username[128]; char buf[1024]; diff --git a/webcit-ng/util.c b/webcit-ng/util.c index a6a0fc768..5ae5da728 100644 --- a/webcit-ng/util.c +++ b/webcit-ng/util.c @@ -16,11 +16,8 @@ #include "webcit.h" -/* - * remove escaped strings from i.e. the url string (like %20 for blanks) - */ -int unescape_input(char *buf) -{ +// remove escaped strings from i.e. the url string (like %20 for blanks) +int unescape_input(char *buf) { unsigned int a, b; char hex[3]; long buflen; @@ -38,11 +35,12 @@ int unescape_input(char *buf) if (buf[a] == '+') buf[a] = ' '; if (buf[a] == '%') { - /* don't let % chars through, rather truncate the input. */ + // don't let % chars through, rather truncate the input. if (a + 2 > buflen) { buf[a] = '\0'; buflen = a; - } else { + } + else { hex[0] = buf[a + 1]; hex[1] = buf[a + 2]; hex[2] = 0; @@ -62,20 +60,17 @@ int unescape_input(char *buf) } -/* - * Supplied with a unix timestamp, generate a textual time/date stamp. - * Caller owns the returned memory. - */ -char *http_datestring(time_t xtime) -{ +// Supplied with a unix timestamp, generate a textual time/date stamp. +// Caller owns the returned memory. +char *http_datestring(time_t xtime) { - /* HTTP Months - do not translate - these are not for human consumption */ + // HTTP Months - do not translate - these are not for human consumption static char *httpdate_months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; - /* HTTP Weekdays - do not translate - these are not for human consumption */ + // HTTP Weekdays - do not translate - these are not for human consumption static char *httpdate_weekdays[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; @@ -90,7 +85,7 @@ char *http_datestring(time_t xtime) localtime_r(&xtime, &t); - /* Convert "seconds west of GMT" to "hours/minutes offset" */ + // Convert "seconds west of GMT" to "hours/minutes offset" offset = t.tm_gmtoff; if (offset > 0) { offsign = '+'; diff --git a/webcit-ng/webserver.c b/webcit-ng/webserver.c index 6de0639bc..2cf80a0ca 100644 --- a/webcit-ng/webserver.c +++ b/webcit-ng/webserver.c @@ -25,44 +25,39 @@ int is_https = 0; // Set to nonzero if we are running as an HTTPS server today static void *original_brk = NULL; // Remember the original program break so we can test for leaks -/* - * Spawn an additional worker thread into the pool. - */ -void spawn_another_worker_thread(int *pointer_to_master_socket) -{ +// Spawn an additional worker thread into the pool. +void spawn_another_worker_thread(int *pointer_to_master_socket) { pthread_t th; // Thread descriptor pthread_attr_t attr; // Thread attributes - /* set attributes for the new thread */ + // set attributes for the new thread pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); pthread_attr_setstacksize(&attr, 1048576); // Large stacks to prevent MIME parser crash on FreeBSD - /* now create the thread */ + // now create the thread if (pthread_create(&th, &attr, (void *(*)(void *)) worker_entry, (void *) pointer_to_master_socket) != 0) { syslog(LOG_WARNING, "Can't create thread: %s", strerror(errno)); - } else { + } + else { ++num_threads_existing; ++num_threads_executing; } - /* free up the attributes */ + // free up the attributes pthread_attr_destroy(&attr); } -/* - * Entry point for worker threads - */ -void worker_entry(int *pointer_to_master_socket) -{ +// Entry point for worker threads +void worker_entry(int *pointer_to_master_socket) { int master_socket = *pointer_to_master_socket; int i = 0; int fail_this_transaction = 0; struct client_handle ch; while (1) { - /* Each worker thread blocks on accept() while waiting for something to do. */ + // Each worker thread blocks on accept() while waiting for something to do. memset(&ch, 0, sizeof ch); ch.sock = -1; errno = EAGAIN; @@ -80,24 +75,25 @@ void worker_entry(int *pointer_to_master_socket) num_threads_executing, num_threads_existing); } while ((master_socket > 0) && (ch.sock < 0)); - /* If all threads are executing, spawn more, up to the maximum */ + // If all threads are executing, spawn more, up to the maximum if ((num_threads_executing >= num_threads_existing) && (num_threads_existing <= MAX_WORKER_THREADS)) { spawn_another_worker_thread(pointer_to_master_socket); } - /* We have a client. Do some work. */ + // We have a client. Do some work. - /* Set the SO_REUSEADDR socket option */ + // Set the SO_REUSEADDR socket option i = 1; setsockopt(ch.sock, SOL_SOCKET, SO_REUSEADDR, &i, sizeof(i)); - /* If we are an HTTPS server, go crypto now. */ + // If we are an HTTPS server, go crypto now. if (is_https) { starttls(&ch); if (ch.ssl_handle == NULL) { fail_this_transaction = 1; } - } else { + } + else { int fdflags; fdflags = fcntl(ch.sock, F_GETFL); if (fdflags < 0) { @@ -105,16 +101,16 @@ void worker_entry(int *pointer_to_master_socket) } } - /* Perform an HTTP transaction... */ + // Perform an HTTP transaction... if (fail_this_transaction == 0) { perform_one_http_transaction(&ch); } - /* Shut down SSL/TLS if required... */ + // Shut down SSL/TLS if required... if (is_https) { endtls(&ch); } - /* ...and close the socket. */ + // ...and close the socket. //syslog(LOG_DEBUG, "Closing socket %d...", ch.sock); //lingering_close(ch.sock); close(ch.sock); @@ -123,11 +119,8 @@ void worker_entry(int *pointer_to_master_socket) } -/* - * Start up a TCP HTTP[S] server on the requested port - */ -int webserver(char *webserver_interface, int webserver_port, int webserver_protocol) -{ +// Start up a TCP HTTP[S] server on the requested port +int webserver(char *webserver_interface, int webserver_port, int webserver_protocol) { int master_socket = (-1); original_brk = sbrk(0); -- 2.39.2