示例#1
0
HTTP_HDR_REQ *http_hdr_req_clone(const HTTP_HDR_REQ* hdr_req)
{
	HTTP_HDR_REQ *hh;

	hh = http_hdr_req_new();
	http_hdr_clone(&hdr_req->hdr, &hh->hdr);

	hh->port = hdr_req->port;
	ACL_SAFE_STRNCPY(hh->method, hdr_req->method, sizeof(hh->method));
	ACL_SAFE_STRNCPY(hh->host, hdr_req->host, sizeof(hh->host));
	acl_vstring_strcpy(hh->url_part, acl_vstring_str(hdr_req->url_part));
	acl_vstring_strcpy(hh->url_path, acl_vstring_str(hdr_req->url_path));
	acl_vstring_strcpy(hh->url_params, acl_vstring_str(hdr_req->url_params));
	acl_vstring_strcpy(hh->file_path, acl_vstring_str(hdr_req->file_path));

	if (hdr_req->params_table) {
		hh->params_table = acl_htable_create(__http_hdr_max_request, 0);
		acl_htable_walk(hdr_req->params_table, clone_table_entry,
				(void*) hh->params_table);
	}
	if (hdr_req->cookies_table) {
		hh->cookies_table = acl_htable_create(__http_hdr_max_cookies, 0);
		acl_htable_walk(hdr_req->cookies_table, clone_table_entry,
				(void*) hh->cookies_table);
	}

	return hh;
}
示例#2
0
HTTP_HDR_RES *http_hdr_res_clone(const HTTP_HDR_RES *hdr_res)
{
	HTTP_HDR_RES *hh;

	hh = http_hdr_res_new();
	http_hdr_clone(&hdr_res->hdr, &hh->hdr);

	hh->reply_status = hdr_res->reply_status;
	return (hh);
}