summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org>2018-06-08 09:32:56 (GMT)
committer Sergey Poznyakoff <gray@gnu.org>2018-06-08 09:32:56 (GMT)
commit4c1e9f9d1f78ece0d6b098efd0b902e9f04db625 (patch) (side-by-side diff)
treed23899abde01622dd3b9e6672c8651bd27ea3495
parent822cc3f646945d95ef00b96e881aa67f97b1d7a2 (diff)
parentb2156c559a91ad4eed241d6a624a8ecfac576174 (diff)
downloadfileserv-4c1e9f9d1f78ece0d6b098efd0b902e9f04db625.tar.gz
fileserv-4c1e9f9d1f78ece0d6b098efd0b902e9f04db625.tar.bz2
Merge branch 'master' of ssh://git.gnu.org.ua/gitroot/fileserv
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--src/fileserv.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/fileserv.c b/src/fileserv.c
index 58262c3..568ba37 100644
--- a/src/fileserv.c
+++ b/src/fileserv.c
@@ -509,6 +509,12 @@ get_file_resp(struct MHD_Connection *conn, char const *url, FILE_RESP *resp)
return MHD_HTTP_OK;
}
+static inline char const *
+safestr(char const *s)
+{
+ return s ? s : "-";
+}
+
void
http_log(struct MHD_Connection *connection,
char const *method, char const *url,
@@ -537,9 +543,8 @@ http_log(struct MHD_Connection *connection,
strftime(tbuf, sizeof(tbuf), "[%d/%b/%Y:%H:%M:%S %z]", tm);
info("%s %s - - %s \"%s %s\" %3d %lu \"%s\" \"%s\"",
- host, ipstr, tbuf, method, url, status, st ? st->st_size : 0,
- referer ? referer : "",
- user_agent ? user_agent : "");
+ safestr(host), ipstr, tbuf, method, url, status,
+ st ? st->st_size : 0, safestr(referer), safestr(user_agent));
free(ipstr);
}

Return to:

Send suggestions and report system problems to the System administrator.