moth/packages/mcp/fnord.patch

91 lines
2.3 KiB
Diff
Raw Normal View History

2011-03-08 23:06:21 -07:00
diff -Naur fnord-1.10-orig//httpd.c fnord-1.10/httpd.c
2011-03-14 17:13:25 -06:00
--- fnord-1.10-orig//httpd.c 2005-08-03 05:32:50.000000000 -0600
+++ fnord-1.10/httpd.c 2011-03-14 17:05:57.000000000 -0600
@@ -163,9 +163,8 @@
#define MAXHEADERLEN 8192
-char* remote_ip;
+char* remote_addr;
#ifdef CGI
-char* remote_port;
char* remote_ident;
#endif
@@ -186,7 +185,7 @@
time_t t=time(0);
struct tm* x=localtime(&t);
int l=-(timezone/60);
- buffer_puts(buffer_2,remote_ip?remote_ip:"0.0.0.0");
+ buffer_puts(buffer_2,remote_addr?remote_addr:"0.0.0.0");
buffer_puts(buffer_2," - - [");
buffer_put2digits(buffer_2,x->tm_mday);
@@ -219,7 +218,7 @@
buffer_putrange(buffer_2,len);
#else
- buffer_puts(buffer_2,remote_ip?remote_ip:"0.0.0.0");
+ buffer_puts(buffer_2,remote_addr?remote_addr:"0.0.0.0");
buffer_putspace(buffer_2);
buffer_putulong(buffer_2,retcode);
buffer_putspace(buffer_2);
@@ -271,7 +270,6 @@
"REQUEST_URI=",
"SCRIPT_NAME=",
"REMOTE_ADDR=",
- "REMOTE_PORT=",
"REMOTE_IDENT=",
"HTTP_USER_AGENT=",
"HTTP_COOKIE=",
@@ -337,17 +335,10 @@
*tmp=0; ++tmp;
i=7;
- if (remote_ip) {
+ if (remote_addr) {
cgi_env[++i]=tmp;
tmp+=str_copy(tmp,"REMOTE_ADDR=");
- tmp+=str_copy(tmp,remote_ip);
- *tmp=0; ++tmp;
- }
-
- if (remote_port) {
- cgi_env[++i]=tmp;
- tmp+=str_copy(tmp,"REMOTE_PORT=");
- tmp+=str_copy(tmp,remote_port);
+ tmp+=str_copy(tmp,remote_addr);
*tmp=0; ++tmp;
}
@@ -663,8 +654,9 @@
2011-03-08 23:06:21 -07:00
static char* mimetype="text/plain";
static struct mimeentry { const char* name, *type; } mimetab[] = {
- { "html", "text/html" },
- { "htm", "text/html" },
+ { "html", "text/html; charset=utf-8" },
+ { "htm", "text/html; charset=utf-8" },
+ { "txt", "text/plain; charset=utf-8" },
{ "css", "text/css" },
{ "dvi", "application/x-dvi" },
{ "ps", "application/postscript" },
2011-03-14 17:13:25 -06:00
@@ -1060,16 +1052,7 @@
static void get_ucspi_env(void) {
char* ucspi=getenv("PROTO");
if (ucspi) {
- char* buf=alloca(str_len(ucspi)+20);
- unsigned int tmp=str_copy(buf,ucspi);
- buf[tmp+str_copy(buf+tmp,"REMOTEIP")]=0;
- remote_ip=getenv(buf);
-#ifdef CGI
- buf[tmp+str_copy(buf+tmp,"REMOTEPORT")]=0;
- remote_port=getenv(buf);
- buf[tmp+str_copy(buf+tmp,"REMOTEINFO")]=0;
- remote_ident=getenv(buf);
-#endif
+ remote_addr=getenv("REMOTEADDR");
}
}