41#ifndef __NILOREA_HTTP3_HEADER
42#define __NILOREA_HTTP3_HEADER
56#define N_HTTP3_DEFAULT_TIMEOUT_MS 15000
58#define N_HTTP3_BODY_CAP (16u * 1024u * 1024u)
66#define N_HTTP3_REQ_ALLOW_ILLEGAL_HEADERS 1u
99int n_http3_parse_url(
const char* url,
char* host,
size_t hostsz,
char*
port,
size_t portsz,
char* path,
size_t pathsz);
118int n_http3_request(
const char* method,
const char* url,
const char* headers,
const unsigned char* body,
size_t body_len,
int timeout_ms,
N_HTTP3_RESPONSE* out);
141int n_http3_request_ex(
const char* method,
const char* url,
const char* headers,
const unsigned char* body,
size_t body_len,
int timeout_ms,
unsigned flags,
N_HTTP3_RESPONSE* out);
char * headers
Response header block as joined "name: value\r\n" lines (lowercased names), or NULL.
int status
HTTP status code, or 0 if none was received.
size_t body_len
Number of valid bytes in body.
unsigned char * body
Response body bytes (NOT NUL-terminated), or NULL.
char * error
Failure reason (heap), or NULL on a completed exchange.
int n_http3_parse_url(const char *url, char *host, size_t hostsz, char *port, size_t portsz, char *path, size_t pathsz)
Split an https URL into host, port and path (pure; available in every build).
int n_http3_request_ex(const char *method, const char *url, const char *headers, const unsigned char *body, size_t body_len, int timeout_ms, unsigned flags, N_HTTP3_RESPONSE *out)
Perform one blocking HTTP/3 request, with request flags.
int n_http3_get(const char *url, int timeout_ms, N_HTTP3_RESPONSE *out)
Convenience wrapper: HTTP/3 GET of url.
int n_http3_request(const char *method, const char *url, const char *headers, const unsigned char *body, size_t body_len, int timeout_ms, N_HTTP3_RESPONSE *out)
Perform one blocking HTTP/3 request over a fresh QUIC connection.
int n_http3_available(void)
Report whether HTTP/3 support was compiled into the library.
void n_http3_response_free(N_HTTP3_RESPONSE *r)
Free the heap buffers held by r and zero the struct (safe on NULL / zeroed).
Result of an HTTP/3 exchange.