Some requests not being routed over HTTPS

Issue description:

Some JSON-RPC requests are being sent over HTTP instead of HTTPS, with HTTPS enabled.

I have HTTPS enabled and it mostly works (I can view my library and such), but throws an error during setup like, “Unable to get Kodi version.” When I dig into the logs, it appears that some (successful) queries are going over HTTPS, while others are failing because they’re attempting HTTP.


Successful query example:

2023-10-23 13:46:58.061 Verbose/KodiNexus: --> [381] POST (61-byte body)
2023-10-23 13:46:58.061 Verbose/KodiNexus: --> [381] {"id":871,"jsonrpc":"2.0","method":"Player.GetActivePlayers"}
2023-10-23 13:46:58.501 Verbose/KodiNexus: <-- [381] 200 OK (441ms, 38-byte body)
2023-10-23 13:46:58.505 Verbose/KodiNexus: <-- [381] {"id":871,"jsonrpc":"2.0","result":[]}

Failed Query Examples:

2023-10-23 13:47:09.438 Verbose/KodiHelix: --> [638] POST (106-byte body)
2023-10-23 13:47:09.439 Verbose/KodiHelix: --> [638] {"id":773,"jsonrpc":"2.0","method":"Application.GetProperties","params":{"properties":["version","name"]}}
2023-10-23 13:47:09.470 Verbose/KodiHelix: <-- [638] HTTP FAILED: unexpected end of stream on
2023-10-23 13:47:09.475 Error/KodiHelix: Error unexpected end of stream on
	at hb.h.g(SourceFile:134)
	at a2.g.c(SourceFile:5)
	at gb.b.a(SourceFile:243)
	at gb.f.b(SourceFile:133)
	at fb.a.a(SourceFile:102)
	at gb.f.b(SourceFile:133)
	at db.a.a(SourceFile:151)
	at gb.f.b(SourceFile:133)
	at gb.a.a(SourceFile:135)
	at gb.f.b(SourceFile:133)
	at gb.g.a(SourceFile:141)
	at gb.f.b(SourceFile:133)
	at q3.d.a(SourceFile:129)
	at gb.f.b(SourceFile:133)
	at cf.e.a(SourceFile:81)
	at gb.f.b(SourceFile:133)
	at q3.c.a(SourceFile:419)
	at gb.f.b(SourceFile:133)
	at le.b.a(SourceFile:3)
	at gb.f.b(SourceFile:133)
	at fb.i.h(SourceFile:96)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(
	at java.util.concurrent.ThreadPoolExecutor$
Caused by: \n not found: limit=0 content=…
	at nb.r.e0(SourceFile:158)
	at hb.h.g(SourceFile:39)
	... 24 more
2023-10-23 13:47:09.439 Verbose/KodiHelix: --> [592] POST (53-byte body)
2023-10-23 13:47:09.439 Verbose/KodiHelix: --> [592] {"id":440,"jsonrpc":"2.0","method":"JSONRPC.Version"}
2023-10-23 13:47:09.472 Verbose/KodiHelix: <-- [592] HTTP FAILED: unexpected end of stream on
2023-10-23 13:47:09.479 Verbose/KodiHelix: --> [560] POST (106-byte body)
2023-10-23 13:47:09.479 Verbose/KodiHelix: --> [560] {"id":658,"jsonrpc":"2.0","method":"Application.GetProperties","params":{"properties":["version","name"]}}
2023-10-23 13:47:09.501 Verbose/KodiHelix: <-- [560] HTTP FAILED: unexpected end of stream on

I would love to see the scheme consistently applied so it doesn’t throw errors.

I need proper logs not small extracts …

Scheme is properly applied if you add the host correctly. You probably edited the host and forget to change the connection type.

Provide logs when adding the host from scratch.

I removed the host and added it back. Same result. Requests are split between HTTP and HTTPS, all going to the same port.

debug.log (47.2 KB)

They are not split, there’s a few http calls as tests during host add. (You can see them as KodiHelix)

But all the host calls on the nexus host KodiNexus are https.

Yatse surfaces feedback that the request failed, which is misleading, since it actually works.

Is this after editing the host that was already added via the wizard ?

What does the connection type says in the advanced tab?

HTTPS (no cert checks)

This message shows again if I click the “Check” button.

Hum makes no sense as it’s the same tests as the add wizard.

Anyway to have a test access to the server to see what is happening?

I’m not really set up for external access, but I see the same behavior with curl. The server is not listening on port 80.

$ curl -u ***:*** -k -X POST -d '{"id":1,"jsonrpc":"2.0","method":"JSONRPC.Version"}' -H "Content-Type: application/json"

$ curl -u ***:*** -k -X POST -d '{"id":2,"jsonrpc":"2.0","method":"JSONRPC.Version"}' -H "Content-Type: application/json"
curl: (7) Failed to connect to port 80 after 26 ms: Couldn't connect to server

Is there a reason you think the “Unable to get Kodi version” error is not related to sending that request over HTTP instead of HTTPS, as seen in the logs?

The test is http protocol but on the proper port so not your curl test.

And if you can add the host then the test pass, the fact that the same test fails after editing an host is the issue here as it’s the same code that does the test.

Without access it’s hard to know what is really happening.