#pragma lib "liburl.a"
#pragma src "/sys/src/liburl"
/*
* If ischeme is USunknown, then the given URL is a relative
* URL which references the "current document" in the context of the base.
* If this is the case, only the "fragment" and "url" members will have
* meaning, and the given URL structure may not be used as a base URL itself.
*/
enum
{
USunknown,
UShttp,
UShttps,
USftp,
USfile,
UScurrent,
};
typedef struct Url Url;
struct Url
{
int ischeme;
char *url;
char *scheme;
char *schemedata;
char *authority;
char *user;
char *passwd;
char *host;
char *port;
char *path;
char *query;
char *fragment;
void *aux;
union {
struct {
char *page_spec;
} http;
struct {
char *path_spec;
char *type;
} ftp;
};
};
/* url.c */
Url * parseurl(char*, Url*);
void freeurl(Url*);
void rewriteurl(Url*);
int seturlquery(Url*, char*);
Url * copyurl(Url*);
char *escapeurl(char*, int(*)(int));
char *unescapeurl(char*);
void initurl(void);
|