Project

General

Profile

Bug #4753

SAT>IP server: Correct RTSP Traces

Added by Mono Polimorph almost 7 years ago. Updated almost 7 years ago.

Status:
Fixed
Priority:
Normal
Category:
SAT>IP
Target version:
-
Start date:
2017-11-30
Due date:
% Done:

100%

Estimated time:
Found in version:
head
Affected Versions:

Description

Hi Jaroslav,

This patch solves the problem of TRACING the debug of RTSP commands. As the current code of the HTTP server and the RTSP server shares code, then you can only TRACE RTSP commands enabling the trace of the http module. However, if you do this, then you see the webUI requests.

So, this simple patch solves this distinguishing between HTTP and RTSP.

Please, commit this patch as it's very unconfortable to debug/trace the satip_server without seeying the RTSP commands.
Regards.

diff --git a/src/http.c b/src/http.c
index b6ef09b..28b65f6 100644
--- a/src/http.c
+++ b/src/http.c
@@ -1196,7 +1196,7 @@ destroy:
  * Dump request
  */
 static void
-dump_request(http_connection_t *hc)
+dump_request(http_connection_t *hc, int mode)
 {
   char buf[2048] = "";
   http_arg_t *ra;
@@ -1216,7 +1216,7 @@ dump_request(http_connection_t *hc)
   if (!first)
     tvh_strlcatf(buf, sizeof(buf), ptr, "}}");

-  tvhtrace(LS_HTTP, "%s %s %s%s", http_ver2str(hc->hc_version),
+  tvhtrace((mode) ? LS_SATIPS : LS_HTTP, "%s %s %s%s", http_ver2str(hc->hc_version),
            http_cmd2str(hc->hc_cmd), hc->hc_url, buf);
 }

@@ -1244,7 +1244,7 @@ http_cmd_get(http_connection_t *hc)
   char *args;

   if (tvhtrace_enabled())
-    dump_request(hc);
+    dump_request(hc,0);

   if (!http_resolve(hc, &hp, &remain, &args)) {
     http_error(hc, HTTP_STATUS_NOT_FOUND);
@@ -1310,7 +1310,7 @@ http_cmd_post(http_connection_t *hc, htsbuf_queue_t *spill)
   }

   if (tvhtrace_enabled())
-    dump_request(hc);
+    dump_request(hc,0);

   if (!http_resolve(hc, &hp, &remain, &args)) {
     http_error(hc, HTTP_STATUS_NOT_FOUND);
@@ -1450,7 +1450,7 @@ process_request(http_connection_t *hc, htsbuf_queue_t *spill)
   switch(hc->hc_version) {
   case RTSP_VERSION_1_0:
     if (tvhtrace_enabled())
-      dump_request(hc);
+      dump_request(hc,1);
     if (hc->hc_cseq)
       rval = hc->hc_process(hc, spill);
     else

Files

SAT-IP-Fix-Server-RTSP-traces.diff (1.44 KB) SAT-IP-Fix-Server-RTSP-traces.diff Mono Polimorph, 2017-11-30 19:56
Correct-RTSP-Traces-v2.diff (1.44 KB) Correct-RTSP-Traces-v2.diff Mono Polimorph, 2017-12-11 13:29

History

#1

Updated by Jaroslav Kysela almost 7 years ago

Pass subsystem integer rather than the 'mode'. It will be more readable:

dump_request(hc, LS_HTTP);
#2

Updated by Mono Polimorph almost 7 years ago

Jaroslav Kysela wrote:

Pass subsystem integer rather than the 'mode'. It will be more readable:

[...]

Hi Jaroslav,

You're right another time! It's really more clear. Here the updated patch:

diff --git a/src/http.c b/src/http.c
index f5e5d5d..c3818b0 100644
--- a/src/http.c
+++ b/src/http.c
@@ -1196,7 +1196,7 @@ destroy:
  * Dump request
  */
 static void
-dump_request(http_connection_t *hc)
+dump_request(http_connection_t *hc, int subsys)
 {
   char buf[2048] = "";
   http_arg_t *ra;
@@ -1216,7 +1216,7 @@ dump_request(http_connection_t *hc)
   if (!first)
     tvh_strlcatf(buf, sizeof(buf), ptr, "}}");

-  tvhtrace(LS_HTTP, "%s %s %s%s", http_ver2str(hc->hc_version),
+  tvhtrace(subsys, "%s %s %s%s", http_ver2str(hc->hc_version),
            http_cmd2str(hc->hc_cmd), hc->hc_url, buf);
 }

@@ -1244,7 +1244,7 @@ http_cmd_get(http_connection_t *hc)
   char *args;

   if (tvhtrace_enabled())
-    dump_request(hc);
+    dump_request(hc, LS_HTTP);

   if (!http_resolve(hc, &hp, &remain, &args)) {
     http_error(hc, HTTP_STATUS_NOT_FOUND);
@@ -1310,7 +1310,7 @@ http_cmd_post(http_connection_t *hc, htsbuf_queue_t *spill)
   }

   if (tvhtrace_enabled())
-    dump_request(hc);
+    dump_request(hc, LS_HTTP);

   if (!http_resolve(hc, &hp, &remain, &args)) {
     http_error(hc, HTTP_STATUS_NOT_FOUND);
@@ -1450,7 +1450,7 @@ process_request(http_connection_t *hc, htsbuf_queue_t *spill)
   switch(hc->hc_version) {
   case RTSP_VERSION_1_0:
     if (tvhtrace_enabled())
-      dump_request(hc);
+      dump_request(hc, LS_SATIPS);
     if (hc->hc_cseq)
       rval = hc->hc_process(hc, spill);
     else

Please, commit it... and my other three pending patches: #4748, #4754 & #4752.
Regards!

#3

Updated by Mono Polimorph almost 7 years ago

Hi Jaroslav,

This patch is rewrited using your suggestions. Now it's completed.
Please, can you commit it?
Remember also the other pending: #4748, #4754 & #4752.

Sorry, but as commented I can't use GITHUB for a PR. :(

#4

Updated by Mono Polimorph almost 7 years ago

Mono Polimorph wrote:

Hi Jaroslav,

This patch is rewrited using your suggestions. Now it's completed.
Please, can you commit it?
Remember also the other pending: #4748, #4754 & #4752.

Sorry, but as commented I can't use GITHUB for a PR. :(

Hi Jaroslav,

This a reminder of this pending patch (plus #4748, #4754 & #4752).
Any problem with it?

I hope to receive news soon! ;)

#5

Updated by Jaroslav Kysela almost 7 years ago

  • Status changed from New to Fixed
  • % Done changed from 0 to 100

Applied in changeset commit:tvheadend|4f19e4ad3b90cb616ed11804cd6e24f6b0b0085e.

#6

Updated by Mono Polimorph almost 7 years ago

Jaroslav Kysela wrote:

Applied in changeset commit:tvheadend|4f19e4ad3b90cb616ed11804cd6e24f6b0b0085e.

Thank you! ;)

Also available in: Atom PDF