aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorame <[email protected]>2025-01-13 03:56:06 -0600
committerame <[email protected]>2025-01-13 03:56:06 -0600
commita86088dc5ded54ccc41bec5d547ff044c641ae19 (patch)
tree2f8551fb65b92326ee01ff0016fd34d7629bb959 /src
parent8bd526ec974af9fe8f32a414d4713ff4c2dccd38 (diff)
select http request type
Diffstat (limited to 'src')
-rw-r--r--src/net.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/net.c b/src/net.c
index 8225ff2..d1944b5 100644
--- a/src/net.c
+++ b/src/net.c
@@ -156,11 +156,18 @@ int l_srequest(lua_State* L){
lua_pop(L, 1);
}
}
+
+ char* action = "GET";
+ if(params >= check + 1){
+ check++;
+ action = (char*)lua_tostring(L, check);
+ }
+
//char* req = "GET / HTTP/1.1\nHost: amyy.cc\nConnection: Close\n\n";
char* request = calloc(cont_len + header->len + 256, sizeof * request);
- sprintf(request, "GET %s HTTP/1.1\r\nHost: %s\r\nConnection: Close%s\r\n\r\n%s", path, host, header->c, cont);
+ sprintf(request, "%s %s HTTP/1.1\r\nHost: %s\r\nConnection: Close%s\r\n\r\n%s", action, path, host, header->c, cont);
str_free(header);
SSL_write(ssl, request, strlen(request));