]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
http: allow to specify different paths
authorJaroslav Kysela <perex@perex.cz>
Fri, 13 Feb 2015 19:13:50 +0000 (20:13 +0100)
committerJaroslav Kysela <perex@perex.cz>
Wed, 11 Mar 2015 20:41:12 +0000 (21:41 +0100)
src/http.c
src/http.h

index 382addeed60adb3a72ec0771e190a563809f9200..f67f0094e59d7c9c4e93ed50f3f5f99f99104895 100644 (file)
@@ -39,7 +39,7 @@
 
 void *http_server;
 
-static LIST_HEAD(, http_path) http_paths;
+static http_path_list_t http_paths;
 
 static struct strtab HTTP_cmdtab[] = {
   { "GET",        HTTP_CMD_GET },
@@ -113,7 +113,7 @@ http_resolve(http_connection_t *hc, char **remainp, char **argsp)
 
   while (1) {
 
-    LIST_FOREACH(hp, &http_paths, hp_link) {
+    LIST_FOREACH(hp, hc->hc_paths, hp_link) {
       if(!strncmp(path, hp->hp_path, hp->hp_len)) {
         if(path[hp->hp_len] == 0 ||
            path[hp->hp_len] == '/' ||
@@ -1000,9 +1000,10 @@ http_serve(int fd, void **opaque, struct sockaddr_storage *peer,
   memset(&hc, 0, sizeof(http_connection_t));
   *opaque = &hc;
 
-  hc.hc_fd   = fd;
-  hc.hc_peer = peer;
-  hc.hc_self = self;
+  hc.hc_fd    = fd;
+  hc.hc_peer  = peer;
+  hc.hc_self  = self;
+  hc.hc_paths = &http_paths;
 
   http_serve_requests(&hc);
 
index cedd136bb705da14dcab16473bf430b15dc6c87b..468df567cd90ef7f94c9f93f777f05df69da9e2e 100644 (file)
@@ -25,6 +25,9 @@
 #include "access.h"
 
 struct channel;
+struct http_path;
+
+typedef LIST_HEAD(, http_path) http_path_list_t;
 
 typedef TAILQ_HEAD(http_arg_list, http_arg) http_arg_list_t;
 
@@ -115,6 +118,8 @@ typedef struct http_connection {
   struct sockaddr_storage *hc_self;
   char *hc_representative;
 
+  http_path_list_t *hc_paths;
+
   char *hc_url;
   char *hc_url_orig;
   int hc_keep_alive;