Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I have an kml source that needs multiple parameters, like:
http://www.thesite.com/ws?var1=a&var2=b
The map is not showing the contents of the kml file because my html source containts:
http://www.thesite.com/ws?var1=a\x26var2=b
So the & sign is replaced by \x26. I cannot find where this replacement is done in the module.
Is this a bug, or am I doing something wrong?
Comments
Comment #1
phayes CreditAttribution: phayes commented1. Where in your html do you see this url?
2. Are you trying to access kml that is on a different domain name from the page that is requesting it1. ?
3. Do you have firebug installed? Could you check for errors in the console with it?
Comment #2
cronix CreditAttribution: cronix commented1. I see the url when I do a view source of the page that should show the map. The url is in the jQuery.extend(Drupal.settings,.... line
2. Yes the domain is on a different server. I am using a service that returns a kml file based on the input parameters that I am trying to send.
3. I am not getting any additional errors. Its just that the & sign is substituted and I think it shouldn't be substituted.
Is there a place in the code that substitutes the & sign? Maybe I can try a hardcoded fix in order to check things out?
Comment #3
phayes CreditAttribution: phayes commentedYour problem is not with the URL encoding. It's the cross site request.
1.
jQuery.extend(Drupal.settings,.... line
encodes special characters, and will decode them properly when that is run through jquery.2. Your problem is you may not request KML on a different domain. This is considered an XSS vulnerability, and all modern browsers prevent it. See http://en.wikipedia.org/wiki/Cross-site_scripting for more details.
Your only solution at this point is to use a local proxy on the same domain that will make the request to the foreign domain for you.
Comment #4
tmcw CreditAttribution: tmcw commentedI would argue that in the 'easy KML' mode of 0.x.2.x.whatever, we should support ProxyHost so that if anyone builds a simple proxy in Drupal then we can immediately support remote KML.
Comment #5
phayes CreditAttribution: phayes commentedI agree. I wonder if there are any good php based proxies out there? That might actually make a good standalone module quite apart from openlayers.
Comment #6
cronix CreditAttribution: cronix commentedI have solved the problemy by building a poor-mans-cache. The code needs more work, error handling is not included yet. I am not a php developer, but the following is what I am working on:
This is based on the following table
Current issues that I need to implement:
I think a proxy like functionality would be great to have in OpenLayers, but maybe something like this based on simple caching can be considered too?
Comment #7
zzolo CreditAttribution: zzolo commentedClosing. It seems like @conix has begun to solve his own problem, and proxy support is not in scope of 1.x. Started issue here for 2.x: #615968: Document Proxy Possibilty