Пример #1
0
static void __hdr_reset(HTTP_HDR_REQ *hh, int clear_cookies)
{
	hh->port = 80;
	hh->method[0] = 0;
	hh->host[0] = 0;
	hh->flag = 0;

	if (hh->url_part) {
		ACL_VSTRING_RESET(hh->url_part);
		ACL_VSTRING_TERMINATE(hh->url_part);
	}

	if (hh->url_path) {
		ACL_VSTRING_RESET(hh->url_path);
		ACL_VSTRING_TERMINATE(hh->url_path);
	}

	if (hh->url_params) {
		ACL_VSTRING_RESET(hh->url_params);
		ACL_VSTRING_TERMINATE(hh->url_params);
	}

	if (hh->file_path) {
		ACL_VSTRING_RESET(hh->file_path);
		ACL_VSTRING_TERMINATE(hh->file_path);
	}

	if (hh->params_table)
		acl_htable_reset(hh->params_table, __request_args_free_fn);

	if (clear_cookies && hh->cookies_table)
		acl_htable_reset(hh->cookies_table, __cookies_args_free_fn);
}
Пример #2
0
void acl_xml_reset(ACL_XML *xml)
{
    const char *myname = "acl_xml_reset";
    ACL_RING *next;
    ACL_XML_NODE *node;

    while ((next = acl_ring_pop_head(&xml->root->children)) != NULL) {
        node = acl_ring_to_appl(next, ACL_XML_NODE, node);
        (void) acl_xml_node_delete(node);
    }

    /* 因为根结点是一个虚结点,所以不需要释放,其会在调用
     * acl_xml_free 时被释放
     */
    acl_ring_detach(&xml->root->node);
    acl_xml_node_reset(xml->root);

    if (xml->node_cnt != 1)
        acl_msg_fatal("%s(%d): node_cnt(%d) invalid",
                      myname, __LINE__, xml->node_cnt);

    acl_htable_reset(xml->id_table, NULL);
    xml->curr_node = NULL;
}