Files
fastfetch/src/util/networking.h
T

39 lines
1.0 KiB
C
Raw Normal View History

#pragma once
2026-01-05 16:19:47 +08:00
#include "util/thread.h"
#include "util/FFstrbuf.h"
2022-10-14 16:39:48 +08:00
#ifdef _WIN32
#include <minwindef.h>
2022-10-12 19:35:23 +08:00
#endif
struct addrinfo;
typedef struct FFNetworkingState {
#ifdef _WIN32
uintptr_t sockfd;
OVERLAPPED overlapped;
#else
int sockfd;
FFstrbuf command;
struct addrinfo* addr;
#ifdef FF_HAVE_THREADS
FFThreadType thread;
#endif
#endif
uint32_t timeout;
2024-05-09 10:13:04 +08:00
bool ipv6;
bool compression; // if true, HTTP content compression will be enabled if supported
bool tfo; // if true, TCP Fast Open will be attempted first, and fallback to traditional connection if it fails
} FFNetworkingState;
const char* ffNetworkingSendHttpRequest(FFNetworkingState* state, const char* host, const char* path, const char* headers);
const char* ffNetworkingRecvHttpResponse(FFNetworkingState* state, FFstrbuf* buffer);
#ifdef FF_HAVE_ZLIB
const char* ffNetworkingLoadZlibLibrary(void);
bool ffNetworkingDecompressGzip(FFstrbuf* buffer, char* headerEnd);
#endif