castkodi
castkodi copied to clipboard
[Workaround] Kodi connection problem - cookie related
Hi All,
This is just to share findings and workaround identified.
Problem description:
- Cast Kodi was showing yellow triangle stating it can't connect to working Kodi,
- Kodi side settings all configured as required,
- tcp/HTTP level / GET /jsonrpc request was sent and tcp ACK returned by Kodi, but nothing else - it was sort of ignored at HTTP level.
Environment:
- Firefox 74.0 (Linux),
- Cast Kodi - 4.16.0,
- Kodi 18.5 / Leia (CoreElec based though this shouldn't matter).
- other web services running on same IP, different ports though.
Further investigation shown that running FF from fresh profile connects well to the same Kodi without any changes at other end. Details investigation of the GET request sent to Kodi from original FF profile and compared to the one sent from fresh profile revealed that cookies for other service on the same IP has been sent:
[truncated]Cookie: portainer
Cookie pair: portainer
Cookie pair: portainer
Cookie pair [truncated]: portainer
Cookie pair: portainer
Cookie pair: portainer
Cookie pair: portainer
Cookie pair: PHPSESSID=123
Workaround: Cookies were flushed and Cast Kodi was able to successfully connect to the Kodi.
Question: Why would Firefox send some unrelated cookies to a different port even if same IP?
This is most probably Firefox issue, though exposed to me only due to problems with Cast Kodi and given that it is Cast Kodi behind the request, question is being raised here.
Merci pour le plugin génial.
Thanks for the detailed problem, you may have found the cause of the issues https://github.com/regseb/castkodi/issues/13 and https://github.com/regseb/castkodi/issues/15. I've reproduced the issue and the problem does come from the cookies that increase the size of the HTTP request. Kodi's TCP server doesn't accept requests bigger than 1024 bytes.
This is not a bug in Firefox, cookies must be shared between the different ports of an address (bugzilla#469287). Cast Kodi shouldn't send cookies, but this isn't possible because there are no options in the WebSocket
client (I proposed this feature to whatwg/websockets#18). At the moment I don't know how to fix this problem. 😕
Kodi "Matrix" 19.2 (released in October 2021 🎉) has increased the size of accepted requests to 64 Kio (before the limit was 1 Kio). With this new value, there should be no more problems with large requests due to cookies.