/* HTMIME_anchor2response * Copies the anchor HTTP headers into a response object by means * of the generic _dispatchParsers function. Written so that we can * copy the HTTP headers stored in the cache to the response object. */ PRIVATE void HTMIME_anchor2response (HTRequest * req) { char * token; char * value; HTAssocList * header; HTAssoc * pres; HTResponse * res; HTParentAnchor * anchor; if (!req) return; anchor = HTRequest_anchor (req); header = HTAnchor_header (anchor); if (!anchor || !header) return; while ((pres = (HTAssoc *) HTAssocList_nextObject (header))) { token = HTAssoc_name (pres); value = HTAssoc_value (pres); _dispatchParsers (req, token, value); } /* ** Notify the response object not to delete the lists that we ** have inherited from the anchor object */ res = HTRequest_response (req); HTResponse_isCached (res, YES); }
PRIVATE int terminate_handler (HTRequest * request, HTResponse * response, void * param, int status) { HTParentAnchor * anchor = HTRequest_anchor(request); HTAssocList * headers = HTAnchor_header(anchor); /* ** Write out the remaining list of headers that we not already store ** in the index file. */ if (headers) { HTAssocList * cur = headers; HTAssoc * pres; while ((pres = (HTAssoc *) HTAssocList_nextObject(cur))) { char * name = HTAssoc_name(pres); char * value = HTAssoc_value(pres); /* Now see if we have a match for this header field */ if (match && HTStrCaseMatch(match, name)) HTPrint("%s: %s\n", name, value); } } /* stop the event loop */ HTEventList_stopLoop (); /* stop here */ return HT_ERROR; }
/* ** my_headers : shows anchor's headers ** Parameters : HTRequest * request */ PRIVATE void my_headers (HTRequest *request) { HTAssoc * h = NULL; HTAssocList * headers = NULL; HTParentAnchor * anchor = NULL; HTPrint ("%s: Searching headers...\n",APP_NAME); anchor = HTRequest_anchor (request); headers = HTAnchor_header(anchor); HTPrint ("\tanchor %s\n",(anchor)?"OK":"NULL"); h = HTAssocList_nextObject(headers); while (anchor && headers && h ) { HTPrint ("\t%s : %s\n",HTAssoc_name(h),HTAssoc_value(h)); h = HTAssocList_nextObject(headers); } }