summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClayton <nrootconauto@gmail.com>2023-03-02 06:54:26 -0500
committerClayton <nrootconauto@gmail.com>2023-03-02 06:54:26 -0500
commit768c3e78a3c5a14411f51abd2ff4216553cd0edf (patch)
treed344651097500826d45f24d7a6ced5e1aa884e52
parent781f24f34cc46fb5cf89714675d5bff445859064 (diff)
HTTP headers are now case-insensitive
Username length check added.
-rw-r--r--HCRT_BC.BINbin3220704 -> 3224288 bytes
-rw-r--r--Makefile.WIN2
-rw-r--r--T/HCRT_BC.BINbin3220880 -> 0 bytes
-rw-r--r--T/HCRT_BC.DBG.Zbin251786 -> 252411 bytes
-rw-r--r--T/Registry.HC22
-rw-r--r--T/ReleasePackage.HC5
-rw-r--r--T/Server/gen_html.HC2
-rw-r--r--T/Server/http.HC23
-rw-r--r--T/Server/run.HC2
-rw-r--r--T/Server/touch_all.HC2
-rw-r--r--T/Server/users.HC7
-rw-r--r--debian/DEBIAN/control2
12 files changed, 25 insertions, 42 deletions
diff --git a/HCRT_BC.BIN b/HCRT_BC.BIN
index 96e5780..56f1ef2 100644
--- a/HCRT_BC.BIN
+++ b/HCRT_BC.BIN
Binary files differ
diff --git a/Makefile.WIN b/Makefile.WIN
index eafbdbe..b44c535 100644
--- a/Makefile.WIN
+++ b/Makefile.WIN
@@ -6,7 +6,7 @@ AFILES=FFI_WIN64.yasm
COBJS=$(foreach o,$(CFILES),$(o).obj)
AOBJS=$(foreach o,$(AFILES),$(o).obj)
OBJS=$(COBJS) $(AOBJS) $(CPPOBJS)
-LIBS=ext/wineditline-2.206/lib64/libedit_static.a -lm -lshlwapi -ldbghelp SDL2.DLL -lsynchronization -lshcore -lws2_32 -lwinmm -Ofast -ld2d1 -static-libstdc++ -o 3d_loader.exe
+LIBS=ext/wineditline-2.206/lib64/libedit_static.a -lm -lshlwapi -ldbghelp SDL2.dll -lsynchronization -lshcore -lws2_32 -lwinmm -Ofast -ld2d1 -static-libstdc++ -o 3d_loader.exe
all: $(OBJS)
$(CPP) -mwindows $(OBJS) $(LIBS) -o ./3d_loader.exe -static
clean:
diff --git a/T/HCRT_BC.BIN b/T/HCRT_BC.BIN
deleted file mode 100644
index 21a7ed8..0000000
--- a/T/HCRT_BC.BIN
+++ /dev/null
Binary files differ
diff --git a/T/HCRT_BC.DBG.Z b/T/HCRT_BC.DBG.Z
index 7fbd6ff..9e13cfd 100644
--- a/T/HCRT_BC.DBG.Z
+++ b/T/HCRT_BC.DBG.Z
Binary files differ
diff --git a/T/Registry.HC b/T/Registry.HC
deleted file mode 100644
index 5f071ee..0000000
--- a/T/Registry.HC
+++ /dev/null
@@ -1,22 +0,0 @@
-$TR,"TempleOS"$
-$ID,2$$TR,"Talons"$
-$ID,2$F64 best_score=9999.0000;
-$ID,-2$$TR,"Varoom"$
-$ID,2$F64 best_score=9999.0000;
-$ID,-2$$TR,"ZoneOut"$
-$ID,2$F64 best_score=9999.0000;
-$ID,-2$$TR,"CastleFrankenstein"$
-$ID,2$F64 best_score=9999.0000;
-$ID,-2$$TR,"DunGen"$
-$ID,2$F64 best_score=92.2440;
-$ID,-2$$ID,-2$$TR-C,"Me"$
-$ID,2$$TR-C,"Potatoes"$
-$ID,2$F64 x=100;$ID,-2$$ID,-2$$TR,"DemoCompany"$
-$ID,2$$TR,"Game1"$
-$ID,2$F64 best_score=1672666791.30400;
-$TR,"SimpleVal"$
-$ID,2$1236;
-$ID,-2$$ID,-2$$TR,"ProgressBars"$
-$ID,2$progress1_tf=1670994977577.815;progress2_tf=0.000;
-progress3_tf=0.000;progress4_tf=0.000;
-$ID,-2$$ID,-2$ \ No newline at end of file
diff --git a/T/ReleasePackage.HC b/T/ReleasePackage.HC
index fd8583d..5524fcf 100644
--- a/T/ReleasePackage.HC
+++ b/T/ReleasePackage.HC
@@ -12,10 +12,7 @@ U0SelCopy(CDirEntry *head,U8 *to,I64 argc,U8 **exclude) {
if(c_ent->sub){
SelCopy(c_ent->sub,to2=MStrPrint("%s/%s",to,c_ent->name),argc,exclude);
} else if(!IsDir(c_ent->full_name)&&c_ent->name[0]!='.') {
- if(IsDotZ(c_ent->name))
- to2=MStrPrint("%s/%s",to,c_ent->name);
- else
- to2=MStrPrint("%s/%s.Z",to,c_ent->name);
+ to2=MStrPrint("%s/%s",to,c_ent->name);
if(FileFind(to2)) {
"Repeat file %s,Aborting\n",to2;
throw('Repeat');
diff --git a/T/Server/gen_html.HC b/T/Server/gen_html.HC
index 94c7d94..d73eed9 100644
--- a/T/Server/gen_html.HC
+++ b/T/Server/gen_html.HC
@@ -586,7 +586,7 @@ U0 Get(CServer *srv,CDyadStream *stream,CURL *url,CHTTPRequest *req) {
fin:
EndHttpRequest(stream);
}
-CServer *srv=CreateServer(WIKI_SERVER_PORT);
+CServer *srv=CreateServer(WIKI_SERVER_PORT);
srv->get=&Get;
srv->post=&Post;
Serve(srv);
diff --git a/T/Server/http.HC b/T/Server/http.HC
index 1b70a9d..5d99358 100644
--- a/T/Server/http.HC
+++ b/T/Server/http.HC
@@ -408,13 +408,13 @@ found:
Yield;
if(len==2) con->state.u8[0]=CON_S_BLANK_LINE;
//Pray that header is smaller than 128kb.
- if(con->state.u8[0]==CON_S_METHOD&&!StrNCmp(data,"GET",3)) {
+ if(con->state.u8[0]==CON_S_METHOD&&!StrNICmp(data,"GET",3)) {
con->method.u8[0]=HTTP_GET;
t1=MStrPrint("http://potato.com/%s",Trim(SkipWhitespace(data+3)));
con->url=ParseURL(t1);
Free(t1);
con->state.u8[0]=CON_S_FIELDS;
- } else if(con->state.u8[0]==CON_S_METHOD&&!StrNCmp(data,"POST",4)) {
+ } else if(con->state.u8[0]==CON_S_METHOD&&!StrNICmp(data,"POST",4)) {
con->method.u8[0]=HTTP_POST;
t1=MStrPrint("http://potato.com/%s",Trim(SkipWhitespace(data+4)));
con->url=ParseURL(t1);
@@ -422,7 +422,7 @@ found:
con->state.u8[0]=CON_S_FIELDS;
} else if(con->state.u8[0]==CON_S_METHOD) {
con->method.u8[0]=HTTP_UNDEF;
- } else if(!StrNCmp(data,"Content-Length",StrLen("Content-Length"))) {
+ } else if(!StrNICmp(data,"Content-Length",StrLen("Content-Length"))) {
data=SkipWhitespace(StrFirstOcc(data,":")+1);
con->fbuffer=MAlloc(Str2I64(data),con->hc);
con->content_len=Str2I64(data);
@@ -477,10 +477,10 @@ etag_loop:
data=SkipWhitespace(data+1);
goto etag_loop;
}
- } else if(!Bt(&con->state,CONf_DATA)&&!StrNCmp(data,"Connection",StrLen("Connection"))) {
+ } else if(!Bt(&con->state,CONf_DATA)&&!StrNICmp(data,"Connection",StrLen("Connection"))) {
data=SkipWhitespace(StrFirstOcc(data,":")+1);
BEqu(&con->state,CONf_KEEP_ALIVE,ToBool(StrIMatch("keep-alive",data)));
- } else if(!Bt(&con->state,CONf_DATA)&&!StrNCmp(data,"Cookie",StrLen("Cookie"))) {
+ } else if(!Bt(&con->state,CONf_DATA)&&!StrNICmp(data,"Cookie",StrLen("Cookie"))) {
data=SkipWhitespace(StrFirstOcc(data,":")+1);
t1=buf,t2=buf2;
if(*data) {
@@ -492,6 +492,7 @@ cloop:;
data=StrScan(data,"%s=%s;",&t1,&t2);
//Im not allowing people to spam Cookies to my server,so only predefined ones will be accepted
if(!StrCmp(buf,WIKI_SESSION_COOKIE)){
+ TOSPrint("C:%s\n",buf);
Free(con->session_cookie);
con->session_cookie=MStrUtil(buf2,SUF_REM_SPACES);
con->session_cookie[16]=0;
@@ -540,18 +541,18 @@ cloop:;
HashAdd(hash,con->post_data);
}
goto process;
- } else if(!Bt(&con->state,CONf_DATA)&&!StrNCmp(data,"Content-Length",StrLen("Content-Length"))) {
+ } else if(!Bt(&con->state,CONf_DATA)&&!StrNICmp(data,"Content-Length",StrLen("Content-Length"))) {
con->field_length=Str2I64(SkipWhitespace(StrFirstOcc(data,":")+1));
- } else if(!Bt(&con->state,CONf_DATA)&&!StrNCmp(data,"Content-Disposition",StrLen("Content-Disposition"))) {
+ } else if(!Bt(&con->state,CONf_DATA)&&!StrNICmp(data,"Content-Disposition",StrLen("Content-Disposition"))) {
data=SkipWhitespace(StrFirstOcc(data,":")+1);
- if(!StrNCmp(data,"form-data",StrLen("form-data"))) {
+ if(!StrNICmp(data,"form-data",StrLen("form-data"))) {
loop:
if(data) {
data=SkipWhitespace(data);
- if(!StrNCmp(data,"name",StrLen("name"))) {
+ if(!StrNICmp(data,"name",StrLen("name"))) {
t2=con->field;
data=StrScan(StrFirstOcc(data,"\""),"\"%s\"",&t2);
- } else if(!StrNCmp(data,"filename",StrLen("filename"))) {
+ } else if(!StrNICmp(data,"filename",StrLen("filename"))) {
if(con->name) Free(con->name);
con->name=MAlloc(len+1,con->hc);
t2=con->name;
@@ -656,4 +657,4 @@ U0 Serve(CServer *srv) {
DyadUpdate;
}
DyadShutdown;
-} \ No newline at end of file
+}
diff --git a/T/Server/run.HC b/T/Server/run.HC
index f896afc..bf18e1c 100644
--- a/T/Server/run.HC
+++ b/T/Server/run.HC
@@ -39,7 +39,7 @@ extern Bool CurrentUserIsAdmin();
#define WIKI_ADMIN "/ADMIN"
#define WIKI_SALT "/SALT"
#define WIKI_UNSALT "/UNSALT"
-#define WIKI_VIEW_FILE "/VIEWFILE"
+#define WIKI_VIEW_FILE "/VIEWFILE"
#define WIKI_DELETE "/DELETE"
if(!FileFind(WIKI_ROOT))
DirMk(WIKI_ROOT);
diff --git a/T/Server/touch_all.HC b/T/Server/touch_all.HC
index ecadda3..7f3c022 100644
--- a/T/Server/touch_all.HC
+++ b/T/Server/touch_all.HC
@@ -10,4 +10,4 @@ U0 TouchAll() {
Free(ftxt);
}
DirEntryDel(root);
-} \ No newline at end of file
+} \ No newline at end of file
diff --git a/T/Server/users.HC b/T/Server/users.HC
index 68ab782..f5208f7 100644
--- a/T/Server/users.HC
+++ b/T/Server/users.HC
@@ -117,6 +117,13 @@ fail0:
return;
}
}
+ if(StrLen(un->user_data1)>=STR_LEN) {
+ WikiHeader(stream,NULL,"Username is too long!",0);
+ WriteLn(stream,,"<H2>Username is too long</H2>");
+ WriteLn(stream,,"<P>Try again.</P>");
+ WikiFooter(stream,NULL,url);
+ return;
+ }
if(StrCmp(ps->user_data1,ps2->user_data1)) {
con->response_code=200;
StrCpy(con->response_mime,"text/html");
diff --git a/debian/DEBIAN/control b/debian/DEBIAN/control
index 4b23214..45247c3 100644
--- a/debian/DEBIAN/control
+++ b/debian/DEBIAN/control
@@ -3,6 +3,6 @@ Version: 0.6.00
Section: development
Priority: optional
Architecture: amd64
-Depends: libxext-dev,portaudio19-dev
+Depends: libsdl2-dev,portaudio19-dev
Maintainer: nrootconauto@gmail.com
Description: A HolyC Compiler.