From: Nishi Date: Thu, 26 Sep 2024 20:00:49 +0000 (+0000) Subject: better redirect X-Git-Url: https://git.chaotic.ninja/gitweb/nishi/?a=commitdiff_plain;h=c13753ce37a7ff4573767ea9dec9134d4ef30b48;p=tewi.git better redirect git-svn-id: file:///raid/svn-personal/tewi/trunk@166 8739d7e6-ffea-ec47-b151-bdff447c6205 --- diff --git a/README b/README index 10ad07e..96a8037 100644 --- a/README +++ b/README @@ -1,5 +1,5 @@ -Tewi HTTPd version 1.08 +Tewi HTTPd version 1.08B Original by Nishi diff --git a/Server/server.c b/Server/server.c index 8c7ea20..f2874cc 100644 --- a/Server/server.c +++ b/Server/server.c @@ -273,6 +273,8 @@ void tw_process_page(SSL* ssl, int sock, const char* status, const char* type, F const char* tw_http_status(int code) { if(code == 200) { return "200 OK"; + } else if(code == 301) { + return "308 Moved Permanently"; } else if(code == 308) { return "308 Permanent Redirect"; } else if(code == 400) { @@ -602,7 +604,7 @@ int32_t tw_server_pass(void* ptr) { if(req.path[strlen(req.path) - 1] != '/') { cm_log("Server", "Accessing directory without the slash at the end"); char* headers[3] = {"Location", cm_strcat(req.path, "/"), NULL}; - _tw_process_page(s, sock, tw_http_status(308), NULL, NULL, NULL, 0, headers, 0, 0); + _tw_process_page(s, sock, tw_http_status(301), NULL, NULL, NULL, 0, headers, 0, 0); free(headers[1]); } else { char** indexes = vhost_entry->index_count == 0 ? config.root.indexes : vhost_entry->indexes; diff --git a/Server/tw_version.h b/Server/tw_version.h index 05640c3..c7b8bb7 100644 --- a/Server/tw_version.h +++ b/Server/tw_version.h @@ -7,7 +7,7 @@ extern "C" { #endif -#define TW_VERSION "1.08A\0" +#define TW_VERSION "1.08B\0" const char* tw_get_version(void); const char* tw_get_platform(void);