📄 url.h
字号:
#ifndef __URL_H#define __URL_H/********************* class Url definition **********/#include "dget.h"/* URL separator (for findurl) */#define URL_SEPARATOR "!\"#'(),>`{}|<>"/* Tha smaller value of the two. */#define MINVAL(x, y) ((x) < (y) ? (x) : (y))/* ASCII char -> HEX digit */#define ASC2HEXD(x) (((x) >= '0' && (x) <= '9') ? \ ((x) - '0') : (toupper(x) - 'A' + 10))/* HEX digit -> ASCII char */#define HEXD2ASC(x) (((x) >= 0 && (x) <= 9) ? \ ((x) + '0') : ((x) - 10 + 'A'))/* A list of unsafe characters for encoding, as per RFC1738. '@' and ':' (not listed in RFC) were added because of user/password encoding, and \033 because of safe printing. */#define URL_UNSAFE " <>\"#%{}|\\^~[]`@:\033"/* If the string contains unsafe characters, duplicate it with encode_string, otherwise just copy it with strdup. */#define CLEANDUP(x) (contains_unsafe(x) ? encode_string(x) : nstrdup(x))/* Just another ugly macro (defines a static local char *). */#define URL_CLEANSE(s) \ do { if (contains_unsafe(s)) { static char *tmp; \ tmp = encode_string(s); free(s); s = tmp; }} while (0);/* Is a directory "."? */#define ISDOT(x) ((*(x) == '.') && (!*(x + 1)))/* Is a directory ".."? */#define ISDDOT(x) ((*(x) == '.') && (*(x + 1) == '.') && (!*(x + 2)))#define USE_PROXY(u) (opt.use_proxy && getproxy((u)->proto) \ && no_proxy_match((u)->host, \ (const char **)opt.no_proxy))enum uflags { URELATIVE = 0x0001, /* Is URL relative? */ UNOPROTO = 0x0002, /* Is URL without a protocol? */ UABS2REL = 0x0004, /* Convert absolute to relative?*/ UREL2ABS = 0x0008 /* Convert relative to absolute? */};class TUrl{public : char * Addr; proto_t Proto; long Port; char * UserName; char * PassWord; char * HostName; char * HostPath; char * HostDirName; char * HostFileName; bool ResumeSupport; long FileSize;public : TUrl(const char * s); ~TUrl(); void ParseUrl(void);// void DispUrl(void); void SimplifyPath(char * Path); bool IsContainUnsafe(const char * s); void DecodeString(char *); char * EncodeString(const char *);};#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -