show user-agent, username and ip in the subscription status for HTTP subscriptions

This commit is contained in:
John Törnblom 2012-10-25 12:39:36 +02:00
parent 83a631e6d8
commit e049f5dae1
2 changed files with 10 additions and 4 deletions

View file

@ -550,13 +550,16 @@ subscription_create_msg(th_subscription_t *s)
htsmsg_add_str(m, "state", state);
if (s->ths_hostname && s->ths_username && s->ths_client) {
if(s->ths_hostname != NULL)
htsmsg_add_str(m, "hostname", s->ths_hostname);
if(s->ths_username != NULL)
htsmsg_add_str(m, "username", s->ths_username);
if(s->ths_client != NULL)
htsmsg_add_str(m, "title", s->ths_client);
} else {
else if(s->ths_title != NULL)
htsmsg_add_str(m, "title", s->ths_title);
}
if(s->ths_channel != NULL)
htsmsg_add_str(m, "channel", s->ths_channel->ch_name);

View file

@ -26,6 +26,7 @@
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <arpa/inet.h>
#include <sys/stat.h>
#include <sys/sendfile.h>
@ -640,7 +641,9 @@ http_stream_channel(http_connection_t *hc, channel_t *ch)
pthread_mutex_lock(&global_lock);
s = subscription_create_from_channel(ch, priority, "HTTP", st, flags,
NULL, NULL, NULL);
inet_ntoa(hc->hc_peer->sin_addr),
hc->hc_username,
http_arg_get(&hc->hc_args, "User-Agent"));
pthread_mutex_unlock(&global_lock);
if(s) {