Introduction
Introduction Statistics Contact Development Disclaimer Help
Add zuccless random mode. - bitreich-httpd - Bitreich HTTPD service
git clone git://bitreich.org/bitreich-httpd git://enlrupgkhuxnvlhsf6lc3fziv5h2h…
Log
Files
Refs
Tags
README
LICENSE
---
commit a0590477c4c74d7111a031a4cb1c9e5d61ff3044
parent 0f24889dc4f0b3982034d9c4ff58e73f8abe3e16
Author: Christoph Lohmann <[email protected]>
Date: Thu, 4 Aug 2022 21:13:33 +0200
Add zuccless random mode.
Diffstat:
M bitreich-httpd.c | 27 ++++++++++++++++++---------
1 file changed, 18 insertions(+), 9 deletions(-)
---
diff --git a/bitreich-httpd.c b/bitreich-httpd.c
@@ -13,6 +13,7 @@
#include <string.h>
#include <sys/socket.h>
#include <netdb.h>
+#include <time.h>
void *
xmalloc(size_t size)
@@ -109,6 +110,7 @@ main(int argc, char *argv[])
int rlen;
struct sockaddr_storage clt;
socklen_t cltlen = sizeof(clt);
+ time_t tim;
wwwbase = "/bitreich/www";
wwwindex = "index.html";
@@ -164,17 +166,24 @@ main(int argc, char *argv[])
sleep(1);
asprintf(&path, "%s/s/yolo-css.css", wwwbase);
ctype = "text/css";
- } else if (strstr(request, "zucc-meat.webm")) {
- asprintf(&path, "%s/zucc-meat.webm", zuccbase);
- ctype = "video/webm";
} else {
- if (strstr(request, "Host: www.zuccless.org"))
- wwwbase = zuccbase;
- if (strstr(request, "Host: zuccless.org"))
+ if (strstr(request, "zuccless.org")) {
+ tim = time(NULL);
+ srandom(tim);
wwwbase = zuccbase;
-
- asprintf(&path, "%s/%s", wwwbase, wwwindex);
- ctype = "text/html";
+ switch (random() % 3) {
+ case 0:
+ asprintf(&path, "%s/zucc-job.webm", zuccbase);
+ break;
+ default:
+ asprintf(&path, "%s/zucc-meat.webm", zuccbase);
+ break;
+ }
+ ctype = "video/webm";
+ } else {
+ asprintf(&path, "%s/%s", wwwbase, wwwindex);
+ ctype = "text/html";
+ }
}
rlen = servefile(path, ctype, 1);
You are viewing proxied material from bitreich.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.