ref: 2e7a96c5ed21229382646bbe60d33dcfd35b63f2
parent: 7a70e9e0e08482108c89731fe2baf263ddc34c2d
author: grobe0ba <grobe0ba@tcp80.org>
date: Mon Aug 1 16:10:12 EDT 2022
fix the integration stuff
--- a/tcp80.c
+++ b/tcp80.c
@@ -32,10 +32,8 @@
Pair aheader[64];
Ctype ctypemap[] = {
- ".htm", "text/html;charset=utf-8",
- ".html", "text/html;charset=utf-8",
- ".txt", "text/plain;charset=utf-8",
- ".md", "text/markdown;charset=utf-8",
+ ".htm", "text/html;charset=utf-8", ".html", "text/html;charset=utf-8",
+ ".txt", "text/plain;charset=utf-8", ".md", "text/markdown;charset=utf-8",
".css", "text/css;charset=utf-8",
};
@@ -637,9 +635,8 @@
main(int argc, char **argv)
{
static char buf[1024], line[1024];
- char *p, *e, *k, *x, *s, *r, *c;
- int lineno, n;
- Pair *h;
+ char *r, *c;
+ int n;
r = nil;
ARGBEGIN
@@ -663,12 +660,10 @@
}
if(remote[0] == 0)
strcpy(remote, "-");
-
if(parsequery() < 0){
respond("400 Bad Request");
return;
}
-
if(r){
c = findrule(r, location);
if(c){
@@ -681,7 +676,6 @@
return;
}
}
-
if(!trusted){
if(addns("none", "/lib/namespace.httpd") < 0)
return;
@@ -690,64 +684,6 @@
if(rfork(RFNOMNT) < 0)
return;
}
-
- naheader = 0;
- lineno = 0;
- *line = 0;
- p = buf;
- e = buf + sizeof(buf);
- while((n = read(0, p, e - p)) > 0){
- p += n;
- while((p > buf) && (e = memchr(buf, '\n', p - buf))){
- if((e > buf) && (e[-1] == '\r'))
- e[-1] = 0;
- *e++ = 0;
- if(*buf != ' ' && *buf != '\t' && *line){
- if(lineno++ == 0){
- nstrcpy(method, token(line, "\t ", &s), sizeof(method));
- nstrcpy(location, token(s, "\t ", nil), sizeof(location));
- }else{
- if(lineno > 100)
- return;
- k = token(line, ":", &s);
- while(*s){
- if(naheader >= nelem(aheader))
- return;
- x = token(s, ",", &s);
- h = aheader + naheader++;
- nstrcpy(h->key, k, sizeof(h->key));
- nstrcpy(h->val, x, sizeof(h->val));
- if(x = strchr(h->val, ';')){
- *x++ = 0;
- x = token(x, ";", nil);
- }
- h->att = x;
- h->next = header;
- header = h;
- }
- }
- }
- nstrcpy(line, buf, sizeof(line));
- p -= e - buf;
- if(p > buf)
- memmove(buf, e, p - buf);
- if(*line == 0){
- if(method[0] == 0)
- return;
- if(dispatch())
- return;
- h = nil;
- while(h = findhdr(h, "Connection"))
- if(cistrcmp(h->val, "Keep-Alive") == 0)
- break;
- if(h == nil)
- return;
- method[0] = 0;
- naheader = 0;
- header = nil;
- lineno = 0;
- }
- }
- e = buf + sizeof(buf);
- }
+ dispatch();
+ return;
}