]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
show user-agent, username and ip in the subscription status for HTTP subscriptions
authorJohn Törnblom <john.tornblom@gmail.com>
Thu, 25 Oct 2012 10:39:36 +0000 (12:39 +0200)
committerJohn Törnblom <john.tornblom@gmail.com>
Thu, 25 Oct 2012 10:40:45 +0000 (12:40 +0200)
src/subscriptions.c
src/webui/webui.c

index ca5b1675acd22280b6065c2e3f96d425c906d502..1bd429dbcd52b425a3365d3a8528e6ac558e81c8 100644 (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);
index 85936146493c38233bd77f4080357ee7f272bde0..26ac8c636c911835e681d7d8fb49f1ea4f6c1c38 100644 (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) {