From ac7e8b2318a0e118d4cb7ced49d109c40908cb85 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 21 Mar 2021 00:24:14 +0000 Subject: fix content-type headers, and store a day's worth of weather data --- app/httpd.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'app/httpd.c') diff --git a/app/httpd.c b/app/httpd.c index 3fdea93..b3776c3 100644 --- a/app/httpd.c +++ b/app/httpd.c @@ -257,19 +257,24 @@ static const char *cgi_set_handler (int idx, int num_params, char *params[], cha int fs_open_custom (struct fs_file *file, const char *name) { - int len; - if (!strcmp (name, "/index.html")) - len = make_index(); - else if (!strcmp (name, "/alarm.html")) - len = make_alarm(); + if (!strcmp (name, "/index.html")) { + file->data = (const char *)html_buf; + file->len = make_index(); + } + else if (!strcmp (name, "/alarm.html")) { + file->data = (const char *)html_buf; + file->len = make_alarm(); + } + else if (!strcmp (name, "/meteotime.dat")) { + file->data = (const char *)meteotime_data; + file->len=sizeof(meteotime_data); + } else { printf ("looking for url=%s, found nothing\n", name); return 0; } - file->data = (const char *)html_buf; - file->len = len; file->index = file->len; file->pextension = NULL; file->flags = 0; -- cgit v1.2.3