Open tdabasinskas opened 6 years ago
Looking into Nginx log (I'm using TVHeadend behind a reverse proxy), I see the following:
IP - [IP] - - [04/Jan/2018:11:30:04 +0000] "GET /imagecache/578 HTTP/2.0" 401 250 "-" "TvhClient/806 CFNetwork/894 Darwin/17.4.0" 20 0.002 [default-tvheadend-9981] IP:9981 250 0.002 401
IP - [IP] - - [04/Jan/2018:11:30:04 +0000] "GET /imagecache/577 HTTP/2.0" 401 250 "-" "TvhClient/806 CFNetwork/894 Darwin/17.4.0" 112 0.003 [default-tvheadend-9981] IP:9981 250 0.003 401
As you can see, HTTP status code is 401 (Not Authorized
). Indeed, if I'm try to access the paths directly via my browser, they require authentication.
The question is, why TVHClient does not pass my credentials when accessing the image cache, even though it already uses the credentials for everything else.
Credentials in the image cache? Wow good catch, it is possible that it's not using them, yes!
This happens because afnetworking is used for the communication with the service, but image paths are created in code, and then used by SDWebImage which does not know anything about the authorization required.
I will look into this and fix it
hi again
I've tested this and it's working for me, the url is constructed correctly with the username+password.
[06/Jan/2018:23:51:29 +0000] x TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 "POST /comet/poll HTTP/1.1" 182
[06/Jan/2018:23:51:29 +0000] x TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 "GET /imagecache/291 HTTP/1.1" 151
[06/Jan/2018:23:51:30 +0000] x TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 "GET /imagecache/298 HTTP/1.1" 3500
[06/Jan/2018:23:51:30 +0000] x TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 "GET /imagecache/287 HTTP/1.1" 151
[06/Jan/2018:23:51:30 +0000] x TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 "GET /imagecache/292 HTTP/1.1" 151
Are you able to do a packet capture on your server (or add more logging to the reverse proxy) and double check what's the url that tvhclient uses?
The code to generate the url is in https://github.com/zipleen/tvheadend-ios-lib/blob/master/tvheadend-ios-lib/TVHChannel.m#L100 which in turn calls httpURL which gets the url generated from https://github.com/zipleen/tvheadend-ios-lib/blob/master/tvheadend-ios-lib/TVHServerSettings.m#L174
Hi @zipleen,
I wasn't able to get a more verbose logging or a packet capture. Anyhow, there are more lines from the log:
10.244.0.1 - [10.244.0.1] - JoeDoe [07/Jan/2018:11:52:28 +0000] "GET /api/serverinfo HTTP/2.0" 200 183 "-" "TvhClient/3.2.6 (iPhone; iOS 11.2.5; Scale/3.00)" 165 0.006 [default-tvheadend-9981] 10.244.0.112:9981 183 0.006 200
10.244.0.1 - [10.244.0.1] - JoeDoe [07/Jan/2018:11:52:28 +0000] "GET /api/status/subscriptions HTTP/2.0" 200 29 "-" "TvhClient/3.2.6 (iPhone; iOS 11.2.5; Scale/3.00)" 66 0.006 [default-tvheadend-9981] 10.244.0.112:9981 29 0.006 200
10.244.0.1 - [10.244.0.1] - JoeDoe [07/Jan/2018:11:52:28 +0000] "GET /api/mpegts/network/grid?limit=99999999 HTTP/2.0" 200 403 "-" "TvhClient/3.2.6 (iPhone; iOS 11.2.5; Scale/3.00)" 78 0.007 [default-tvheadend-9981] 10.244.0.112:9981 403 0.007 200
10.244.0.1 - [10.244.0.1] - JoeDoe [07/Jan/2018:11:52:28 +0000] "GET /api/status/inputs HTTP/2.0" 200 29 "-" "TvhClient/3.2.6 (iPhone; iOS 11.2.5; Scale/3.00)" 62 0.006 [default-tvheadend-9981] 10.244.0.112:9981 29 0.006 200
2018/01/07 11:52:28 [error] 446#446: *22921 upstream sent no valid HTTP/1.0 header while reading response header from upstream, client: 10.244.0.1, server: tvheadend.td.net, request: "GET /config?op=loadSettings HTTP/2.0", upstream: "http://10.244.0.112:9981/config?op=loadSettings", host: "tvheadend.td.net:443"
10.244.0.1 - [10.244.0.1] - JoeDoe [07/Jan/2018:11:52:28 +0000] "GET /config?op=loadSettings HTTP/2.0" 009 293 "-" "TvhClient/3.2.6 (iPhone; iOS 11.2.5; Scale/3.00)" 66 0.007 [default-tvheadend-9981] 10.244.0.112:9981 293 0.007 200
10.244.0.1 - [10.244.0.1] - JoeDoe [07/Jan/2018:11:52:28 +0000] "POST /comet/poll HTTP/2.0" 200 181 "-" "TvhClient/3.2.6 (iPhone; iOS 11.2.5; Scale/3.00)" 121 4.189 [default-tvheadend-9981] 10.244.0.112:9981 181 4.189 200
10.244.0.1 - [10.244.0.1] - JoeDoe [07/Jan/2018:11:52:28 +0000] "GET /api/profile/list HTTP/2.0" 200 229 "-" "TvhClient/3.2.6 (iPhone; iOS 11.2.5; Scale/3.00)" 61 0.020 [default-tvheadend-9981] 10.244.0.112:9981 229 0.020 200
10.244.0.1 - [10.244.0.1] - JoeDoe [07/Jan/2018:11:52:28 +0000] "POST /api/channeltag/grid HTTP/2.0" 200 217 "-" "TvhClient/3.2.6 (iPhone; iOS 11.2.5; Scale/3.00)" 116 0.023 [default-tvheadend-9981] 10.244.0.112:9981 217 0.021 200
10.244.0.1 - [10.244.0.1] - JoeDoe [07/Jan/2018:11:52:28 +0000] "POST /api/idnode/load HTTP/2.0" 200 82 "-" "TvhClient/3.2.6 (iPhone; iOS 11.2.5; Scale/3.00)" 89 0.034 [default-tvheadend-9981] 10.244.0.112:9981 82 0.034 200
10.244.0.1 - [10.244.0.1] - JoeDoe [07/Jan/2018:11:52:28 +0000] "POST /api/channeltag/grid HTTP/2.0" 200 217 "-" "TvhClient/3.2.6 (iPhone; iOS 11.2.5; Scale/3.00)" 91 0.035 [default-tvheadend-9981] 10.244.0.112:9981 217 0.035 200
10.244.0.1 - [10.244.0.1] - JoeDoe [07/Jan/2018:11:52:28 +0000] "POST /api/channel/grid HTTP/2.0" 200 12721 "-" "TvhClient/3.2.6 (iPhone; iOS 11.2.5; Scale/3.00)" 109 0.063 [default-tvheadend-9981] 10.244.0.112:9981 12721 0.061 200
10.244.0.1 - [10.244.0.1] - JoeDoe [07/Jan/2018:11:52:28 +0000] "GET /api/mpegts/service/grid?limit=99999999 HTTP/2.0" 200 16450 "-" "TvhClient/3.2.6 (iPhone; iOS 11.2.5; Scale/3.00)" 78 0.067 [default-tvheadend-9981] 10.244.0.112:9981 16450 0.067 200
10.244.0.1 - [10.244.0.1] - JoeDoe [07/Jan/2018:11:52:28 +0000] "GET /api/mpegts/mux/grid?limit=99999999 HTTP/2.0" 200 12609 "-" "TvhClient/3.2.6 (iPhone; iOS 11.2.5; Scale/3.00)" 75 0.072 [default-tvheadend-9981] 10.244.0.112:9981 12609 0.072 200
10.244.0.1 - [10.244.0.1] - JoeDoe [07/Jan/2018:11:52:28 +0000] "GET /api/epg/events/grid?limit=1000&start=0 HTTP/2.0" 200 2168 "-" "TvhClient/3.2.6 (iPhone; iOS 11.2.5; Scale/3.00)" 77 0.003 [default-tvheadend-9981] 10.244.0.112:9981 2168 0.003 200
10.244.0.1 - [10.244.0.1] - JoeDoe [07/Jan/2018:11:52:29 +0000] "POST /comet/poll HTTP/2.0" 200 308 "-" "TvhClient/3.2.6 (iPhone; iOS 11.2.5; Scale/3.00)" 62 0.108 [default-tvheadend-9981] 10.244.0.112:9981 308 0.108 200
10.244.0.1 - [10.244.0.1] - JoeDoe [07/Jan/2018:11:52:30 +0000] "POST /comet/poll HTTP/2.0" 200 182 "-" "TvhClient/3.2.6 (iPhone; iOS 11.2.5; Scale/3.00)" 121 0.102 [default-tvheadend-9981] 10.244.0.112:9981 182 0.102 200
Two things above look interesting:
/config?op=loadSettings
is failing when connectingNot Authorized
ones include the username passed via Basic Auth (JoeDoe
), meaning the auth headers are being passed.OK, it seems I found the issue.
Not sure about the root cause, but having #
symbol within the password causes this issue. Setting the password to something that does not contain #
works:
10.244.0.1 - [10.244.0.1] - - [07/Jan/2018:12:13:20 +0000] "GET /imagecache/749 HTTP/2.0" 200 19380 "-" "TvhClient/810 CFNetwork/894 Darwin/17.4.0" 220 0.015 [default-tvheadend-9981] 10.244.0.112:9981 19380 0.015 200
Anyhow, the log is even stranger now, as requests to /imagecache
no longer includes the username (JoeDoe
) as before.
so without the # character in the password, everything works again? But just to be sure, with # character, the connection does work but it's just the images that don't appear?
It's weird because I've tested with the # character and it seems to be properly encoded.. but I haven't tested this using the SDWebImage library. When I have time I'll have a look by creating a password with a # and checking out the image cache
Hi @zipleen,
That's what I've tried:
#
, everything works, but channel icons DOES NOT load#
, channel icons DO show#
to the password again, channel icons a NO LONGER being showed.It does sounds strange though, but after the tests above that indeed seems to be the culprit.
Just to say this also occurs with "*" and may occur with other symbols. It was driving me crazy why I couldn't see the images in the application, switched my password to letters only and it works now.
this might mean that there's some sort of issue with the url encoding of SDWebImage . I guess I need to have a look at this one, but I'm also assuming that this only affects people that have those characters in the username/password AND use "tvheadend image cache".
Hi, just to confirm this is still an issue today.
oh yeah for sure, I don't know if this is going to be solved quickly :P
but if you find someone that can fix this, please be my guest - the code is open source! https://github.com/zipleen/tvheadend-ios-lib/blob/master/tvheadend-ios-lib/TVHServerSettings.m#L179 this is the code that encodes the url, it must still have issues encoding some other weirder characters...
https://github.com/zipleen/tvheadend-ios-lib/pull/11
You used a very very very limited CharacterSet for encoding ;-)
so, according to my tests that were already there, the url creation works for weird characters I did use the correct character set now at least :P but I think the other character set already probably worked as well
the image url creation also uses this code, so it should have been ok.....
but I can confirm it here locally, if I have a # in my password, the images don't download. but I do have a connection to the server and everything works, including streaming. which means this is somewhat of an issue with SDWebImage
I've updated to the latest SDWebImage and it still doesn't work. something is odd with sdwebimage and I think the easiest solution here is to just warn users to not use # in the password or username lol....
Hello,
I cannot seem to get the channel logos to be display within the channel/EPG lists within the application.
Issue
For the testing purposes (to rule-out the issue being related to using a local file or wrong format), I've set two channels with different icon paths:
While the WEBUI of TVHeadend displays both logos correctly, TVHClient application displays neither. Force-closing and relaunching the application does not help.
Details
I've looked into the previous (closed) issues, but I couldn't find the solution. I would appreciate any help.
Thank you.