ref: e509e5d2396318b661ad9bdb25391af4ffd32ad3
parent: 5b0a2dc15e68097868728ea726054f3490511a03
author: grobe0ba <grobe0ba@tcp80.org>
date: Mon Aug 1 16:10:12 EDT 2022
works with shithub
--- /dev/null
+++ b/README.shithub.md
@@ -1,0 +1,14 @@
+# To run the shithub software:
+
+```/rc/bin/service/tcp80```:
+```
+#!/bin/rc
+
+bind /usr/web /mnt/static
+exec /bin/tcp80 -r /sys/lib/tcp80
+```
+
+```/lib/namespace.httpd```:
+```
+bind /mnt/static /usr/web/static
+```
--- a/tcp80.c
+++ b/tcp80.c
@@ -738,12 +738,29 @@
return;
}
if(r){
- c = findrule(r, location);
+ char *loc;
+ if(addns("none", "/lib/namespace.httpd") < 0)
+ return;
+ if(cistrcmp(location, "/") == 0){
+ loc = "/index.html";
+ }else{
+ loc = location;
+ }
+ c = findrule(r, loc);
if(c){
if(cistrcmp(method, "GET") != 0){
respond("405 Method Not Allowed");
return;
}
+
+ Dir fakedir = {0};
+ fakedir.mode = 0644;
+ fakedir.name = "unrealfile";
+ fakedir.uid = "none";
+ fakedir.gid = "none";
+ fakedir.muid = "none";
+ respond("200");
+ headers(loc, &fakedir);
dispatchrule(c);
free(c);
return;