aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorame <[email protected]>2024-02-23 13:08:49 -0600
committerame <[email protected]>2024-02-23 13:08:49 -0600
commit8481fec8b7f5a91a5f842f3818ef4a548e918d41 (patch)
tree3437a24089a01af4162f3bff309f614efb1d2f19
parentb9e0d2edad2dd4d2a42233d4711610f85ab4b6c2 (diff)
prolly changed stuff
-rw-r--r--src/net.c7
-rw-r--r--tests/net.lua3
2 files changed, 7 insertions, 3 deletions
diff --git a/src/net.c b/src/net.c
index c93cea7..237a906 100644
--- a/src/net.c
+++ b/src/net.c
@@ -26,7 +26,8 @@
#include "types/parray.h"
#define max_con 200
-#define BUFFER_SIZE 2048
+//2^42
+#define BUFFER_SIZE 67108864
static int ports[65535] = { 0 };
static parray_t* paths = NULL;
@@ -78,6 +79,7 @@ int64_t recv_full_buffer(int client_fd, char** _buffer, int* header_eof){
*_buffer = buffer;
return len + BUFFER_SIZE;
}
+
str* cont_len_str = str_init("");
if(cont_len_raw == NULL) abort();
//i is length of 'Content-Length: '
@@ -86,7 +88,7 @@ int64_t recv_full_buffer(int client_fd, char** _buffer, int* header_eof){
str_free(cont_len_str);
}
-
+
len += n;
buffer = realloc(buffer, len + BUFFER_SIZE);
@@ -584,6 +586,7 @@ void* handle_client(void *_arg){
if(sT != NULL && bytes_received > 0){
char* new_cont;
int pf = file_parse(L, buffer + header_eof, sT, &new_cont, bytes_received - header_eof);
+
if(pf >= 0){
luaI_tsetv(L, req_idx, "files", pf);
parray_set(table, "Body", (void*)str_init(new_cont));
diff --git a/tests/net.lua b/tests/net.lua
index 7fac0ad..cb51ab5 100644
--- a/tests/net.lua
+++ b/tests/net.lua
@@ -1,5 +1,5 @@
require "llib"
-llib.config.set({max_depth=4})
+llib.config.set({max_depth=1})
--local print = llib.io.pprint
sleep = function(a)
local sec = tonumber(os.clock() + a);
@@ -42,6 +42,7 @@ llib.net.listen(
--_G.llib.io.pprint(_G.llib.io.readfile(".gitignore"))
--print(req._bytes)
--res:send(_G.llib.io.readfile("llib.dll"))
+ --_G.llib.io.pprint(_G.llib.crypto.md5(_G.llib.io.readfile(".gitignore")))
_G.llib.io.pprint(req)
end)