Jump to content

URL passed to llHTTPRequest contains a control character


Sandra Absent
 Share

You are about to reply to a thread that has been inactive for 1400 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I am writing a script that stores the locations and urls for objects in a database. Pretty straight forward stuff it seemed like since I deal with writing RL stuff like this all the time. The JSON response looks like this...

 

{
    "records": [
        {
            "id": "rec0cl20ZsbQqpGjU",
            "fields": {
                "api": "http://sim9050.agni.lindenlab.com:12046/cap/c897ce4e-5e34-50d4-422b-1952fb0037cc",
                "loc": "Plum Gut",
                "obj": "PGSC Committee Boat V1",
                "pos": "<111.12720, 184.04180, 20.38166>"
            },
            "createdTime": "2020-11-10T01:22:20.000Z"
        },
        {
            "id": "rec2hRQBUKoiSf0jD",
            "fields": {
                "api": "http://sim9050.agni.lindenlab.com:12046/cap/23556301-083b-de4a-f90c-bfcf4dc63776",
                "loc": "Plum Gut",
                "obj": "PGSC Race Buoy Plum Gut Gate 1",
                "pos": "<67.00000, 237.00000, 20.50000>"
            },
            "createdTime": "2020-11-10T01:23:34.000Z"
        },
        {
            "id": "rec3nKEHPoj47p1Go",
            "fields": {
                "loc": "Sugar Reef",
                "api": "http://simhost-048af44d68242f79c.agni.secondlife.io:12046/cap/ef9cdcc3-d8ec-1247-9363-c57cc5f07024",
                "pos": "<159.97450, 93.37987, 21.00000>",
                "obj": "PGSC Race Buoy Sugar Reef Blue"
            },
            "createdTime": "2020-11-10T02:47:51.000Z"
        },
        {
            "id": "rec5bjaIRxmI3zdpv",
            "fields": {
                "api": "http://sim9050.agni.lindenlab.com:12046/cap/5a7edcd3-4d52-16ff-7eb7-eebd976f5ff6",
                "loc": "Plum Gut",
                "obj": "PGSC Race Buoy Plum Gut Gate 2",
                "pos": "<97.00000, 237.00000, 20.50000>"
            },
            "createdTime": "2020-11-10T01:23:56.000Z"
        },
        {
            "id": "rec8LoL9rPR4JJaFS",
            "fields": {
                "loc": "Sugar Reef",
                "api": "http://simhost-048af44d68242f79c.agni.secondlife.io:12046/cap/356ef6b4-6243-5a76-ea10-b24c7bab28cb",
                "pos": "<72.86246, 178.38280, 21.00000>",
                "obj": "PGSC Race Buoy Sugar Reef Red"
            },
            "createdTime": "2020-11-10T02:47:39.000Z"
        },
        {
            "id": "rec8cGBGlCmVDj7lo",
            "fields": {
                "api": "http://sim9050.agni.lindenlab.com:12046/cap/4c0e2b25-79b8-0997-b81a-b75ba79f30c2",
                "loc": "Plum Gut",
                "obj": "PGSC Race Buoy Start 2",
                "pos": "<109.15630, 185.52140, 20.50000>"
            },
            "createdTime": "2020-11-10T01:20:00.000Z"
        },
        {
            "id": "recFX7y0Kd74isK58",
            "fields": {
                "api": "http://sim9890.agni.lindenlab.com:12046/cap/c5dcb85e-4911-b2a6-b040-7cefc4439030",
                "loc": "Quoddy Head",
                "obj": "PGSC Race Buoy Quoddy",
                "pos": "<112.00000, 243.00000, 21.00000>"
            },
            "createdTime": "2020-11-10T01:23:00.000Z"
        },
        {
            "id": "recWXR3nLO8PG6uU9",
            "fields": {
                "api": "http://sim8841.agni.lindenlab.com:12046/cap/f278ca70-b648-368b-05e1-dfe3d761f596",
                "loc": "Flat Hammock",
                "obj": "PGSC Race Buoy Flat Hammock",
                "pos": "<25.01285, 126.48830, 21.00000>"
            },
            "createdTime": "2020-11-10T01:24:38.000Z"
        },
        {
            "id": "recYnKzIFypAF6WOt",
            "fields": {
                "api": "http://sim9050.agni.lindenlab.com:12046/cap/06d5aef6-2353-1096-79c6-f5bcefe03b7c",
                "loc": "Plum Gut",
                "obj": "PGSC Race Buoy Start 1",
                "pos": "<58.18698, 185.93580, 20.50000>"
            },
            "createdTime": "2020-11-10T01:21:29.000Z"
        }
    ]
}

 

the problem I am having is with the last two records...

I handle the response as follows....

 

http_response(key request_id, integer status, list metadata, string body)
    {
        list records = llJson2List(llJsonGetValue(body,["records"]));
        if(request_id == listRequestId && status == 200 && llGetListLength(records) >= 1)
        {
            integer i = 0;
            bouysRezzed = !bouysRezzed;
            while (i <= llGetListLength(records) - 1)
            {
                string object = llJsonGetValue((string)records[i], ["fields", "obj"]);
                string region = llJsonGetValue((string)records[i], ["fields", "loc"]);
                string url = llJsonGetValue((string)records[i], ["fields", "api"]);
                string position = llJsonGetValue((string)records[i], ["fields", "pos"]);
                llOwnerSay(url);
                string action = "disabling";
                if (bouysRezzed) action = "enabling";
                llOwnerSay(action + " " + object + " in " + region + " at postion " + position);
                llHTTPRequest(url, [HTTP_METHOD, "POST"], (string)bouysRezzed);
                i++;
            }   
        } else if(request_id != listRequestId && status == 200) 
        {
            llOwnerSay(body);
        }
    }

 

If I remove the last two records this script runs without any issues. As soon as I repopulate the last two records, I get the URL passed to llHTTPRequest contains a control character error in the debugger.

This is really a two part question.

1. What the heck am I doing wrong ?

2. Having limited LSL experience am I on the right path to parsing the JSON to get the values I need?

Link to comment
Share on other sites

One thing that puzzles me is your use of the term (string)records[i] which I'm unfamiliar with, and which should throw a syntax error. LSL lists are not arrays and you need to use an llList2* function to access list items: llList2String (records, i).

Edit: doh! Firestorm's pre-processor lazy lists thing hit me just as I hit the submit button.

Edited by KT Kingsley
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1400 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...