Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Duped http_response events

Compulov Weeks
NARF!
Join date: 2 May 2006
Posts: 7
03-14-2007 03:20
Hey all, I've stumbled upon something that was driving my wife and I insane until I whittled down what was happening. We have two scripts in a single prim which make calls to llHTTPRequest() and what we discovered was that when *one* script made an http request, *both* scripts raised the http_response header. Here's a very simple proof of concept I made up:

First script:
CODE

default
{
touch_start(integer total_number)
{
llHTTPRequest("http://www.google.com", [HTTP_METHOD, "GET"], "");
}

http_response(key id, integer status, list meta, string body)
{
llSay(0, "Requestor response...");
}
}


Second script:
CODE

default
{
http_response(key id, integer status, list meta, string body)
{
llSay(0, "Dupe!");
}
}


If you put those both in a prim and click, it'll show
Object: Requestor response...
Object: Dupe!

I realize the examples have a check to see if the request id matches the one that llHTTPRequest() generated -- but for our purposes that wouldn't have worked as we might make a couple of requests at once and the request contained all the data we needed. I worked around this by storing outstanding request ids in a list and checking that list, but that seems like such a hack when this isn't expected behavior. At least I didn't think it'd be expected. I can't find any reference to it in the lslwiki.net Wiki and a quick search of this forum didn't reveal any reference to it either. Has anyone else experience this behavior, or is this something new? It's the first time we've tried this sort of thing, so we're not sure if it happened in other releases or not.
Squirrel Wood
Nuteater. Beware!
Join date: 14 Jun 2006
Posts: 471
03-14-2007 04:16
This is intended.

The sim doesn't keep track of which script fired the request but which object did. So it passes the request to all scripts in the object. Thus is why you are supposed to keep track of the request ID so you can filter out your stuff.