mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-01-31 11:37:35 +00:00
4effa23528
- POSIX regular expressions for Lua - Improved protocol parsing and encoding - Additional APIs for ZIP storage retrieval - Fix st_mode issue on NT for regular files - Generalized APIs for URL and Host handling - Worked out the kinks in resource resolution - Allow for custom error pages like /404.html
39 lines
1.1 KiB
C
39 lines
1.1 KiB
C
#ifndef COSMOPOLITAN_NET_HTTP_URL_H_
|
|
#define COSMOPOLITAN_NET_HTTP_URL_H_
|
|
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
|
COSMOPOLITAN_C_START_
|
|
|
|
struct UrlView {
|
|
size_t n;
|
|
char *p;
|
|
};
|
|
|
|
struct UrlParams {
|
|
size_t n;
|
|
struct UrlParam {
|
|
struct UrlView key;
|
|
struct UrlView val;
|
|
} * p;
|
|
};
|
|
|
|
struct Url {
|
|
struct UrlView scheme; /* must be [A-Za-z][-+.0-9A-Za-z]* or empty */
|
|
struct UrlView user; /* depends on host non-absence */
|
|
struct UrlView pass; /* depends on user non-absence */
|
|
struct UrlView host; /* or reg_name */
|
|
struct UrlView port; /* depends on host non-absence */
|
|
struct UrlView path; /* or opaque_part */
|
|
struct UrlParams params;
|
|
struct UrlView fragment;
|
|
};
|
|
|
|
char *EncodeUrl(struct Url *, size_t *);
|
|
char *ParseUrl(const char *, size_t, struct Url *);
|
|
char *ParseParams(const char *, size_t, struct UrlParams *);
|
|
char *ParseRequestUri(const char *, size_t, struct Url *);
|
|
char *ParseHost(const char *, size_t, struct Url *);
|
|
char *EscapeUrlView(char *, struct UrlView *, const char[256]);
|
|
|
|
COSMOPOLITAN_C_END_
|
|
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
|
#endif /* COSMOPOLITAN_NET_HTTP_URL_H_ */
|