- Home /
Max String Length in WWW url's?
I realize there are limitations to GET send's, but what if the URL you are fetching from itself is too long?
I am trying to fetch a series of images that have format similar to:
http://wsdds3-01.dz.sv.decartahws.com/openls/image/TILE?LLMIN=37.763899999640000000,-122.402155387007640000&LLMAX=37.764620000360000000,-122.401244612992370000&WIDTH=256&HEIGHT=256&FORMAT=GIF&CLIENTNAME=livepages&SESSIONID=999&CONFIG=global-decarta&N=0&E=0
If you copy and paste that long url in the browser, an image loads...
However, when I try loading the url above into a cube in the below common code from the WWW example, the missing texture questionmark shows.
var www : WWW = new WWW (url);
// Wait for download to complete
yield www;
// assign texture
renderer.material.mainTexture = www.texture;
Please help!
Answer by roamcel · Aug 30, 2011 at 01:50 PM
I believe you're not facing an url length issue, but a cookie/ referrer one. Quite possibly, the site requires:
1- that the referrer be itself
2- that there's a cookie in your browser related to the site
I'm in fact pretty sure that if you print the url of your www object, it'll be exactly as you typed it. Unfortunately there's not much you can do in the first case (other than using a complete url agent, which I unfortunately don't know to exist for unity). In the second case you can create or fake the cookie, that you feed to unity's www explorer
hmm if you could access that image by clicking that link... without having been authenticated, it seems it is not a cookie issue?
in either case, if the session times out, the image shown looks different - and it's not the missing texture red question mark... here's the timed out image http://wsdds3-01.dz.sv.decartahws.com/openls/image/TILE?LL$$anonymous$$IN=
it appears to be only PNG and JPG accepted - the URL above is a GIF.
TILE in the URL indicates a SCRIPT. The script is responsible for the session and cookie management. The very fact that you access it will run its code. The fact that you receive an image is just a 'cohincidence'. If the script was designed differently, you could receive an audio clip, or an html page generated dynamically.