2022-07-25 14:48:59 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
2026-01-06 09:48:38 +08:00
|
|
|
#include "common/thread.h"
|
|
|
|
|
#include "common/FFstrbuf.h"
|
2022-07-25 14:48:59 +02:00
|
|
|
|
2022-10-14 16:39:48 +08:00
|
|
|
#ifdef _WIN32
|
2022-11-02 01:03:01 +08:00
|
|
|
#include <minwindef.h>
|
2022-10-12 19:35:23 +08:00
|
|
|
#endif
|
|
|
|
|
|
2025-03-15 19:49:51 +08:00
|
|
|
struct addrinfo;
|
|
|
|
|
|
2022-11-02 01:03:01 +08:00
|
|
|
typedef struct FFNetworkingState {
|
|
|
|
|
#ifdef _WIN32
|
2022-11-02 17:29:43 +08:00
|
|
|
uintptr_t sockfd;
|
|
|
|
|
OVERLAPPED overlapped;
|
2022-11-02 01:03:01 +08:00
|
|
|
#else
|
2022-11-02 17:29:43 +08:00
|
|
|
int sockfd;
|
2025-03-15 19:49:51 +08:00
|
|
|
struct addrinfo* addr;
|
2022-11-02 17:29:43 +08:00
|
|
|
|
|
|
|
|
#ifdef FF_HAVE_THREADS
|
|
|
|
|
FFThreadType thread;
|
|
|
|
|
#endif
|
2022-11-02 01:03:01 +08:00
|
|
|
#endif
|
2024-03-20 14:25:59 +08:00
|
|
|
|
2026-01-06 15:33:12 +08:00
|
|
|
FFstrbuf command;
|
2024-03-20 14:25:59 +08:00
|
|
|
uint32_t timeout;
|
2024-05-09 10:13:04 +08:00
|
|
|
bool ipv6;
|
2025-03-18 09:56:35 +08:00
|
|
|
bool compression; // if true, HTTP content compression will be enabled if supported
|
2025-03-18 10:20:23 +08:00
|
|
|
bool tfo; // if true, TCP Fast Open will be attempted first, and fallback to traditional connection if it fails
|
2022-11-02 01:03:01 +08:00
|
|
|
} FFNetworkingState;
|
|
|
|
|
|
2024-03-20 13:52:39 +08:00
|
|
|
const char* ffNetworkingSendHttpRequest(FFNetworkingState* state, const char* host, const char* path, const char* headers);
|
2024-03-20 14:25:59 +08:00
|
|
|
const char* ffNetworkingRecvHttpResponse(FFNetworkingState* state, FFstrbuf* buffer);
|
2025-03-15 23:35:58 +08:00
|
|
|
|
|
|
|
|
#ifdef FF_HAVE_ZLIB
|
|
|
|
|
const char* ffNetworkingLoadZlibLibrary(void);
|
|
|
|
|
bool ffNetworkingDecompressGzip(FFstrbuf* buffer, char* headerEnd);
|
|
|
|
|
#endif
|