Problem with image URLs containing GET parameters

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
gderosa Offline
Junior Member
Posts: 4
Joined: Nov 2011
Reputation: 0
Post: #1
Hello, I'm developing an XBMC python addon which talks to a domotic (home automation) system:

http://dev.vemarsas.it/projects/xbmc-vera/wiki

Now I'm working on security cameras and I'm having a problem in displaying images whose URL contains '&', '?' or '=' .

So, look at this log:

Code:
10:04:19 T:139897994680064    INFO: easy_aquire - Created session to http://192.168.0.27
10:04:20 T:139897994680064   DEBUG: CFileCurl::GetMimeType - http://192.168.0.27:3480/data_request?id=cam_image&Device_Num=64 -> image/jpeg
10:04:23 T:139897994680064   DEBUG: GetImageHash - unable to stat url http://192.168.0.27:3480/data_request?id=cam_image&Device_Num=64

In the second line, you see that an HTTP GET (or at least HEAD) request has been properly performed (otherwise we couldn't know that MIME type is image/jpeg)

But in the third line there's an "unable to stat file" error :mad:

Everything works fine, instead, for URLs like http://www.example.com/myimage.jpg , and the image is properly displayed.

The "offending" code is here:

https://github.com/gderosa/xbmc-vera/blo...era.py#L29

So I'm just calling this function:

http://xbmc.sourceforge.net/python-docs/...e-setImage

I'm on Eden (latest git).

Strangely, there are no spaces or other characters which typically need to be url-escaped...

Thanks in advance!

Guido
find quote
gderosa Offline
Junior Member
Posts: 4
Joined: Nov 2011
Reputation: 0
Post: #2
After deeper analysis, the problem does not lie in GET parameters but in the lack of Content-Length header in the HTTP server response.

So, my question is now how to workaround such situation (which is not necessarily a bug, btw, see http://en.wikipedia.org/wiki/Chunked_transfer_encoding )
(This post was last modified: 2012-01-05 14:20 by gderosa.)
find quote
Gujs Offline
Senior Member
Posts: 116
Joined: Jul 2009
Reputation: 0
Post: #3
Hi,

I have the same problem with some channel logo pictures. Did you maybe found a solution for this?
find quote
VictorV Offline
Senior Member
Posts: 123
Joined: May 2009
Reputation: 0
Location: Norway
Post: #4
I ran into the very same problem a while ago. I ended up dowloading the images to local disk using a hash of the uri as filename, and finally passed that to the image control. It's a dirty workaround, but I didn't see any other solution from a addon developers view.
find quote
jmarshall Offline
Team-XBMC Developer
Posts: 24,564
Joined: Oct 2003
Reputation: 138
Post: #5
@gderosa: The stat should return true even if the length is not specified in the header (assuming that it doesn't need to be). If so, this might be a bug. Please open a bug report on trac and cc elupus.

Thanks,
Jonathan

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


[Image: badge.gif]
find quote
BlueCop Offline
bipedal omnivore
Posts: 1,654
Joined: May 2004
Reputation: 70
Post: #6
I think I stumbled across this problem with Chunked Transfer-Encoding.

I have urls for png which I want to use for an icon and fanart.

I noticed that it wouldn't display the fanart and was getting this error.

Code:
GetImageHash - unable to stat url http://www.c-spanvideo.org/videoLibrary/showPicture.php?dispid=305749-1&width=640&height=360

I don't get the error if I use the same URL as an icon. It seems to cache and save the image fine. It only fails if assigned as fanart.

I checked the header for the transfer and it is "Transfer-Encoding: chunked". I will try to put something together to replicate it for a trac.

I found it odd that it would cache the image fine for an icon but would fail for fanart.
(This post was last modified: 2012-05-10 20:27 by BlueCop.)
find quote