Project

General

Profile

Feature #4748

Proxy info in webUI

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

Status:
Fixed
Priority:
Normal
Assignee:
-
Category:
User Interface
Target version:
Start date:
2017-11-28
Due date:
% Done:

100%

Estimated time:

Description

Hi Jarsolav,

This new patch adds the "proxy" info in the section "Status/Connection/Type" in the form of "SAT>IP (proxy)" and "HTTP (proxy)", instead of "SAT>IP" and "HTTP".

This info will be useful for differentiate proxy and non-proxy connections.

Please, can you commit this patch too?
Thank you

diff --git a/src/http.c b/src/http.c
index 3c8d95a..9f246d9 100644
--- a/src/http.c
+++ b/src/http.c
@@ -1360,6 +1360,7 @@ process_request(http_connection_t *hc, htsbuf_queue_t *spill)
       http_error(hc, HTTP_STATUS_BAD_REQUEST);
       return -1;
     }
+    hc->hc_is_proxied = 1;
   }

   tcp_get_str_from_ip(hc->hc_peer, authbuf, sizeof(authbuf));
@@ -1822,6 +1823,7 @@ http_serve_requests(http_connection_t *hc)
   atomic_set(&hc->hc_extra_insend, 0);
   atomic_set(&hc->hc_extra_chunks, 0);

+  hc->hc_is_proxied = 0;
   do {
     hc->hc_no_output  = 0;

diff --git a/src/http.h b/src/http.h
index a35c609..ce8096f 100644
--- a/src/http.h
+++ b/src/http.h
@@ -175,6 +175,7 @@ typedef struct http_connection {
   uint8_t hc_no_output;
   uint8_t hc_shutdown;
   uint8_t hc_is_local_ip;   /*< a connection from the local network */
+  uint8_t hc_is_proxied;

   /* Support for HTTP POST */

diff --git a/src/satip/rtsp.c b/src/satip/rtsp.c
index 7cda53e..a81f725 100644
--- a/src/satip/rtsp.c
+++ b/src/satip/rtsp.c
@@ -1636,7 +1636,7 @@ static void
 rtsp_stream_status ( void *opaque, htsmsg_t *m )
 {
   http_connection_t *hc = opaque;
-  htsmsg_add_str(m, "type", "SAT>IP");
+  htsmsg_add_str(m, "type", (hc->hc_is_proxied)? "SAT>IP (proxy)" : "SAT>IP");
   if (hc->hc_username)
     htsmsg_add_str(m, "user", hc->hc_username);
 }
diff --git a/src/webui/webui.c b/src/webui/webui.c
index 6225405..d7589e9 100644
--- a/src/webui/webui.c
+++ b/src/webui/webui.c
@@ -357,7 +357,7 @@ static void
 http_stream_status ( void *opaque, htsmsg_t *m )
 {
   http_connection_t *hc = opaque;
-  htsmsg_add_str(m, "type", "HTTP");
+  htsmsg_add_str(m, "type", (hc->hc_is_proxied)? "HTTP (proxy)" : "HTTP");
   if (hc->hc_username)
     htsmsg_add_str(m, "user", hc->hc_username);
 }

Files

Proxy-info-in-webUI.diff (1.79 KB) Proxy-info-in-webUI.diff Mono Polimorph, 2017-11-28 16:34
Proxy-info-in-webUI-v2.diff (1.79 KB) Proxy-info-in-webUI-v2.diff Mono Polimorph, 2017-12-11 13:25

History

#1

Updated by Mono Polimorph about 7 years ago

Hi Jaroslav,

Please, commit too this patch. It doesn't changes the behaviour but is very confortable for check in the webUI who is connected using PROXY.

You agree?

#2

Updated by Pablo R. about 7 years ago

That looks good :o

#3

Updated by Mono Polimorph about 7 years ago

Pablo Rodríguez wrote:

That looks good :o

Thank you, Pablo!

I hope Jaroslav thinks this as well.
Perhaps he prefers to change the text to a more compact version, like "SAT>IP/proxy":"SAT>IP" and "HTTP/proxy":"HTTP".

I'm in road to preprare other patches for UI info. For example, for printing when the SAT>IP protocol (incoming and outcoming) is using AVP (Interlaved RTSP TCP transport). However, I need to know if Jaroslav agree first with this patch.

Regards.

#4

Updated by Mono Polimorph about 7 years ago

Hi,

Here the patch upgraded. It's clear and simple, so I hope Jaroslav will commit it! ;)

diff --git a/src/http.c b/src/http.c
index c3818b0..f3ef84a 100644
--- a/src/http.c
+++ b/src/http.c
@@ -1361,6 +1361,7 @@ process_request(http_connection_t *hc, htsbuf_queue_t *spill)
       http_error(hc, HTTP_STATUS_BAD_REQUEST);
       return -1;
     }
+    hc->hc_is_proxied = 1;
   }

   tcp_get_str_from_ip(hc->hc_peer, authbuf, sizeof(authbuf));
@@ -1851,6 +1852,7 @@ http_serve_requests(http_connection_t *hc)
   atomic_set(&hc->hc_extra_insend, 0);
   atomic_set(&hc->hc_extra_chunks, 0);

+  hc->hc_is_proxied = 0;
   do {
     hc->hc_no_output  = 0;

diff --git a/src/http.h b/src/http.h
index 6c66a86..10d8584 100644
--- a/src/http.h
+++ b/src/http.h
@@ -175,6 +175,7 @@ typedef struct http_connection {
   uint8_t hc_no_output;
   uint8_t hc_shutdown;
   uint8_t hc_is_local_ip;   /*< a connection from the local network */
+  uint8_t hc_is_proxied;

   /* Support for HTTP POST */

diff --git a/src/satip/rtsp.c b/src/satip/rtsp.c
index 06fbe87..630549e 100644
--- a/src/satip/rtsp.c
+++ b/src/satip/rtsp.c
@@ -1655,7 +1655,7 @@ static void
 rtsp_stream_status ( void *opaque, htsmsg_t *m )
 {
   http_connection_t *hc = opaque;
-  htsmsg_add_str(m, "type", "SAT>IP");
+  htsmsg_add_str(m, "type", (hc->hc_is_proxied)? "SAT>IP/proxy" : "SAT>IP");
   if (hc->hc_username)
     htsmsg_add_str(m, "user", hc->hc_username);
 }
diff --git a/src/webui/webui.c b/src/webui/webui.c
index bd013ec..93f1dbc 100644
--- a/src/webui/webui.c
+++ b/src/webui/webui.c
@@ -362,7 +362,7 @@ static void
 http_stream_status ( void *opaque, htsmsg_t *m )
 {
   http_connection_t *hc = opaque;
-  htsmsg_add_str(m, "type", "HTTP");
+  htsmsg_add_str(m, "type", (hc->hc_is_proxied)? "HTTP/proxy" : "HTTP");
   if (hc->hc_username)
     htsmsg_add_str(m, "user", hc->hc_username);
 }
#5

Updated by Mono Polimorph almost 7 years ago

Hi Jaroslav,

It's something wrong with this patch?
This is useful information, and it doesn't creates side effects.
Futhermore, I want to create other patches for improve the UI. For example, for printing when using RTP-over-RSTP connections.

You agree to commit this patch?
You agree with create other UI patches?
Regards!

#6

Updated by Mono Polimorph almost 7 years ago

Hi Jaroslav,

Please, can you spend five minutes to review this patch and commit it? :)

Maybe, you'll see it a little simple. However, I see very interesting to "write" in the UI more technical information. And as the patch is clean and not generates interference, why not include it?
Also, I'm interested in write also another patch for print when the transport to a SAT>IP tuner is done using TCP or UDP. I feel this info also interesting. However, I'll only develop it if you accept these patches.

Please, comment it! ;)

#7

Updated by Pablo R. almost 7 years ago

Mono Polimorph wrote:

Hi Jaroslav,

Please, can you spend five minutes to review this patch and commit it? :)

Maybe, you'll see it a little simple. However, I see very interesting to "write" in the UI more technical information. And as the patch is clean and not generates interference, why not include it?
Also, I'm interested in write also another patch for print when the transport to a SAT>IP tuner is done using TCP or UDP. I feel this info also interesting. However, I'll only develop it if you accept these patches.

Please, comment it! ;)

You should try to open a pull request on Github.

#8

Updated by Mono Polimorph almost 7 years ago

Pablo Rodríguez wrote:

You should try to open a pull request on Github.

Hi Pablo,

Thank you for you comment. However, as I commented before I can't acces to hithub for a PR. Sorry! I know that this is an uncommon patching mode, but it's the only solution (for me) at time.
:(

#9

Updated by Mono Polimorph almost 7 years ago

Hi Jaroslav,

You reject this patch?

#10

Updated by Mono Polimorph almost 7 years ago

Hi Jaroslav,

Sorry for my insistence! If you disagree with this patch, you can comment on what you would like to change.

Regards.

#11

Updated by Jaroslav Kysela almost 7 years ago

  • Target version set to 4.4
#12

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|4f2e363fa0c79fb1dc69e5dedad0c340b1a679fd.

#13

Updated by Mono Polimorph almost 7 years ago

Jaroslav Kysela wrote:

Applied in changeset commit:tvheadend|4f2e363fa0c79fb1dc69e5dedad0c340b1a679fd.

Thank you! And great work with the improvement you do.
I'll prepare another patch with the UDP RTP port info.

#14

Updated by Mono Polimorph almost 7 years ago

Mono Polimorph wrote:

I'll prepare another patch with the UDP RTP port info.

It's done in #4881

Also available in: Atom PDF