snac2

Fork of https://codeberg.org/grunfink/snac2
git clone https://git.inz.fi/snac2
Log | Files | Refs | README | LICENSE

commit 7ae3064210123fe19cb036c7b879418e1262ec2f
parent a22a515e0f45071c892d30373f6a799cef5ccb00
Author: default <nobody@localhost>
Date:   Wed, 28 Sep 2022 16:27:53 +0200

Better coping with timeouts.

Diffstat:
Mhtml.c | 2+-
Mhttpd.c | 6++++++
2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/html.c b/html.c @@ -458,7 +458,7 @@ d_char *html_entry(snac *snac, d_char *s, char *msg, xs_set *seen, int level) if (url != NULL) { xs *s1 = xs_fmt("<p><img src=\"%s\" alt=\"%s\"/></p>\n", - url, name == NULL ? "" : name); + url, xs_is_null(name) ? "" : name); s = xs_str_cat(s, s1); } diff --git a/httpd.c b/httpd.c @@ -106,6 +106,12 @@ void httpd_connection(int rs) req = xs_httpd_request(f, &payload, &p_size); + if (req == NULL) { + /* probably because a timeout */ + fclose(f); + return; + } + method = xs_dict_get(req, "method"); q_path = xs_dup(xs_dict_get(req, "path"));