⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 htmimimp.c

📁 www工具包. 这是W3C官方支持的www支撑库. 其中提供通用目的的客户端的WebAPI: complete HTTP/1.1 (with caching, pipelining, PUT, POS
💻 C
📖 第 1 页 / 共 2 页
字号:
				   (HTLinkType) HTAtom_caseFor(val),				   METHOD_INVALID);		    } else if (!strcasecomp(name, "rev") && val && *val) {			HTTRACE(STREAM_TRACE, "MIMEParser.. Link reverse relationship `%s\'\n" _ 				    val);			HTLink_add((HTAnchor *) parent_dest, (HTAnchor *) me,				   (HTLinkType) HTAtom_caseFor(val),				   METHOD_INVALID);		    } else if (!strcasecomp(name, "type") && val && *val) {			HTTRACE(STREAM_TRACE, "MIMEParser.. Link type `%s\'\n" _ val);			if (HTAnchor_format(parent_dest) == WWW_UNKNOWN)			    HTAnchor_setFormat(parent_dest, (HTFormat) HTAtom_caseFor(val));		    } else			HTTRACE(STREAM_TRACE, "MIMEParser.. Link unknown `%s\' with value `%s\'\n" _ 				    name _ val ? val : "<null>");		}	    }	}    }    return HT_OK;}PUBLIC int HTMIME_location (HTRequest * request, HTResponse * response,			    char * token, char * value){    HTAnchor * redirection = NULL;    char * location = HTStrip(value);    /*    **  If not absolute URI (Error) then find the base    */    if (!HTURL_isAbsolute(location)) {	char * base = HTAnchor_address((HTAnchor *) HTRequest_anchor(request));	location = HTParse(location, base, PARSE_ALL);	redirection = HTAnchor_findAddress(location);	HT_FREE(base);	HT_FREE(location);    } else {	redirection = HTAnchor_findAddress(location);    }    HTResponse_setRedirection(response, redirection);    return HT_OK;}PUBLIC int HTMIME_maxForwards (HTRequest * request, HTResponse * response,			       char * token, char * value){    return HT_OK;}PUBLIC int HTMIME_messageDigest (HTRequest * request, HTResponse * response,				 char * token, char * value){    HTResponse_addChallenge(response, "Digest-MessageDigest", value);    return HT_OK;}PUBLIC int HTMIME_pragma (HTRequest * request, HTResponse * response,			  char * token, char * value){    /*    **  Walk through the set of pragma directives and search for one that may    **  affect the cachability of this object    */    char * name_val;    while ((name_val = HTNextPair(&value)) != NULL) {	char * name = HTNextField(&name_val);	if (name) {	    if (!strcasecomp(name, "no-cache")) {		HTResponse_setCachable(response, HT_NO_CACHE);		HTTRACE(STREAM_TRACE, "MIMEParser.. No-Cache Pragma\n");	    }	}    }    return HT_OK;}PUBLIC int HTMIME_protocol (HTRequest * request, HTResponse * response,			    char * token, char * value){    char * param = NULL;    char * protocol = HTNextSExp(&value, &param);    if (protocol) {	HTTRACE(PROT_TRACE, "Protocol.... Name: `%s\', value: `%s\'\n" _ 		    protocol _ param);	HTResponse_addProtocol(response, protocol, param);    }    return HT_OK;}PUBLIC int HTMIME_protocolInfo (HTRequest * request, HTResponse * response,				char * token, char * value){    char * param = NULL;    char * info = HTNextSExp(&value, &param);    if (info) {	HTTRACE(PROT_TRACE, "Protocol.... Info: `%s\', value: `%s\'\n" _ 		    info _ param);	HTResponse_addProtocolInfo(response, info, param);    }    return HT_OK;}PUBLIC int HTMIME_protocolRequest (HTRequest * request, HTResponse * response,				   char * token, char * value){    char * param = NULL;    char * preq = HTNextSExp(&value, &param);    if (preq) {	HTTRACE(PROT_TRACE, "Protocol.... Request: `%s\', value: `%s\'\n" _ 		    preq _ param);	HTResponse_addProtocolRequest(response, preq, param);    }    return HT_OK;}PUBLIC int HTMIME_proxyAuthorization (HTRequest * request, HTResponse * response,				      char * token, char * value){    return HT_OK;}PUBLIC int HTMIME_proxyAuthenticationInfo (HTRequest * request, 					   HTResponse * response,					   char * token, char * value){  /* deal here with the next nonce, the qop, and the digest response (mutual     authentication  */    if (token && value) {    HTResponse_addChallenge(response, token, value);    HTResponse_setScheme(response, "digest");  }  return HT_OK;}PUBLIC int HTMIME_public (HTRequest * request, HTResponse * response,			  char * token, char * value){    char * field;    HTNet * net = HTRequest_net(request);    HTHost * host = HTNet_host(net);    while ((field = HTNextField(&value)) != NULL) {        HTMethod new_method;	/* We treat them as case-insensitive! */	if ((new_method = HTMethod_enum(field)) != METHOD_INVALID)	    HTHost_appendPublicMethods(host, new_method);    }    HTTRACE(STREAM_TRACE, "MIMEParser.. Public methods: %d\n" _ 		HTHost_publicMethods(host));    return HT_OK;}PUBLIC int HTMIME_range (HTRequest * request, HTResponse * response,			 char * token, char * value){    return HT_OK;}PUBLIC int HTMIME_referer (HTRequest * request, HTResponse * response,			   char * token, char * value){    return HT_OK;}PUBLIC int HTMIME_retryAfter (HTRequest * request, HTResponse * response,			      char * token, char * value){    HTUserProfile * up = HTRequest_userProfile(request);    HTResponse_setRetryTime(response, HTParseTime(value, up, YES));    return HT_OK;}PUBLIC int HTMIME_server (HTRequest * request, HTResponse * response,			  char * token, char * value){    char * field;    HTNet * net = HTRequest_net(request);    HTHost * host = HTNet_host(net);    if ((field = HTNextField(&value)) != NULL)        HTHost_setServer(host, field);    return HT_OK;}PUBLIC int HTMIME_transferEncoding (HTRequest * request, HTResponse * response,				    char * token, char * value){    char * field;    while ((field = HTNextField(&value)) != NULL) {        char * lc = field;	while ((*lc = TOLOWER(*lc))) lc++;	HTResponse_addTransfer(response, HTAtom_for(field));    }    return HT_OK;}PUBLIC int HTMIME_trailer (HTRequest * request, HTResponse * response,			   char * token, char * value){    /*    **  Walk through the set of trailer directives and add them to the    **  response association list for trailer directives    */    char * name_val;    while ((name_val = HTNextPair(&value)) != NULL) {	char * name = HTNextField(&name_val);	char * val = HTNextField(&name_val);	if (name) HTResponse_addTrailer(response, name, val ? val : "");    }    return HT_OK;}PUBLIC int HTMIME_upgrade (HTRequest * request, HTResponse * response,			   char * token, char * value){    return HT_OK;}PUBLIC int HTMIME_userAgent (HTRequest * request, HTResponse * response,			     char * token, char * value){    char * field;    HTNet * net = HTRequest_net(request);    HTHost * host = HTNet_host(net);    if ((field = HTNextField(&value)) != NULL)        HTHost_setUserAgent(host, field);    return HT_OK;}PUBLIC int HTMIME_vary (HTRequest * request, HTResponse * response,			char * token, char * value){    /*    **  Walk through the set of vary directives and add them to the    **  response association list for vary directives    */    char * name_val;    while ((name_val = HTNextPair(&value)) != NULL) {	char * name = HTNextField(&name_val);	char * val = HTNextField(&name_val);	if (name) HTResponse_addVariant(response, name, val ? val : "");    }    return HT_OK;}PUBLIC int HTMIME_via (HTRequest * request, HTResponse * response,		       char * token, char * value){    return HT_OK;}PUBLIC int HTMIME_warning (HTRequest * request, HTResponse * response,			   char * token, char * value){    char * codestr = HTNextField(&value);    char * agent = HTNextField(&value);    if (codestr && agent) {	int code = atoi(codestr);	int idx;	char * ptr;	if (code==10) idx=HTERR_STALE; else	    if (code==11) idx=HTERR_REVALIDATION_FAILED; else		if (code==12) idx=HTERR_DISCONNECTED_CACHE; else		    if (code==13) idx=HTERR_HEURISTIC_EXPIRATION; else			if (code==14) idx=HTERR_TRANSFORMED; else			    idx=HTERR_CACHE;	if ((ptr = strchr(agent, '\r')) != NULL)	  /* Strip \r and \n */	    *ptr = '\0';	else if ((ptr = strchr(agent, '\n')) != NULL)	    *ptr = '\0';	HTRequest_addError(request, ERR_WARN, NO, idx, agent,			   (int) strlen(agent), "HTMIME_warning");    } else {	HTTRACE(STREAM_TRACE, "MIMEParser.. Invalid warning\n");    }    return HT_OK;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -