Example #1
0
static void test_json_build(void)
{
	ACL_JSON* json = acl_json_alloc();
	ACL_JSON_NODE* root, *node1, *node2, *node3;

	root  = acl_json_create_obj(json);
	acl_json_node_append_child(json->root, root);

	node1 = acl_json_create_leaf(json, "name1", "value1");
	acl_json_node_append_child(root, node1);

	node1 = acl_json_create_leaf(json, "name2", "value2");
	acl_json_node_append_child(root, node1);

	node1 = acl_json_create_obj(json);
	node2 = acl_json_create_leaf(json, "name3", "value3");
	acl_json_node_append_child(node1, node2);
	node2 = acl_json_create_node(json, "name4", node1);
	acl_json_node_append_child(root, node2);

	//////////////////////////////////////////////////////////////////////////

	node1 = acl_json_create_array(json);
	node2 = acl_json_create_node(json, "name5", node1);
	acl_json_node_append_child(root, node2);

	node3 = acl_json_create_leaf(json, "name6", "value6");
	acl_json_node_append_child(node1, node3);

	node3 = acl_json_create_leaf(json, "name7", "value7");
	acl_json_node_append_child(node1, node3);

	node3 = acl_json_create_obj(json);
	acl_json_node_append_child(node1, node3);
	node2 = acl_json_create_leaf(json, "name8", "value8");
	acl_json_node_append_child(node3, node2);
	node2 = acl_json_create_leaf(json, "name9", "value9");
	acl_json_node_append_child(node3, node2);

	//////////////////////////////////////////////////////////////////////////

	ACL_VSTRING *buf1 = acl_vstring_alloc(128);
	ACL_VSTRING *buf2 = acl_vstring_alloc(128);

	acl_json_build(json, buf1);
	acl_json_building(json, 1, build_callback, buf2);

	printf("%s\r\n", acl_vstring_str(buf1));
	printf("%s\r\n", acl_vstring_str(buf2));

	if (strcmp(STR(buf1), STR(buf2)) != 0)
		printf("BUILD ERROR\r\n");
	else
		printf("BUILD OK\r\n");

	acl_vstring_free(buf1);
	acl_vstring_free(buf2);

	acl_json_free(json);
}
Example #2
0
void acl_xml_attr_free(ACL_XML_ATTR *attr)
{
    acl_vstring_free(attr->name);
    acl_vstring_free(attr->value);
    if (attr->node->xml->slice)
        acl_slice_pool_free(__FILE__, __LINE__, attr);
    else
        acl_myfree(attr);
}
Example #3
0
charset_conv::~charset_conv()
{
#ifdef  HAVE_H_ICONV
	if (m_iconv != (iconv_t) -1)
		__iconv_close(m_iconv);
	if (m_pInBuf)
		acl_vstring_free(m_pInBuf);
	if (m_pOutBuf)
		acl_vstring_free(m_pOutBuf);
#endif
	delete m_pBuf;
}
Example #4
0
static void parse_json(const char *data)
{
	ACL_JSON *json = acl_json_alloc();
	ACL_VSTRING *buf1 = acl_vstring_alloc(128);
	ACL_VSTRING *buf2 = acl_vstring_alloc(128);
	ACL_ARRAY *nodes;
	const char *tag = "header";

	printf("buf    src: %s\r\n", data);

	printf("------------------------------------------------\r\n");

	acl_json_update(json, data);
	acl_json_build(json, buf1);
	printf("result src: %s\r\n", STR(buf1));

	printf("------------------------------------------------\r\n");

	nodes = acl_json_getElementsByTagName(json, tag);
	if (nodes == NULL)
	{
		printf("not found tag: %s\r\n", tag);
		acl_vstring_free(buf1);
		acl_vstring_free(buf2);
		acl_json_free(json);
		return;
	}

	printf(">>>tag: %s, len: %d\r\n", tag, acl_array_size(nodes));

	ACL_ITER iter;

#define	STR	acl_vstring_str
#define	LEN	ACL_VSTRING_LEN

	acl_foreach(iter, nodes)
	{
		ACL_JSON_NODE *node = (ACL_JSON_NODE*) iter.data;
		ACL_JSON_NODE *tag_node = node->tag_node;
		if (tag_node == NULL)
			continue;

		printf(">>>tag: %s\r\n", STR(node->ltag));

		ACL_ITER iter2;
		acl_foreach(iter2, tag_node)
		{
			ACL_JSON_NODE *node1 = (ACL_JSON_NODE*) iter2.data;
			if (node1->ltag == NULL || LEN(node1->ltag) == 0)
				continue;
			printf(">>>child tag: %s, txt: %s\r\n", STR(node1->ltag),
				node1->text ? STR(node1->text) : "null");
		}
Example #5
0
static void acl_xml_node_free(ACL_XML_NODE *node)
{
    acl_vstring_free(node->ltag);
    acl_vstring_free(node->rtag);
    acl_vstring_free(node->text);
    acl_ring_detach(&node->node);
    acl_array_free(node->attr_list, (void (*)(void*)) acl_xml_attr_free);
    if (node->xml->slice)
        acl_slice_pool_free(__FILE__, __LINE__, node);
    else
        acl_myfree(node);
}
Example #6
0
int     tls_scache_update(TLS_SCACHE *cp, char *cache_id, const char *buf, ssize_t len)
{
    ACL_VSTRING *hex_data;

    /*
     * Logging.
     */
    if (cp->verbose)
	acl_msg_info("put %s session id=%s [data %ld bytes]",
		 cp->cache_label, cache_id, (long) len);

    /*
     * Encode the cache entry.
     */
    hex_data = tls_scache_encode(cp, cache_id, buf, len);

    /*
     * Store the cache entry.
     * 
     * XXX Berkeley DB supports huge database keys and values. SDBM seems to
     * have a finite limit, and DBM simply can't be used at all.
     */
    DICT_PUT(cp->db, cache_id, strlen(cache_id), STR(hex_data), LEN(hex_data));

    /*
     * Clean up.
     */
    acl_vstring_free(hex_data);

    return (1);
}
Example #7
0
static void token_tree_test(const char *tokens, const char *test_tab[])
{
	ACL_TOKEN *token_tree;
	ACL_TOKEN *token;
	const char *ptr, *psaved;
	ACL_VSTRING *buf = acl_vstring_alloc(256);
	int   i;

	token_tree = acl_token_tree_create(tokens);
	acl_token_tree_print(token_tree);

	for (i = 0; test_tab[i] != NULL; i++) {
		ptr = psaved = test_tab[i];
		token = acl_token_tree_match(token_tree, &ptr, ";", NULL);
		if (token) {
			ACL_VSTRING_RESET(buf);
			acl_token_name(token, buf);
			printf("match %s %s, token's name: %s\n", psaved,
				(token->flag & ACL_TOKEN_F_DENY) ? "DENY"
				: (token->flag & ACL_TOKEN_F_PASS ? "PASS" : "NONE"),
				STR(buf));
		} else
			printf("match %s none\n", psaved);
	}

	acl_token_tree_destroy(token_tree);
	acl_vstring_free(buf);
}
Example #8
0
void global::get_filename(const char* filepath, acl::string& buf)
{
	ACL_VSTRING* bp = acl_vstring_alloc(256);
	acl_sane_basename(bp, filepath);
	buf = acl_vstring_str(bp);
	acl_vstring_free(bp);
}
Example #9
0
static void mail_rcpt(MIME_NODE *node, const HEADER_OPTS *header_info)
{
	TOK822 *tree;
	TOK822 **addr_list;
	TOK822 **tpp;
	ACL_VSTRING *temp;
	const char *cp;

	temp = acl_vstring_alloc(10);
	cp = STR(node->buffer) + strlen(header_info->name) + 1;
	tree = tok822_parse(cp);
	addr_list = tok822_grep(tree, TOK822_ADDR);
	for (tpp = addr_list; *tpp; tpp++) {
		tok822_internalize(temp, tpp[0]->head, TOK822_STR_DEFL);
		if (header_info->type == HDR_TO) {
			node->header_to_list =
				mail_addr_add(node->header_to_list, STR(temp));
		} else if (header_info->type == HDR_CC) {
			node->header_cc_list =
				mail_addr_add(node->header_cc_list, STR(temp));
		} else if (header_info->type == HDR_BCC) {
			node->header_bcc_list =
				mail_addr_add(node->header_bcc_list, STR(temp));
		}
	}

	acl_myfree(addr_list);
	tok822_free_tree(tree);
	acl_vstring_free(temp);
}
Example #10
0
static void test71(void)
{
	ACL_VSTRING* buf = acl_vstring_alloc(256);

	acl_vstring_sprintf(buf, "max unsigned int: %u; max unsigned long long int: %llu",
		(unsigned int) -1, (unsigned long long) -1);
	acl_vstring_free(buf);
}
Example #11
0
File: main.c Project: 10jschen/acl
static void free_vstring(void *arg)
{
	const char *myname = "free_vstring";
	ACL_VSTRING *buf = (ACL_VSTRING*) arg;

	acl_vstring_free(buf);
	printf("%s: tid=%d, free vstring ok\n", myname, (int) acl_pthread_self());
}
Example #12
0
static void free_buf_fn(void *arg)
{
	ACL_VSTRING *buf = (ACL_VSTRING*) arg;

	printf(">> current thread id=%u, buf = %s\r\n",
		(unsigned int) acl_pthread_self(), acl_vstring_str(buf));
	acl_vstring_free(buf);
}
Example #13
0
global::global()
{
	const char* filepath = acl_process_path();
	ACL_VSTRING* path = acl_vstring_alloc(256);
	acl_sane_dirname(path, filepath);
	path_ = acl_vstring_str(path);
	acl_vstring_free(path);
}
Example #14
0
static int new_client_session_cb(SSL *ssl, SSL_SESSION *session)
{
    const char *myname = "new_client_session_cb";
    TLS_SESS_STATE *TLScontext;
    ACL_VSTRING *session_data;

    /*
     * The cache name (if caching is enabled in tlsmgr(8)) and the cache ID
     * string for this session are stored in the TLScontext. It cannot be
     * null at this point.
     */
    if ((TLScontext = SSL_get_ex_data(ssl, TLScontext_index)) == 0)
	acl_msg_panic("%s: null TLScontext in new session callback", myname);

    /*
     * We only get here if the cache_type is not empty. This callback is not
     * set unless caching is enabled and the cache_type is stored in the
     * server SSL context.
     */
    if (TLScontext->cache_type == 0)
	acl_msg_panic("%s: null session cache type in new session callback", myname);

    if (TLScontext->log_level >= 2)
	acl_msg_info("save session %s to %s cache", TLScontext->serverid, TLScontext->cache_type);

#if (OPENSSL_VERSION_NUMBER < 0x00906011L) || (OPENSSL_VERSION_NUMBER == 0x00907000L)

    /*
     * Ugly Hack: OpenSSL before 0.9.6a does not store the verify result in
     * sessions for the client side. We modify the session directly which is
     * version specific, but this bug is version specific, too.
     * 
     * READ: 0-09-06-01-1 = 0-9-6-a-beta1: all versions before beta1 have this
     * bug, it has been fixed during development of 0.9.6a. The development
     * version of 0.9.7 can have this bug, too. It has been fixed on
     * 2000/11/29.
     */
    session->verify_result = SSL_get_verify_result(TLScontext->con);
#endif

    /*
     * Passivate and save the session object. Errors are non-fatal, since
     * caching is only an optimization.
     */
    if ((session_data = tls_session_passivate(session)) != 0) {
	tls_mgr_update(TLScontext->cache_type, TLScontext->serverid,
		STR(session_data), (int) LEN(session_data));
	acl_vstring_free(session_data);
    }

    /*
     * Clean up.
     */
    SSL_SESSION_free(session);			/* 200502 */

    return (1);
}
Example #15
0
int main(int argc, char *argv[])
{
	char  ch;
	char  dns_ip[64], domain[128];
	int   dns_port = 53, ret;
	ACL_VSTRING *sbuf;

	dns_ip[0] = 0;
	domain[0] = 0;

	while ((ch = getopt(argc, argv, "h:p:d:")) > 0) {
		switch (ch) {
		case 'h':
			ACL_SAFE_STRNCPY(dns_ip, optarg, sizeof(dns_ip));
			break;
		case 'p':
			dns_port = atoi(optarg);
			break;
		case 'd':
			ACL_SAFE_STRNCPY(domain, optarg, sizeof(domain));
			break;
		default:
			usage(argv[0]);
			return (0);
		}
	}

	if (dns_ip[0] == 0 || domain[0] == 0) {
		usage(argv[0]);
		return (0);
	}

	sbuf = acl_vstring_alloc(128);
	ret = dns_lookup(domain, dns_ip, dns_port, sbuf);
	if (ret < 0) {
		printf("dns lookup(%s) error(%s)\r\n", domain, acl_vstring_str(sbuf));
		acl_vstring_free(sbuf);
		return (0);
	}

	printf("domain: %s\r\n%s", domain, acl_vstring_str(sbuf));
	acl_vstring_free(sbuf);
	return (0);
}
Example #16
0
static void __hdr_free_member(HTTP_HDR_REQ *hh)
{
	if (hh->url_part)
		acl_vstring_free(hh->url_part);
	if (hh->url_path)
		acl_vstring_free(hh->url_path);
	if (hh->url_params)
		acl_vstring_free(hh->url_params);
	if (hh->file_path)
		acl_vstring_free(hh->file_path);
	if (hh->params_table) {
		acl_htable_free(hh->params_table, __request_args_free_fn);
		hh->params_table = NULL;
	}
	if (hh->cookies_table) {
		acl_htable_free(hh->cookies_table, __cookies_args_free_fn);
		hh->cookies_table = NULL;
	}
}
Example #17
0
static void b64_encode(const char *ptr)
{
	ACL_VSTRING *str = acl_vstring_alloc(1);

	acl_vstring_base64_encode(str, ptr, strlen(ptr));

	printf(">>>encode result:%s\n", acl_vstring_str(str));

	acl_vstring_free(str);
}
Example #18
0
static void acl_token_name_walk(const ACL_TOKEN *token, void *arg)
{
	ACL_VSTRING *buf = (ACL_VSTRING*) arg;
	ACL_VSTRING *name = acl_vstring_alloc(256);

	acl_token_name(token, name);
	if (LEN(buf) > 0)
		ACL_VSTRING_ADDCH(buf, ';');
	acl_vstring_strcat(buf, STR(name));
	acl_vstring_free(name);
}
Example #19
0
static void test_buffer_gets(void)
{
	ACL_VSTRING *buf = acl_vstring_alloc(256);
	const ACL_VSTRING *pbuf;
	const char *src;
	size_t   i, n;
	unsigned char ch = (unsigned char) -1;

	for (i = 0; i < sizeof(string_tab) / sizeof(char*); i++) {
		printf("%s", string_tab[i]);
	}

	printf("------------------------------------------------------------\r\n");

	for (i = 0; i < sizeof(string_tab) / sizeof(char*); i++) {
		src = string_tab[i];
		n = strlen(src);
		while (1) {
			const char *psrc_saved = src;
			pbuf = acl_buffer_gets_nonl(buf, &src, n);
			if (pbuf) {
				printf("%s\n", STR(pbuf));
				ACL_VSTRING_RESET(buf);
				n -= src - psrc_saved;
				if (n == 0)
					break;
			} else
				break;
		}
	}

	printf("------------------------------------------------------------\r\n");

	for (i = 0; i < sizeof(string_tab) / sizeof(char*); i++) {
		src = string_tab[i];
		n = strlen(src);
		while (1) {
			const char *psrc_saved = src;
			pbuf = acl_buffer_gets(buf, &src, n);
			if (pbuf) {
				printf("%s", STR(pbuf));
				ACL_VSTRING_RESET(buf);
				n -= src - psrc_saved;
				if (n == 0)
					break;
			} else
				break;
		}
	}

	acl_vstring_free(buf);
	printf(">>>>>>>>>max ch: %d\n", ch);
}
Example #20
0
void acl_proctl_start_one(const char *progname,
	const char *progchild, int argc, char *argv[])
{
	const char *myname = "acl_proctl_start_one";
	char  ebuf[256], buf[1024];
	ACL_VSTREAM *client;
	ACL_VSTRING *child_args = NULL;
	int   n;

	if (argc > 0) {
		int   i;

		child_args = acl_vstring_alloc(256);
		for (i = 0; i < argc; i++) {
			if (i > 0)
				acl_vstring_strcat(child_args, " ");
			acl_vstring_strcat(child_args, "\"");
			acl_vstring_strcat(child_args, argv[i]);
			acl_vstring_strcat(child_args, "\"");
		}

	}

	/* 打开与控制进程之间的连接 */
	client = proctl_client_open(progname);
	if (child_args) {
		/* 向控制进程发送消息,带有控制参数 */
		n = acl_vstream_fprintf(client, "%s|-d|START|-f|%s|-a|%s\r\n",
				progname, progchild, acl_vstring_str(child_args));
	} else {
		/* 向控制进程发送消息,不带控制参数 */
		n = acl_vstream_fprintf(client, "%s|-d|START|-f|%s\r\n",
				progname, progchild);
	}

	if (child_args != NULL)
		acl_vstring_free(child_args);

	if (n == ACL_VSTREAM_EOF)
		acl_msg_fatal("%s(%d): fprintf to acl_proctl error(%s)",
			myname, __LINE__, acl_last_strerror(ebuf, sizeof(ebuf)));

	/* 接收所有来自于控制进程的消息响应结果 */
	while (1) {
		n = acl_vstream_gets_nonl(client, buf, sizeof(buf));
		if (n == ACL_VSTREAM_EOF)
			break;
		acl_msg_info("%s(%d): %s", myname, __LINE__, buf);
	}

	proctl_client_close(client);
}
Example #21
0
void proctl_service_free(PROCTL_SERVICE *service)
{
	if (service->hProcess != INVALID_HANDLE_VALUE)
		CloseHandle(service->hProcess);
	acl_myfree(service->filepath);
	acl_vstring_free(service->cmdline);

	LOCK_RUNNING_SERVICE;
	acl_array_delete_obj(__services, service, NULL);
	UNLOCK_RUNNING_SERVICE;

	acl_myfree(service);
}
Example #22
0
static void test_vstring_vsprintf(const char* fmt, ...)
{
	va_list ap;

	va_start(ap, fmt);
	ACL_VSTRING *vbf = acl_vstring_alloc(1);
	acl_vstring_vsprintf(vbf, fmt, ap);
	va_end(ap);

	printf("%s\n", acl_vstring_str(vbf));

	acl_vstring_free(vbf);
}
Example #23
0
void acl_token_tree_print(const ACL_TOKEN *token_tree)
{
	int   i;
	ACL_VSTRING *buf = acl_vstring_alloc(1024);

	for (i = 0; i < ACL_TOKEN_WIDTH; i++) {
		if (token_tree->tokens[i]) {
			acl_token_tree_walk(token_tree->tokens[i], acl_token_name_walk, buf);
		}
	}

	printf(">>>all token: (%s)\n", STR(buf));
	acl_vstring_free(buf);
}
Example #24
0
static void notify_thread(void *arg)
{
	const char *myname = "notify_thread";
	WARN_INFO *info = (WARN_INFO*) arg;
	ACL_VSTREAM *client;
	ACL_VSTRING *buf;
	int   ret;

	buf = acl_vstring_alloc(256);
	acl_vstring_sprintf(buf, "PROC=%s|PID=%d|RCPT=%s|info=%s\r\n",
		info->path, info->pid, info->notify_recipients, info->desc);

	client = acl_vstream_connect(info->notify_addr,
		ACL_BLOCKING, 60, 60, 1024);
	if (client == NULL) {
		acl_msg_error("%s(%d): connect %s error, info(%s)", myname,
			__LINE__, info->notify_addr, acl_vstring_str(buf));
		acl_vstring_free(buf);
		warn_info_free(info);
		return;
	}

	/* 禁止将该句柄传递给子进程 */
	acl_close_on_exec(ACL_VSTREAM_SOCK(client), ACL_CLOSE_ON_EXEC);

	ret = acl_vstream_writen(client, acl_vstring_str(buf),
		ACL_VSTRING_LEN(buf));
	if (ret == ACL_VSTREAM_EOF)
		acl_msg_error("%s(%d): write to notify server error, info(%s)",
			myname, __LINE__, acl_vstring_str(buf));
	else
		acl_msg_info("%s(%d): notify ok!", myname, __LINE__);

	acl_vstream_close(client);
	acl_vstring_free(buf);
	warn_info_free(info);
}
Example #25
0
static int sms_send(ACL_VSTREAM *client, const char *phone, const char *proc,
	int pid, const char *info, const char *ip)
{
	ACL_VSTRING *buf = acl_vstring_alloc(256);
	ACL_XML *xml = acl_xml_alloc();
	char  res[1024];
	int   ret;

	acl_vstring_sprintf(buf, "<send_sms phone=\"%s\" message=\"proc:%s, pid:%d, ip:%s, info:%s\" />",
			phone, proc, pid, ip, info);
	if (acl_vstream_writen(client, acl_vstring_str(buf), ACL_VSTRING_LEN(buf))
		== ACL_VSTREAM_EOF)
	{
		acl_msg_error("write to sms server error, msg: %s",
			acl_vstring_str(buf));
		acl_vstring_free(buf);
		return (-1);
	}

	acl_msg_info(">>send: %s", acl_vstring_str(buf));
	acl_vstring_free(buf);

	while (1) {
		ret = acl_vstream_read(client, res, sizeof(res) - 1);
		if (ret == ACL_VSTREAM_EOF)
			return (-1);
		res[ret] = 0;
		acl_xml_parse(xml, res);
		if (acl_xml_is_complete(xml, "send_sms")) {
			acl_msg_info("send ok!(%s)", res);
			break;
		}
	}

	return (0);
}
Example #26
0
int main(void)
{
	char *src = acl_mystrdup("hello \tworld! you're  welcome to China!");
	char *ptr, *src_saved;
	ACL_VSTRING* buf;
	const char* s = "hello";
	unsigned int   n1 = (unsigned int) -1;
	unsigned long  n2 = (unsigned long) -1;
	unsigned long long n3 = (unsigned long long) -1;
	const char *str2 = "hello world, you're welcome!";
	ACL_ARGV *tokens = acl_argv_split(str2, " \t,'!");
	ACL_ITER  iter;

	printf("----------------------------------------------\r\n");
	acl_foreach(iter, tokens)
		printf("tokens[%d]: %s\r\n", iter.i, (const char*) iter.data);
	printf("total: %d\r\n", iter.size);
	acl_argv_free(tokens);
	printf("----------------------------------------------\r\n");

	src_saved = src;
	printf("src: %s\r\n", src);
	while ((ptr = acl_mystrtok(&src, " \t!'")) != NULL)
	{
		printf("--------------------------------------\r\n");
		printf("ptr: |%s|\r\n", ptr);
		printf("src: |%s|\r\n", src);
		printf("src_saved: |%s|\r\n", src_saved);
	}

	acl_myfree(src_saved);

	printf("----------------------------------------------\r\n");

	buf = acl_vstring_alloc(1);
	acl_vstring_sprintf(buf, "%*lu, s: %s, n1: %20u, n2: %20lu, n3: %20llu\n",
		(int) sizeof(unsigned long) * 4, (unsigned long) getpid(),
		s, n1, n2, n3);
	printf("buf: %s\r\n", acl_vstring_str(buf));
	acl_vstring_free(buf);

	printf("Enter any key to continue ...\r\n");
	getchar();

	test_quote_split();

	return 0;
}
Example #27
0
static void test_buffer_space()
{
	ACL_VSTRING *vp = acl_vstring_alloc(1);
	char *ptr;
	int   i;

	ACL_VSTRING_SPACE(vp, 10);
	ptr = acl_vstring_str(vp);
	printf("=========================1====================\n");
	for (i = 0; i < 10; i++)
		*ptr++ = 'x';
	ptr = acl_vstring_str(vp);
	printf("gets: %d\n", acl_vstream_gets(ACL_VSTREAM_IN, ptr, 10));
	printf("=========================2====================\n");
	acl_vstring_free(vp);
}
Example #28
0
static void test61(void)
{
	ACL_VSTRING* buf;
	buf = acl_vstring_alloc(256);

	acl_vstring_strcpy(buf, "hello world!");
	acl_vstring_strcat(buf, "hello world!");
	acl_vstring_strcat(buf, "hello world!");

	acl_vstring_strcat(buf, "hello world!");
	acl_vstring_strcat(buf, "hello world!");
	acl_vstring_strcat(buf, "hello world!");
	acl_vstring_strcat(buf, "hello world!");
	acl_vstring_strcat(buf, "hello world!");
	acl_vstring_strcat(buf, "hello world!");
	acl_vstring_strcat(buf, "hello world!");
	acl_vstring_strcat(buf, "hello world!");

	acl_vstring_strcat(buf, "hello world!");
	acl_vstring_strcat(buf, "hello world!");
	acl_vstring_strcat(buf, "hello world!");
	acl_vstring_strcat(buf, "hello world!");
	acl_vstring_strcat(buf, "hello world!");
	acl_vstring_strcat(buf, "hello world!");
	acl_vstring_strcat(buf, "hello world!");
	acl_vstring_strcat(buf, "hello world!");

	acl_vstring_strcat(buf, "hello world!");
	acl_vstring_strcat(buf, "hello world!");
	acl_vstring_strcat(buf, "hello world!");
	acl_vstring_strcat(buf, "hello world!");
	acl_vstring_strcat(buf, "hello world!");
	acl_vstring_strcat(buf, "hello world!");
	acl_vstring_strcat(buf, "hello world!");
	acl_vstring_strcat(buf, "hello world!");

	acl_vstring_strcat(buf, "hello world!");
	acl_vstring_strcat(buf, "hello world!");
	acl_vstring_strcat(buf, "hello world!");
	acl_vstring_strcat(buf, "hello world!");
	acl_vstring_strcat(buf, "hello world!");
	acl_vstring_strcat(buf, "hello world!");
	acl_vstring_strcat(buf, "hello world!");
	acl_vstring_strcat(buf, "hello world!");

	acl_vstring_free(buf);
}
Example #29
0
void http_util_free(HTTP_UTIL *http_util)
{
	if ((http_util->flag & HTTP_UTIL_FLAG_SET_DUMP_FILE)) {
		if (http_util->dump_stream)
			acl_vstream_close(http_util->dump_stream);
	}

	if (http_util->stream)
		acl_vstream_close(http_util->stream);
	if (http_util->req_buf)
		acl_vstring_free(http_util->req_buf);
	if (http_util->hdr_req)
		http_hdr_req_free(http_util->hdr_req);
	if (http_util->http_res)
		http_res_free(http_util->http_res);
	else if (http_util->hdr_res)
		http_hdr_res_free(http_util->hdr_res);
	acl_myfree(http_util);
}
Example #30
0
static void __post_jail_init_fn(char *unused_name, char **unused_argv)
{
	char  myname[] = "__post_jail_init_fn";
	ACL_VSTRING *why = acl_vstring_alloc(100);

	unused_name = unused_name;
	unused_argv = unused_argv;

	if (acl_msg_verbose)
		acl_msg_info("%s(%d)->%s: test only",
				__FILE__, __LINE__, myname);

	__data_buf = acl_mymalloc(var_proxy_bufsize);
	if (__data_buf == NULL)
		acl_msg_fatal("%s(%d)->%s: malloc data_buf, serr = %s",
				__FILE__, __LINE__, myname,
				strerror(errno));

	if (var_proxy_debug_request) {
		__request_stream = acl_safe_open(var_proxy_request_file,
						O_CREAT | O_RDWR | O_APPEND, 0600,
						(struct stat *) 0, (uid_t)-1,
						(uid_t )-1, why);
		if (__request_stream == NULL)
			acl_msg_fatal("%s(%d)->%s: can't open %s, err = %s",
					__FILE__, __LINE__, myname,
					var_proxy_request_file, acl_vstring_str(why));
	}

	if (var_proxy_debug_respond) {
		__respond_stream = acl_safe_open(var_proxy_respond_file,
						O_CREAT | O_RDWR | O_APPEND, 0600,
						(struct stat *) 0, (uid_t)-1,
						(uid_t )-1, why);
		if (__respond_stream == NULL)
			acl_msg_fatal("%s(%d)->%s: can't open %s, err = %s",
					__FILE__, __LINE__, myname,
					var_proxy_respond_file, acl_vstring_str(why));
	}

	acl_vstring_free(why);
}