shithub: tcp80

Download patch

ref: 782b239c64d827cd98cfd9f1deb3cdbf1d818d75
parent: f04f9abeae796eb44c2fdba5c313147477386b39
author: grobe0ba <grobe0ba@tcp80.org>
date: Mon Aug 1 16:10:12 EDT 2022

fix up

--- a/tcp80.c
+++ b/tcp80.c
@@ -233,9 +233,11 @@
 		print("Content-Type: text/html; charset=utf-8\r\n");
 	}else{
         int i;
-        for(i = 0; i < nelem(ctypemap); i++) { 
-            //print("%s %s %d\n", path, ctypemap[i].suffix, cistrstr(path, ctypemap[i].suffix));
-			if(cistrstr(path, ctypemap[i].suffix)){
+        for(i = 0; i < nelem(ctypemap); i++){
+            int offset = strlen(path) - strlen(ctypemap[i].suffix);
+            if (offset <= 0)
+                break;
+            if(cistrcmp(path+offset, ctypemap[i].suffix) == 0){
 				print("Content-Type: %s\r\n", ctypemap[i].type);
 				break;
 			}