Add X-Firefox-AI support. - bitreich-httpd - Bitreich HTTPD service
(HTM) git clone git://bitreich.org/bitreich-httpd git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/bitreich-httpd
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) Tags
(DIR) README
(DIR) LICENSE
---
(DIR) commit 0e6741332164166436071bd1476393dbdad4d75a
(DIR) parent 59558e41c3f5da41a1c855998af2a91c8a202004
(HTM) Author: Christoph Lohmann <20h@r-36.net>
Date: Wed, 28 May 2025 20:34:30 +0200
Add X-Firefox-AI support.
Diffstat:
M bitreich-httpd.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
---
(DIR) diff --git a/bitreich-httpd.c b/bitreich-httpd.c
@@ -187,7 +187,7 @@ main(int argc, char *argv[])
char *wwwbase, *wwwindex, *request, *ctype, *path, *le_file,
*le_base, clienth[NI_MAXHOST], clientp[NI_MAXSERV], *zuccbase,
*requested, *header, *headerval, *hosthdr;
- int rlen, i, user_agent_script_pid;
+ int rlen, i, user_agent_script_pid, isxfirefoxai;
struct sockaddr_storage clt;
socklen_t cltlen = sizeof(clt);
time_t tim;
@@ -221,6 +221,7 @@ main(int argc, char *argv[])
/* Header parsing. */
/* At max read 16 headers. Do not allow DDoS. */
+ isxfirefoxai = 0;
for (i = 0; i < 16; i++) {
header = read_line(0, &rlen, 512);
if (header == NULL || rlen == 0)
@@ -261,13 +262,19 @@ main(int argc, char *argv[])
memset(hosthdr, 0, rlen+1);
strncpy(hosthdr, headerval, rlen);
}
+ if (!strcasecmp(header, "x-firefox-ai")) {
+ isxfirefoxai = 1;
+ ctype = "video/webm";
+ asprintf(&path, "%s/s/aiaiaiai.webm", wwwbase);
+ }
free(header);
}
if (strncmp(request, "GET ", 4))
return 1;
- if (strstr(request, "s/bitreich.sh")) {
+ if (isxfirefoxai) {
+ } else if (strstr(request, "s/bitreich.sh")) {
asprintf(&path, "%s/s/bitreich.sh", wwwbase);
ctype = "text/plain";
} else if (strstr(request, "favicon.gif")) {