rem: "Content-Type: multipart/related;type=\"application/rlmi+xml\";"
add: "multipart/related;type=\"application/rlmi+xml\";"
context: int create_rlmi_document(str *dst, str *content_type_dst, rl_subscription_t *s, int full_info){	dstring_t doc, cont;	char tmp[32];	char start_str[64];	char boundary_str[64];	char part_id[64];	if ((!s) || (!dst) || (!content_type_dst)) return RES_INTERNAL_ERR;	sprintf(start_str, "qwW%dpPdxX%d", rand(), rand());	sprintf(boundary_str, "RewXdpxR%dxA%d", rand(), rand());	sprintf(part_id, "id%di%dx", rand(), rand());		/* --- build NOTIFY body --- */	dstr_init(&doc, 256);	dstr_append(&doc, "--", 2);	dstr_append_zt(&doc, boundary_str);	dstr_append(&doc, "\r\n", 2);	dstr_append_zt(&doc, 			"Content-Transfer-Encoding: binary\r\n"			"Content-ID: ");	dstr_append_zt(&doc, start_str);	dstr_append_zt(&doc, "\r\n");	dstr_append_zt(&doc, 		"Content-Type: application/rlmi+xml;charset=\"UTF-8\"\r\n");	dstr_append(&doc, "\r\n", 2);		/* -- RLMI document -- */	dstr_append_zt(&doc, 		"<?xml version=\"1.0\"?>\r\n"		"<list xmlns=\"urn:ietf:params:xml:ns:rlmi\" "		"uri=\"");	dstr_append_str(&doc, rls_get_uri(s));	dstr_append_zt(&doc, "\" version=\"");	sprintf(tmp, "%d", s->doc_version); 	dstr_append_zt(&doc, tmp);	if (full_info) dstr_append_zt(&doc, "\" fullState=\"true\">\r\n");	else dstr_append_zt(&doc, "\" fullState=\"false\">\r\n");	/* add all virtual subscriptions to the RLMI document */	add_virtual_subscriptions_to_rlmi(&doc, s, part_id);	dstr_append_zt(&doc, "</list>\r\n\r\n");		/* add all virtual subscriptions status documents */	add_virtual_subscriptions_documents(&doc, s, boundary_str, part_id);		dstr_append(&doc, "--", 2);	dstr_append_zt(&doc, boundary_str);	dstr_append(&doc, "--\r\n", 4);	dstr_append(&doc, "\r\n", 2);		/* --- build content type --- */	dstr_init(&cont, 256);	dstr_append_zt(&cont, 			"Content-Type: multipart/related;type=\"application/rlmi+xml\";"			"start=\"");	dstr_append_zt(&cont, start_str);	dstr_append_zt(&cont, "\";boundary=\"");	dstr_append_zt(&cont, boundary_str);	dstr_append_zt(&cont, "\";\r\n");		/* --- store output strings --- */		dst->len = dstr_get_data_length(&doc);	dst->s = cds_malloc(dst->len);	if (!dst->s) dst->len = 0;	else dstr_get_data(&doc, dst->s);	dstr_destroy(&doc);		content_type_dst->len = dstr_get_data_length(&cont);	content_type_dst->s = cds_malloc(content_type_dst->len);	if (!content_type_dst->s) content_type_dst->len = 0;	else dstr_get_data(&cont, content_type_dst->s);	dstr_destroy(&cont);		/* increment version for next NOTIFY document */	s->doc_version++;	return RES_OK;}