implemented keepalive

This commit is contained in:
winsped
2026-08-06 17:40:27 +03:00
parent 271121ec07
commit f32ec710ff
6 changed files with 477 additions and 350 deletions
+17 -1
View File
@@ -1,10 +1,26 @@
#include <winsock2.h>
#include <ws2tcpip.h>
#include <openssl/ssl.h>
// keepalive state
typedef struct {
SOCKET sock;
SSL* ssl;
SSL_CTX* ctx;
char hostname[256];
int connected;
} HTTPConnection;
void InitSockets();
int SendShortHTTPReq(const char *hostname, const char *reqtype,
const char *endpoint, const char *extra_headers,
const char *user_agent, const char *content_type,
void *payload, unsigned long payload_size, char** response, long* responselen);
HTTPConnection* HTTPConnect(const char* hostname);
int SendHTTPRequest(HTTPConnection* conn, const char* method, const char* endpoint, const char* extra_headers,
const char* user_agent, const char* content_type, void* payload,
unsigned long payload_size, char** response, long* responselen);
int CloseHTTPConnection(HTTPConnection* conn);
static void AppendHeader(char *buf, const char *key, const char *value);
int InitHTTP();