Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

HTTPRequest

Go Dovgal
Registered User
Join date: 19 Jul 2007
Posts: 8
07-19-2007 14:13
Hello all. I am trying to connect to a server outside of Second life. I am using this code (taken from the library):

CODE

key requestid;
string resident;

default
{
state_entry()
{
llListen(1,"","","");
}
listen( integer chan, string name, key id, string msg )
{
list names = llParseString2List(msg,[" "],[]);
resident = llDumpList2String(names," ");
requestid = llHTTPRequest("https://IP ADDRESS:7443/",[HTTP_METHOD,"POST"],"POST INFORMATION");
}
http_response(key request_id, integer status, list metadata, string body)
{
llWhisper(0, body);
llWhisper(0, (string) status);
}
}


When I do this, I get no reply and a STATUS: 499. There doesn't seem to be a reference for status 499 either. There is no record of attempting to contact the server in the server logs. This server is on a laptop running apache using a cell card.

Are there rules about who Second Life will or won't send http requests to?
Milambus Oh
Registered User
Join date: 6 Apr 2007
Posts: 224
07-19-2007 14:20
Everything looks good at a first glance. However, I am unsure if you are able to specify the port you wish to contact like that.

Try loading a page off some other site, like google
Marcel Cromulent
Registered User
Join date: 28 Jan 2007
Posts: 10
07-19-2007 14:49
Maybe you could also try to use GET instead of POST, just to test the connection. I have had difficulties making POST work, while GET worked fine.
Lee Ludd
Scripted doors & windows
Join date: 16 May 2005
Posts: 243
07-19-2007 16:19
From: Go Dovgal
When I do this, I get no reply and a STATUS: 499. There doesn't seem to be a reference for status 499 either. There is no record of attempting to contact the server in the server logs. This server is on a laptop running apache using a cell card.


Status 499 is supposedly returned if the Second Life server was unable to reach the target URL.

This happens a lot. The web page you are trying to contact with llHTTPRequest is up and running, and you can reach it from your own machine, but the Linden server doesn't see it. Sometimes you will get a 499 status, but other times a 200 status but the body will return the first 2048 characters of an HTML document that is apparently telling you that some server has been unable to reach the URL you specified.

I have seen the Linden server do this for 12 straight hours, then suddenly it will successfully connect for anothe six hours or so, then break again. I have sent many bug reports, and opened a support ticket, about this issue but have yet to receive any kind of response.
Go Dovgal
Registered User
Join date: 19 Jul 2007
Posts: 8
07-20-2007 07:25
From: Milambus Oh
Everything looks good at a first glance. However, I am unsure if you are able to specify the port you wish to contact like that.

Try loading a page off some other site, like google


Yes, I can get the first 2048 characters from the Google site. The code works for some sites, but not the one on the server I'm running.

My site does not have a "name" per se, just an IP addy. Would this be a problem?
Go Dovgal
Registered User
Join date: 19 Jul 2007
Posts: 8
07-20-2007 07:27
From: Marcel Cromulent
Maybe you could also try to use GET instead of POST, just to test the connection. I have had difficulties making POST work, while GET worked fine.


This actually brings up another problem. If I can connect to my site, I can use get and write a python script. If I can't connect to my site I have to try to post to a form on another site. My site would access this form instead, which would be easier, but I have to be able to access it. Sorry for the vagueness, I can't really say WHAT I'm doing.
Go Dovgal
Registered User
Join date: 19 Jul 2007
Posts: 8
07-20-2007 07:27
From: Lee Ludd
Status 499 is supposedly returned if the Second Life server was unable to reach the target URL.

This happens a lot. The web page you are trying to contact with llHTTPRequest is up and running, and you can reach it from your own machine, but the Linden server doesn't see it. Sometimes you will get a 499 status, but other times a 200 status but the body will return the first 2048 characters of an HTML document that is apparently telling you that some server has been unable to reach the URL you specified.

I have seen the Linden server do this for 12 straight hours, then suddenly it will successfully connect for anothe six hours or so, then break again. I have sent many bug reports, and opened a support ticket, about this issue but have yet to receive any kind of response.


Wierd.

I would like to thank everyone for thier responses. This is very helpful.
Milambus Oh
Registered User
Join date: 6 Apr 2007
Posts: 224
07-20-2007 07:39
1. Could this be your problem?

parameter Value Type Default
HTTP_VERIFY_CERT 3 integer TRUE
If TRUE, the server SSL certificate must be verifiable using one of the standard certificate authorities when making HTTPS requests. If FALSE, any server SSL certificate will be accepted. (Supported in version 1.10.4)

Is your SSL certificate not verifying?

2. Have you tried configuring your website to a standard port number and having SL contact that?
Go Dovgal
Registered User
Join date: 19 Jul 2007
Posts: 8
07-20-2007 10:42
Sadly, nothing.

However, I have found ANOTHER site that I can place a Python script on. So, I am moving this endeavour there. Maybe it will work "this" time.

Thanks for all the help.