Bug #6309
Ignore HTTP arguments cant add more than one argument which to be ignored
0%
Description
If more argument are added nothing is ignored.
I check source code, and my understanding is that arguments should be separated from each other with white space character.
Also tested with ':' and '|' characters but it still doesn't work.
After restart of server only first supplied argument remains:
- before restart:
- after restart:
Files
History
Updated by Dave Pickles about 1 year ago
I don't use IPTV but to check your report I created a new IPTV Automatic Network and added "test1 test2" to the "Ignore HTTP arguments" parameter in the config screen. Exiting and returning to that screen still shows "test1 test2", and the config file at /home/hts/.hts/tvheadend/input/iptv/networks/{random number}/config is correct.
However after restarting TVH the IPTV config screen now only shows "test1" in the "Ignore HTTP arguments" parameter. The config file is still correct. So the bug presumably lies in the parsing of the config file at startup.
Updated by Dave Pickles about 1 year ago
OK I see the problem.
In iptv_auto.c line 405, function http_tokenize() chops up the source string, inserting nulls in place of the delimiters, then returns an array of pointers to the start of each token. In this case the source string is needed later by the UI.
There is also a memory leak.
I'll work up a patch.
Updated by Dave Pickles about 1 year ago
Can you confirm that this patch fixes your issue?
--- iptv_auto.c.orig 2023-10-13 08:48:19.364562246 +0100 +++ iptv_auto.c 2023-10-13 08:53:22.612928306 +0100 @@ -386,7 +386,7 @@ mpegts_mux_t *mm, *mm2; int r = -1, count, n, i; http_arg_list_t remove_args, ignore_args; - char *argv[32]; + char *argv[32], *removes, *ignores; /* note that we know that data are terminated with '\0' */ @@ -395,16 +395,20 @@ http_arg_init(&remove_args); if (in->in_remove_args) { - n = http_tokenize(in->in_remove_args, argv, ARRAY_SIZE(argv), -1); + removes = strdup(in->in_remove_args); + n = http_tokenize(removes, argv, ARRAY_SIZE(argv), -1); for (i = 0; i < n; i++) http_arg_set(&remove_args, argv[i], NULL); + free(removes); } http_arg_init(&ignore_args); if (in->in_ignore_args) { - n = http_tokenize(in->in_ignore_args, argv, ARRAY_SIZE(argv), -1); + ignores = strdup(in->in_ignore_args); + n = http_tokenize(ignores, argv, ARRAY_SIZE(argv), -1); for (i = 0; i < n; i++) http_arg_set(&ignore_args, argv[i], NULL); + free(ignores); } LIST_FOREACH(mm, &in->mn_muxes, mm_network_link) @@ -419,6 +423,7 @@ in->in_channel_number); http_arg_flush(&remove_args); + http_arg_flush(&ignore_args); if (r == 0) { count = 0;
Updated by baba ceca about 1 year ago
After some more testing auto iptv functionality seems to not works as expected .. at least according my understanding what thins should do.
When ignored from settings query parameter is updated in refreshed url, new value is not populated to mux configuration. My understandig for ignored parameter is that will be ignored when check is made that we have new mux, but still should remain when tvheadend starts stream from server.
I look in source code an that modification seems to work for me, but I'm not sure is it right place and right wait to do taht:
diff --git a/src/input/mpegts/iptv/iptv_auto.c b/src/input/mpegts/iptv/iptv_auto.c
index 0cb9b74e9..2c6417c8f 100644
--- a/src/input/mpegts/iptv/iptv_auto.c
+++ b/src/input/mpegts/iptv/iptv_auto.c
@@ -225,6 +225,17 @@ skip_url:
if (strcmp(im->mm_iptv_url_cmpid ?: (im->mm_iptv_url ?: ""), url2) == 0) {
im->im_delete_flag = 0;
change = 0;
+ if (0 != strcmp(im->mm_iptv_url ?: "", u.raw)) {
+ free(im->mm_iptv_url);
+ im->mm_iptv_url = strdup(u.raw);
+ change = 1;
+ }
+
+ if (0 != strcmp(im->mm_iptv_url_raw ?: "", u.raw)) {
+ free(im->mm_iptv_url_raw);
+ im->mm_iptv_url_raw = strdup(u.raw);
+ change = 1;
+ }
if (strcmp(im->mm_iptv_svcname ?: "", name)) {
free(im->mm_iptv_svcname);
im->mm_iptv_svcname = strdup(name);
Again your change it seems to fix initial issue.
Dave Pickles wrote:
Can you confirm that this patch fixes your issue?
[...]
Updated by Dave Pickles about 1 year ago
This is not a part of Tvheadend that I use, so I'm not sure what the intended behaviour should be. The commit which introduced the 'Ignore' function was in response to Issue 4761 (https://tvheadend.org/issues/4761) which perhaps explains what the fix was intended to solve.
Updated by baba ceca about 1 year ago
Dave Pickles wrote:
This is not a part of Tvheadend that I use, so I'm not sure what the intended behaviour should be. The commit which introduced the 'Ignore' function was in response to Issue 4761 (https://tvheadend.org/issues/4761) which perhaps explains what the fix was intended to solve.
Thanks for pointing that issue.
I think that should solve exact same thing, but probably there is a issue with it.
So I have m3u8 list which is updated every 1 hour and every time token query parameter is changed:
#EXTM3U
http://server:80/stream.ts?token=123