Kodi Community Forum

Full Version: Can't open HTTP Stream, no url escaping?!?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

I think I found a bug within Kodi, I'm not sure that's why I ask you guys here.

So to reproduce this bug, take a simple HTTP Stream which has unescaped spaces, I don't want to post the link here, but you can get it out of mydebug log on line 24:

The debug log also contains the error messages etc.

Kodi just won't play the stream, I normally use Yatse from my phone to send streams to Kodi, but I could also reproduce the bug when I put the link into a .strm file and tried to start it. So it's not a fault of Yatse.

To fix this, you simply have to replace the spaces with %20 and the stream works without problems, so it seems, that Kodi doesn't escape links urls, why is that?
Is this a bug or is this intended?
Why would kodi escape any URL if the URL can be escaped in several different ways? You should escape and send Kodi a playable URL.
Well, I'm using the Android app "proxer.me" which is a streaming portal for anime, so when I select the stream Android asks me which app should be used to play the stream/file, at this point I just select "Stream to Media Center" from Yatse, there is no possbile way I can edit the url in this state, so I can't send Kodi a playable URL.

The correct way to escape URLs is using ASCII encoding which is a standard, so it's a valid point to let Kodi do the escaping for HTTP streams, since the provided URL IS a playable URL, but Kodi just can't handle the spaces which pretty much counts as a bug.

The only thing that is needed to do is to escape the string with "urllib.quote(string)" before opening it and that's it.
its not a playable url if it contains spaces
(2015-07-20, 19:12)wsnipex Wrote: [ -> ]its not a playable url if it contains spaces

That's why I would find it great if Kodi could just escape URLs. Smile

Edit: Alright, doesn't matter anymore, I asked the developer of the streaming portal app to escape the url serverside, he responded quick and now I can watch the streams.
URLs can be escaped in different ways. urllib.quote(URL) makes spaces as %20, urllib.quote_plus(URL) makes spaces a + sign. There are several other ways to escape the URL and multiple combinations of urllib.quote specially if you consider ignore characters. So I don't consider it a bug but rather the way it should (and makes sense to behave) in the first place.
Yes, there are several ways, but the standard is using normal ASCII encoding with UTF-8 like most common languages do with their default encoding method.
In general you only use + for query parameters in URIs and the part before the query parameters is commonly escaped with %20.

I know that http://tools.ietf.org/html/rfc3986 defined says "This specification does not define a generative grammar for URIs; that task is performed by the individual specifications of each URI scheme."
But this is the common way, it's like eating fish, most of the time you can just cut it with your fork, but it's common that you should use a fish knife or atleast a normal knife.

IMHO the URL provided should already be escaped through the server, yes.
But like in this case, it's not always like that and unlike in my case, users often don't have a chance to talk to the developer because the project maybe isn't in developed further anymore or you have to pay for premium support etc etc etc.
It may be more of a feature request than a bug, but since cases like this are existing, I would call it a "flaw" in handling of URLs from the software.

Or is there any case known where you have to pass arguments to the stream URL with spaces? If not I see no reason not to escape the URL clientside, the players on my Android can also handle unescaped URLs, so why not Kodi too?
Why does it make sense that a few spaces are defining a URL as "unplayable" if it would be playable when it was just escaped?