Beispiel #1
0
static unsigned int
vdirect_reply(struct http_request *request, void *data)
{
	struct agent_core_t *core = data;
	struct vdirect_priv_t *vdirect;
	char *cmd, *p;

	GET_PRIV(core, vdirect);
	DUP_OBJ(cmd, request->data, request->ndata);
	p = strchr(cmd, '\n');
	if (p)
		*p = '\0';
	run_and_respond(vdirect->vadmin, request->connection, cmd);
	free(cmd);
	return (0);
}
Beispiel #2
0
static unsigned int
vstat_push_url(struct http_request *request, const char *arg, void *data)
{
	struct vstat_priv_t *vstat;
	struct agent_core_t *core = data;

	(void)arg;
	GET_PRIV(core, vstat);
	pthread_rwlock_wrlock(&vstat->lck);
	if (vstat->push_url)
		free(vstat->push_url);
	DUP_OBJ(vstat->push_url, request->body, request->bodylen);
	logger(vstat->http.logger, "Got url: \"%s\"", vstat->push_url);
	pthread_rwlock_unlock(&vstat->lck);
	http_reply(request->connection, 200, "Url stored");
	return (0);
}