]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
http server: added dump request trace
authorJaroslav Kysela <perex@perex.cz>
Sun, 26 Oct 2014 17:26:01 +0000 (18:26 +0100)
committerJaroslav Kysela <perex@perex.cz>
Sun, 26 Oct 2014 17:26:01 +0000 (18:26 +0100)
src/http.c

index b2e41ccb0a152a9d4d0a40e3f001248a44f2c23f..8fc9ff47f2be02dd0fce5fd0f4514aa70ce5701d 100644 (file)
@@ -603,6 +603,39 @@ http_process_request(http_connection_t *hc, htsbuf_queue_t *spill)
   }
 }
 
+/*
+ *
+ */
+#if ENABLE_TRACE
+static void
+dump_request(http_connection_t *hc)
+{
+  char buf[2048] = "";
+  http_arg_t *ra;
+  int first;
+
+  first = 1;
+  TAILQ_FOREACH(ra, &hc->hc_req_args, link) {
+    snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), first ? "?%s=%s" : "&%s=%s", ra->key, ra->val);
+    first = 0;
+  }
+
+  first = 1;
+  TAILQ_FOREACH(ra, &hc->hc_args, link) {
+    snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), first ? "{{%s=%s" : ",%s=%s", ra->key, ra->val);
+    first = 0;
+  }
+  snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "}}");
+
+  tvhtrace("http", "%s%s", hc->hc_url, buf);
+}
+#else
+static inline void
+dump_request(http_connection_t *hc)
+{
+}
+#endif
+
 /**
  * Process a request, extract info from headers, dispatch command and
  * clean up
@@ -613,6 +646,8 @@ process_request(http_connection_t *hc, htsbuf_queue_t *spill)
   char *v, *argv[2];
   int n, rval = -1;
   uint8_t authbuf[150];
+
+  dump_request(hc);
   
   hc->hc_url_orig = tvh_strdupa(hc->hc_url);
 
@@ -717,7 +752,6 @@ http_arg_set(struct http_arg_list *list, const char *key, const char *val)
   ra->val = strdup(val);
 }
 
-
 /*
  * Split a string in components delimited by 'delimiter'
  */