]> Nishi Git Mirror - tewi.git/commitdiff
better redirect
authorNishi <nishi@nishi.boats>
Thu, 26 Sep 2024 20:00:49 +0000 (20:00 +0000)
committerNishi <nishi@nishi.boats>
Thu, 26 Sep 2024 20:00:49 +0000 (20:00 +0000)
git-svn-id: file:///raid/svn-personal/tewi/trunk@166 8739d7e6-ffea-ec47-b151-bdff447c6205

README
Server/server.c
Server/tw_version.h

diff --git a/README b/README
index 10ad07ee2b62d3457f3ce05dc752e6346eb081d5..96a803776e508786421b108c094d64210fdddbfe 100644 (file)
--- a/README
+++ b/README
@@ -1,5 +1,5 @@
 
-Tewi HTTPd version 1.08
+Tewi HTTPd version 1.08B
 
 Original by Nishi <nishi@nishi.boats>
 
index 8c7ea203b617ea002edeacc3aa7120effbe73f63..f2874cc08912b8e68a8674ff30a621c18e8b85a1 100644 (file)
@@ -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;
index 05640c35cb47d8e0847fd24b212608e5ae1bf0fa..c7b8bb74804b0a29636cbb24ad34103b94675f72 100644 (file)
@@ -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);