add: dstr_append_zt(&dstr, "\r\n");
context: static int rls_generate_notify_ext(rl_subscription_t *s, int full_info){	/* !!! the main mutex must be locked here !!! */	int res;	str doc;	dstring_t dstr;	str headers, content_type;	static str method = STR_STATIC_INIT(METHOD_NOTIFY);	dlg_t *dlg;		dlg = s->external.dialog;	if (!dlg) return -1;	str_clear(&doc);	str_clear(&content_type);	if (sm_subscription_pending(&s->external) != 0) {		/* create the document only for non-pending subscriptions */		if (create_rlmi_document(&doc, &content_type, s, full_info) != 0) {			return -1;		}	}		dstr_init(&dstr, 256);	dstr_append_zt(&dstr, "Subscription-State: ");	switch (s->external.status) {		case subscription_active: 				dstr_append_zt(&dstr, "active\r\n");				break;		case subscription_pending: 				dstr_append_zt(&dstr, "pending\r\n");				break;		case subscription_terminated_pending: 		case subscription_terminated: 				dstr_append_zt(&dstr, "terminated\r\n");				break;		case subscription_terminated_pending_to: 		case subscription_terminated_to: 				dstr_append_zt(&dstr, 					"terminated;reason=timeout\r\n");				break;		case subscription_uninitialized: 				dstr_append_zt(&dstr, "pending\r\n");				/* this is an error ! */				LOG(L_ERR, "sending NOTIFY for an unitialized subscription!\n");				break;	}	dstr_append_str(&dstr, &s->external.contact);		dstr_append_zt(&dstr, "Event: ");	dstr_append_str(&dstr, rls_get_package(s));	dstr_append_zt(&dstr, "\r\n");	dstr_append_zt(&dstr, "Require: eventlist\r\n");	dstr_append_str(&dstr, &content_type);	headers.len = dstr_get_data_length(&dstr);	headers.s = cds_malloc(headers.len);	if (!headers.s) headers.len = 0;	else dstr_get_data(&dstr, headers.s);	dstr_destroy(&dstr);	/* DEBUG_LOG("sending NOTIFY message to %.*s (subscription %p)\n",  			dlg->rem_uri.len, 			ZSW(dlg->rem_uri.s), s); */		if (sm_subscription_terminated(&s->external) == 0) {		/* doesn't matter if delivered or not, it will be freed otherwise !!! */		res = tmb.t_request_within(&method, &headers, &doc, dlg, 0, 0);	}	else {		/* the subscritpion will be destroyed if NOTIFY delivery problems */		rls_unlock(); /* the callback locks this mutex ! */				/* !!!! FIXME: callbacks can't be safely used (may be called or not,		 * may free memory automaticaly or not) !!! */		res = tmb.t_request_within(&method, &headers, &doc, dlg, 0, 0);		/*		res = tmb.t_request_within(&method, &headers, &doc, dlg, rls_notify_cb, s); */		rls_lock(); /* the callback locks this mutex ! */		if (res < 0) {			/* does this mean, that the callback was not called ??? */			LOG(L_ERR, "rls_generate_notify(): t_request_within FAILED: %d! Freeing RL subscription.\n", res);			rls_remove(s); /* ?????? */		}	}		if (doc.s) cds_free(doc.s);	if (content_type.s) cds_free(content_type.s);	if (headers.s) cds_free(headers.s);		if (use_db) rls_db_update(s);		return res;}