From: Nishi Date: Thu, 26 Sep 2024 21:18:46 +0000 (+0000) Subject: fix fopen stuff X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=dc2aa6c6e1114ac4e15f63615c146accc58fdb85;p=tewi.git fix fopen stuff git-svn-id: file:///raid/svn-personal/tewi/trunk@173 8739d7e6-ffea-ec47-b151-bdff447c6205 --- diff --git a/README b/README index f1460f6..3d69562 100644 --- a/README +++ b/README @@ -1,5 +1,5 @@ -Tewi HTTPd version 1.08C +Tewi HTTPd version 1.08D Original by Nishi diff --git a/Server/server.c b/Server/server.c index 8f66162..40d9d81 100644 --- a/Server/server.c +++ b/Server/server.c @@ -796,8 +796,12 @@ int32_t tw_server_pass(void* ptr) { char* mime = tw_get_mime(ext, vhost_entry); if(ext != NULL) free(ext); FILE* f = fopen(path, "rb"); - tw_process_page(s, sock, tw_http_status(200), mime, f, NULL, st.st_size, st.st_mtime, cmtime); - fclose(f); + if(f == NULL) { + tw_http_error(s, sock, 403, name, port, vhost_entry); + } else { + tw_process_page(s, sock, tw_http_status(200), mime, f, NULL, st.st_size, st.st_mtime, cmtime); + fclose(f); + } } } else { if(!rej) { diff --git a/Server/tw_version.h b/Server/tw_version.h index ada4f4d..440d863 100644 --- a/Server/tw_version.h +++ b/Server/tw_version.h @@ -7,7 +7,7 @@ extern "C" { #endif -#define TW_VERSION "1.08C\0" +#define TW_VERSION "1.08D\0" const char* tw_get_version(void); const char* tw_get_platform(void); diff --git a/config.h.tmpl b/config.h.tmpl index 7b18bff..da0c04e 100644 --- a/config.h.tmpl +++ b/config.h.tmpl @@ -5,6 +5,7 @@ #define SERVER_ADMIN "webmaster@domain" +#undef NO_IPV6 #undef NO_SSL #define USE_POLL #define HAS_CHROOT