Files
2026-08-06 17:40:27 +03:00

28 lines
999 B
C
Executable File

#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();
int CleanupHTTP();