Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llHttpRequest - does it work now? 1.10

Leto Scholten
Head Honcho
Join date: 23 Nov 2005
Posts: 4
05-24-2006 15:00
Hi,

I'm testing the new function llHttpRequest which is new in the 1.10 release. But I cant seem to get it to work...

Here is my code:

key requestid;

default
{
state_entry()
{
llSetText("Hello.", <1,0,0>, 1.0);
//llSetTimerEvent(30);
}

touch_start(integer total_number)
{
llSay(0, "Touched.";);

requestid = llHTTPRequest("http://<dummy-ip>:8000", [HTTP_METHOD,"GET"], "";);

llSay(0, "ReqId: " + (string)requestid);
}


http_response(key request_id, integer status, list metadata, string body)
{
llSay(0, "ReqId: " + (string)request_id);

if (request_id == requestid)
{
llSay(0, "Status: " + (string)status + " : " + body);
} else
llSay(0,(string)status+" error";);
}

}

The outcome of this code is the two request id's which has the same value. And a line saying: Status: 0 :

Which means the status code that I get from the http request is 0??? According to the WIKI this status code should follow the HTTP specs. But there is no 0 status code in HTTP. It goes from 100 and up...

And the <dummy-ip> is just me removing the real IP so you hackers out there dont get itchy fingers *grins*

Anyone had any luck with this new function??? And if so...PLEASE post some code example :-D

/Leto
Leto Scholten
Head Honcho
Join date: 23 Nov 2005
Posts: 4
hmmm seems to work....but not correctly...
05-24-2006 15:48
Hi again,

After some further tests I can see that my sever is responding with a 404 (resource not found). But still the status is 0 in the script....seems like either the WIKI is not telling the truth or Linden has some bugs to fix...

/Leto
DolphPun Somme
The Pun is its own reword
Join date: 18 Nov 2005
Posts: 309
05-24-2006 16:39
CODE

key requestid;
default
{
state_entry()
{
llSay(0, "Hello, Avatar!");
llSetTimerEvent(900);
requestid = llHTTPRequest("http://www.dummy.com/tagsage.asp",[HTTP_METHOD,"GET"],"");
llSetTouchText("MORE!");
}
timer()
{
requestid = llHTTPRequest("http://www.dummy.com/tagsage.asp",[HTTP_METHOD,"GET"],"");

}


http_response(key request_id, integer status, list metadata, string body)

{

if (request_id == requestid)
{
llSetText(body,<1,0,0>,1);
llSay(0,body);
}

}


touch_start(integer total_number)
{
requestid = llHTTPRequest("http://www.dummy.com/tagsage.asp",[HTTP_METHOD,"GET"],"");
// llSay(0, "THAT TICKLES.");
}
}

SiRiS Asturias
Chaotic Coder
Join date: 27 Sep 2005
Posts: 93
I second the uncorrectness!!!
06-12-2006 07:20
It works, but with some initial bugs:

/20/d4/96884/4.html#post1068764

Enjoy! :p
_____________________
Proud founder of:
S3 - Self Storage Systems
S3storage.net (Coming Soon!)

SLBoutique.com
SLExchange.com - Find What You Need, When You Need It.

"Light travels faster than sound. This is why some people appear bright, until you hear them speak."