1
0
mirror of https://github.com/gophernicus/gophernicus.git synced 2024-11-03 04:27:17 -05:00

Fixed logging of TLS connections (using gophers:// protocol)

This commit is contained in:
Kim Holviala 2017-02-04 10:33:17 +02:00
parent 00adea815b
commit ff2760ba43
3 changed files with 12 additions and 6 deletions

12
file.c
View File

@ -118,7 +118,8 @@ void url_redirect(state *st)
/* Log the redirect */
if (st->opt_syslog) {
syslog(LOG_INFO, "request for \"gopher://%s:%i/h%s\" from %s",
syslog(LOG_INFO, "request for \"gopher%s://%s:%i/h%s\" from %s",
(st->server_port == st->server_tls_port ? "s" : ""),
st->server_host,
st->server_port,
st->req_selector,
@ -154,7 +155,8 @@ void server_status(state *st, shm_state *shm, int shmid)
/* Log the request */
if (st->opt_syslog) {
syslog(LOG_INFO, "request for \"gopher://%s:%i/0" SERVER_STATUS "\" from %s",
syslog(LOG_INFO, "request for \"gopher%s://%s:%i/0" SERVER_STATUS "\" from %s",
(st->server_port == st->server_tls_port ? "s" : ""),
st->server_host,
st->server_port,
st->req_remote_addr);
@ -201,11 +203,12 @@ void server_status(state *st, shm_state *shm, int shmid)
if ((now - shm->session[i].req_atime) < st->session_timeout) {
sessions++;
printf("Session: %-4i %-40s %-4li %-7li gopher://%s:%i/%c%s" CRLF,
printf("Session: %-4i %-40s %-4li %-7li gopher%s://%s:%i/%c%s" CRLF,
(int) (now - shm->session[i].req_atime),
shm->session[i].req_remote_addr,
shm->session[i].hits,
shm->session[i].kbytes,
(shm->session[i].server_port == st->server_tls_port ? "s" : ""),
shm->session[i].server_host,
shm->session[i].server_port,
shm->session[i].req_filetype,
@ -225,7 +228,8 @@ void caps_txt(state *st, shm_state *shm)
{
/* Log the request */
if (st->opt_syslog) {
syslog(LOG_INFO, "request for \"gopher://%s:%i/0" CAPS_TXT "\" from %s",
syslog(LOG_INFO, "request for \"gopher%s://%s:%i/0" CAPS_TXT "\" from %s",
(st->server_port == st->server_tls_port ? "s" : ""),
st->server_host,
st->server_port,
st->req_remote_addr);

View File

@ -740,7 +740,8 @@ get_selector:
/* Log the request */
if (st.opt_syslog) {
syslog(LOG_INFO, "request for \"gopher://%s:%i/%c%s\" from %s",
syslog(LOG_INFO, "request for \"gopher%s://%s:%i/%c%s\" from %s",
(st.server_port == st.server_tls_port ? "s" : ""),
st.server_host,
st.server_port,
st.req_filetype,

View File

@ -107,7 +107,8 @@ void update_shm_session(state *st, shm_state *shm)
/* Get referrer from old session data */
if (*shm->session[i].server_host) {
snprintf(buf, sizeof(buf), "gopher://%s:%i/%c%s",
snprintf(buf, sizeof(buf), "gopher%s://%s:%i/%c%s",
(shm->session[i].server_port == st->server_tls_port ? "s" : ""),
shm->session[i].server_host,
shm->session[i].server_port,
shm->session[i].req_filetype,