initial commit

This commit is contained in:
kento2 2026-09-08 18:36:12 +02:00
commit 584aad56b8
19 changed files with 390 additions and 0 deletions

27
send_headers.c Normal file
View file

@ -0,0 +1,27 @@
#include <unistd.h>
#include <libowfat/errmsg.h>
#include "nobotgate.h"
int send_headers(buffer *from, buffer *to)
{
char buf[8192];
int nread;
for (;;) {
nread=buffer_getline(from,buf,sizeof buf);
if (nread==0) { carp("EOF before header end"); return 0; }
if (nread<0) { carpsys("failed reading"); return 0; }
/* include \n */
nread++;
if (buffer_put(to,buf,nread)<0) return 0;
if (buf[0]=='\r')
break;
}
if (buffer_flush(to)<0) {
carpsys("buffer flush");
return 0;
}
return 1;
}