Please improve the responses of the Utility URLs described in
Since the map API utility URLs need a repair (see https://feedback.secondlife.com/server-bugs/p/map-api-failures-coords-region-name-region-name-coords), I suggest to add these little improvements of the API along with the fix:
If "var" is left out, the response should not be some Javascript code, but:
  • the pure region name, like: "Wicktro", HTTP status code: 200
  • the coordinates as a simple JSON array, like: "[1134,1056]", HTTP status code: 200
In case that no data is found for the requested coordinates or region name, the response should be an empty body "" with HTTP status code 204.
In other cases like the recent error, the HTTP status code should an error code like 500.
HTTP status 200 should be reserved for a valid request with found data only.
If "var" is given though, the response should be like it has been all the time before the php2shell fix, to not break any scripts that rely on this behavior.
REASON
The javascript code in the response is useless if you regard basic programming rules and due to SOP. Called from LSL scripts or PHP servers it makes even less sense.
In LSL scripts the memory is very limited, so you won't want to waste any of that precious memory on unnecessary parsing. Here is a test example how LSL code could handle the suggested responses:
key queryGetRegionName;
key queryGetCoords;
string regionName;
list coords; // to contain region coords as integers
updateDisplay()
{
string output;
if ( "" != regionName ) output = "Region: " + regionName + "\n";
if ( coords ) output += "Coords: " + llList2CSV( coords );
llSetText( output, <1.,1.,1.>, 1. );
}
default
{
state_entry()
{
updateDisplay();
}
http_response( key request_id, integer status, list metadata, string body )
{
if ( 200 == status ) {
if ( queryGetRegionName == request_id ) {
regionName = body;
} else if ( queryGetCoords == request_id ) {
coords = llJson2List( body );
}
updateDisplay();
} else if ( 204 == status ) {
llSay( 0, "Sorry, the region could not be found!" );
} else {
llSay( 0, "Sorry, the SL map API is not available right now!" );
}
}
}
This way no fancy parsing would be required anymore. No further waste of memory for unnecessary obstacles in the API responses.