43 lines
640 B
C
43 lines
640 B
C
#ifndef NX_URL_H
|
|
#define NX_URL_H
|
|
|
|
#include "nx_types.h"
|
|
|
|
#if defined(__cplusplus)
|
|
extern "C" {
|
|
#endif
|
|
|
|
#define NX_URL_MAX_HOST 256
|
|
#define NX_URL_MAX_PATH 2048
|
|
|
|
typedef enum {
|
|
NX_SCHEME_HTTP,
|
|
NX_SCHEME_HTTPS,
|
|
NX_SCHEME_UNKNOWN
|
|
} nx_scheme;
|
|
|
|
typedef struct nx_url {
|
|
nx_scheme scheme;
|
|
|
|
char host[NX_URL_MAX_HOST];
|
|
int port;
|
|
int host_is_ipv6_literal;
|
|
|
|
char path[NX_URL_MAX_PATH];
|
|
|
|
const char *query;
|
|
const char *fragment;
|
|
|
|
char request_target[NX_URL_MAX_PATH];
|
|
} nx_url;
|
|
|
|
int nx_url_parse(const char *url, nx_url *out);
|
|
|
|
const char *nx_url_error(void);
|
|
|
|
#if defined(__cplusplus)
|
|
}
|
|
#endif
|
|
|
|
#endif
|