Difference between revisions of "LSL HTTP server"

From Second Life Wiki
Jump to navigation Jump to search
m (→‎URL Lifetime Limitations: Avoid breaking list structure for Stone Tremont's comment.)
m (added intra-wiki links)
Line 1: Line 1:
{{LSL Header|ml=*}}
{{LSL Header|ml=*}}
== Introduction ==
== Introduction ==
This is the counterpart to [[llHTTPRequest]]. While llHTTPRequest enables LSL scripts request data from HTTP-accessible sources, HTTP-in enables outside sources to request data from scripts in Second Life. The key difference is that llHTTPRequest exchanges data when the script in SL wants; HTTP-in allows outside sources to determine when they need to communicate with scripts in SL.
This is the counterpart to [[llHTTPRequest]]. While [[llHTTPRequest]] enables LSL scripts request data from HTTP-accessible sources, HTTP-in enables outside sources to request data from scripts in Second Life. The key difference is that [[llHTTPRequest]] exchanges data when the script in SL wants; HTTP-in allows outside sources to determine when they need to communicate with scripts in SL.


Prior to HTTP-in, similar functionality could be achieved by [[HTTP Polling|polling]] with [[llHTTPRequest]], [[llEmail]] and [[:Category:LSL_XML-RPC|XML-RPC]]. All three are cumbersome and the latter two have serious scalability bottlenecks.
Prior to HTTP-in, similar functionality could be achieved by [[HTTP Polling|polling]] with [[llHTTPRequest]], [[llEmail]] and [[:Category:LSL_XML-RPC|XML-RPC]]. All three are cumbersome and the latter two have serious scalability bottlenecks.


It is important to note that LSL HTTP servers cannot use HTML except in very limited circumstances. See [[#Other_Limitations|Other Limitations]] for details.
It is important to note that LSL HTTP servers cannot use HTML except in very limited circumstances. See [[#Other_Limitations|Other Limitations]] for details.
Line 14: Line 14:
** Inworld game for which an external program handles the primary game logic that needs to manipulate inworld items.
** Inworld game for which an external program handles the primary game logic that needs to manipulate inworld items.
* HUD UI when used with [[llSetContentType]]. See [[HTML HUD Demo]].
* HUD UI when used with [[llSetContentType]]. See [[HTML HUD Demo]].
Gory Technical Details follow. Or jump straight to the [[LSL_http_server/examples | Script Examples]].
Gory Technical Details follow. Or jump straight to the [[LSL_http_server/examples | Script Examples]].


== Script API ==
== Script API ==
* '''[[LlRequestURL|key llRequestURL()]]'''
* '''[[llRequestURL|key llRequestURL()]]'''
: Request a new LSL Server public URL.  
: Request a new LSL Server public URL.
: An http_request event will be triggered with success or failure and include the returned key
: An [[http_request]] [[event]] will be triggered with success or failure and include the returned [[key]]
: HTTP-in uses port 12046, and HTTPS-in uses port 12043.
: HTTP-in uses port 12046, and HTTPS-in uses port 12043.
: NOTE: URL's are assigned to the script that called them, an http_request event will not be triggered in a script separate from the one that requested the URL.
: NOTE: URL's are assigned to the script that called them, an [[http_request]] [[event]] will not be triggered in a script separate from the one that requested the URL.
<lsl>request_id = llRequestURL();</lsl>
<lsl>request_id = llRequestURL();</lsl>
* '''[[LlRequestSecureURL|key llRequestSecureURL()]]'''
* '''[[llRequestSecureURL|key llRequestSecureURL()]]'''
: Similar to ''llRequestURL'' except requests an HTTPS / SSL URL.
: Similar to [[llRequestURL]] except requests an HTTPS / SSL URL.
: An http_request event will be triggered with success or failure and include the returned key
: An [[http_request]] [[event]] will be triggered with success or failure and include the returned [[key]]
<lsl>request_id = llRequestSecureURL();</lsl>
<lsl>request_id = llRequestSecureURL();</lsl>
* '''[[LlReleaseURL|llReleaseURL(string url)]]'''
* '''[[llReleaseURL|llReleaseURL(string url)]]'''
: Clear the specific URL, used for both secure and non-secure URLs.
: Clear the specific URL, used for both secure and non-secure URLs.
<lsl>llReleaseURL("http://sim3015.aditi.lindenlab.com:12046/cap/3ff4f3f2-ea08-76c1-cef6-a22b4a573a7c");</lsl>
<lsl>llReleaseURL("http://sim3015.aditi.lindenlab.com:12046/cap/3ff4f3f2-ea08-76c1-cef6-a22b4a573a7c");</lsl>
* '''[[Http_request|http_request(key id, string method, string body)]]'''
* '''[[http_request|http_request(key id, string method, string body)]]'''
: Event triggered when an URL is hit:
: Event triggered when an URL is hit:
:* id is unique to this request
:* id is unique to this request
:* Supported methods are GET/POST/PUT/DELETE
:* Supported methods are <code>"GET"</code>, <code>"POST"</code>, <code>"PUT"</code>, <code>"DELETE"</code>
:* body: The body of the request.
:* body: The body of the request.
: Event also triggered with response to ''llRequestURL'' and ''llRequestSecureURL''
: Event also triggered with response to [[llRequestURL]] and [[llRequestSecureURL]]
:* id matches the key returned by ''llRequestURL'' or ''llRequestSecureURL''
:* id matches the key returned by [[llRequestURL]] or [[llRequestSecureURL]]
:* method == [[URL_REQUEST_GRANTED]] for success, [[URL_REQUEST_DENIED]] for failure to get an URL
:* method == [[URL_REQUEST_GRANTED]] for success, [[URL_REQUEST_DENIED]] for failure to get an URL
:* body is the public URL. If unable to get a public URL body will be empty.
:* body is the public URL. If unable to get a public URL body will be empty.
* '''[[LlHTTPResponse|llHTTPResponse(key id, integer status, string body)]]'''
* '''[[llHTTPResponse|llHTTPResponse(key id, integer status, string body)]]'''
: Send ''body'' to the requester with status code ''status''
: Send ''body'' to the requester with status code ''status''
:* id is the id from http_request that maps to the specific request
:* id is the id from [[http_request]] that maps to the specific request
:* sending a response to the requestor will clear the request and delete information associated with it
:* sending a response to the requestor will clear the request and delete information associated with it
* '''[[LlGetHTTPHeader|string llGetHTTPHeader(key id, string header)]]'''
* '''[[llGetHTTPHeader|string llGetHTTPHeader(key id, string header)]]'''
: Returns the string for the specified header in the specified request. All received headers are converted to lower case and this function is case-sensitive. The returned string is limited to 255 characters.
: Returns the string for the specified header in the specified request. All received headers are converted to lower case and this function is case-sensitive. The returned string is limited to 255 characters.
:* Supported headers are:
:* Supported headers are:
::* "x-script-url": The base url, as originally received from [[llRequestURL]] or [[llRequestSecureURL]].
::* <code>"x-script-url"</code>: The base url, as originally received from [[llRequestURL]] or [[llRequestSecureURL]].
::* "x-path-info": Any trailing path information from the requested url
::* <code>"x-path-info"</code>: Any trailing path information from the requested url
::* "x-query-string": Any query arguments, the text past a ? in the url
::* <code>"x-query-string"</code>: Any query arguments, the text past a <code>?</code> in the url
::* "x-remote-ip": IP address of the host that made the request
::* <code>"x-remote-ip"</code>: IP address of the host that made the request
::* "user-agent": The user-agent header as reported by the requester
::* <code>"user-agent"</code>: The user-agent header as reported by the requester
:* Supported headers sent by '''[[LlHTTPRequest|llHTTPRequest()]]'''
:* Supported headers sent by '''[[llHTTPRequest|llHTTPRequest()]]'''
::* "x-secondlife-shard"
::* <code>"x-secondlife-shard"</code>
::* "x-secondlife-object-name"
::* <code>"x-secondlife-object-name"</code>
::* "x-secondlife-object-key"
::* <code>"x-secondlife-object-key"</code>
::* "x-secondlife-region"
::* <code>"x-secondlife-region"</code>
::* "x-secondlife-local-position"
::* <code>"x-secondlife-local-position"</code>
::* "x-secondlife-local-rotation"
::* <code>"x-secondlife-local-rotation"</code>
::* "x-secondlife-local-velocity"
::* <code>"x-secondlife-local-velocity"</code>
::* "x-secondlife-owner-name"
::* <code>"x-secondlife-owner-name"</code>
::* "x-secondlife-owner-key"
::* <code>"x-secondlife-owner-key"</code>
requested url: ''https://sim3015.aditi.lindenlab.com:12043/cap/a7717681-2c04-e4ac-35e3-1f01c9861322/foo/bar?arg=gra''
 
x-script-url: ''https://sim3015.aditi.lindenlab.com:12043/cap/a7717681-2c04-e4ac-35e3-1f01c9861322''
<code>
x-path-info: ''/foo/bar''
    requested url: [https://sim3015.aditi.lindenlab.com:12043/cap/a7717681-2c04-e4ac-35e3-1f01c9861322/foo/bar?arg=gra https://sim3015.aditi.lindenlab.com:12043/cap/a7717681-2c04-e4ac-35e3-1f01c9861322/foo/bar?arg=gra]
x-query-string: ''arg=gra''
    x-script-url:   [https://sim3015.aditi.lindenlab.com:12043/cap/a7717681-2c04-e4ac-35e3-1f01c9861322 https://sim3015.aditi.lindenlab.com:12043/cap/a7717681-2c04-e4ac-35e3-1f01c9861322]
    x-path-info:   "/foo/bar"
    x-query-string: "arg=gra"
</code>
 
: This header information is valid for 30 seconds, or until [[llHTTPResponse]] is called.
: This header information is valid for 30 seconds, or until [[llHTTPResponse]] is called.
* '''[[Changed|changed(integer change)]]'''
* '''[[Changed|changed(integer change)]]'''
:* [[CHANGED_REGION_START]]: New changed() event triggered on region startup.
:* [[CHANGED_REGION_START]]: New [[changed]] [[event]] triggered on region startup.
:* [[CHANGED_REGION]]: New changed() event triggered when crossing regions or teleporting. Please read [[CHANGED_REGION]] for more info.
:* [[CHANGED_REGION]]: New [[changed]] [[event]] triggered when crossing regions or teleporting. Please read [[CHANGED_REGION]] for more info.
:* [[CHANGED_TELEPORT]]: New changed() event triggered when the avatar teleports. Please read [[CHANGED_TELEPORT]] for more info.
:* [[CHANGED_TELEPORT]]: New [[changed]] [[event]] triggered when the avatar teleports. Please read [[CHANGED_TELEPORT]] for more info.
* '''[[LlGetFreeURLs|integer llGetFreeURLs()]]'''
* '''[[llGetFreeURLs|integer llGetFreeURLs()]]'''
: Returns the number of URLs available to this script.
: Returns the number of URLs available to this script.


Line 77: Line 81:
* URLs will be lost in the following cases, all detectable by the script events listed with them.
* URLs will be lost in the following cases, all detectable by the script events listed with them.
** On object derez/rez: [[on_rez]]
** On object derez/rez: [[on_rez]]
** On script save/reset: ''[[default]] [[state_entry]]() (trickier in multi-state scripts)
** On script save/reset: ''[[default]] [[state_entry]] (trickier in multi-state scripts)
** On region cross or TP(attachments): [[changed]]() {{LSLGC|Events|event}}, [[CHANGED_REGION]] and [[CHANGED_TELEPORT]]<p>--(I've been testing this have found that TP's within a region DO NOT cause a URL to be lost, therefore, you do not need to request a new URL on CHANGED_TELEPORT, because CHANGED_REGION will handle a TP to a different region. If you choose to request a URL after a TP, i recommend releasing the old URL to be sure you don't have too many used. --Stone Tremont Aug 8th 2010)</p>
** On region cross or TP(attachments): [[changed]] {{LSLGC|Events|event}}, [[CHANGED_REGION]] and [[CHANGED_TELEPORT]]. Testing this have it has been found that teleports within a region DO NOT cause a URL to be lost, therefore, you do not need to request a new URL on [[CHANGED_TELEPORT]], because [[CHANGED_REGION]] will handle a teleport to a different region. If you choose to request a URL after a teleport, it is recommended to release the old URL to be sure you don't have too many used. (Stone Tremont Aug 8th 2010)
** On region restart: [[changed]]() event, ''new'' flag [[CHANGED_REGION_START]]
** On region restart: [[changed]] [[event]], flag [[CHANGED_REGION_START]]
* When urls are 'lost' it means that all public urls for that script are gone, new ones will need to be requested and the new urls will '''''not''''' resemble the old ones.
* When urls are 'lost' it means that all public urls for that script are gone, new ones will need to be requested and the new urls will '''not''' resemble the old ones.
* Maintaining persistent URLs will require building or using an external service similar to how [http://en.wikipedia.org/wiki/Dynamic_DNS Dynamic DNS] services work for tying domain names to dynamic IP addresses.
* Maintaining persistent URLs will require building or using an external service similar to how [http://en.wikipedia.org/wiki/Dynamic_DNS Dynamic DNS] services work for tying domain names to dynamic IP addresses.


Contributed HTTP-in URL mapping implementations and services:
Contributed HTTP-in URL mapping implementations and services:
* A Dynamic DNS service running on Google App Engine (contributed as an example) can be found in the forums [http://wiki.secondlife.com/wiki/User:Darien_Caldwell/HTTP-DNS here].
* A Dynamic DNS service running on Google App Engine (contributed as an example) can be found in the forums [http://wiki.secondlife.com/wiki/User:Darien_Caldwell/HTTP-DNS here].
* Yet another one, running on GAE, with password protected and private domains. http://wiki.secondlife.com/wiki/Public_Object_DNS
* Yet another one, running on GAE, with password protected and private domains. http://wiki.secondlife.com/wiki/Public_Object_DNS
* The [http://www.silverday.net/sqndns SilverDay ObjectDNS] is an easy to use dns-mapping-service with many configurable options (password protection, write protection, etc.) and an optional web-interface. The scripts are available here on the wiki (LSL-Script Library/[[Silverday ObjectDNS]]).
* The [http://www.silverday.net/sqndns SilverDay ObjectDNS] is an easy to use dns-mapping-service with many configurable options (password protection, write protection, etc.) and an optional web-interface. The scripts are available here on the wiki (LSL-Script Library/[[Silverday ObjectDNS]]).


== Resource Limitations ==
== Resource Limitations ==
* There are a limited number of URLs available in each region, split by land ownership exactly like prim limits.
* There are a limited number of URLs available in each [[region]], split by land ownership exactly like prim limits.
** Use [[llGetFreeURLs]] to get the exact number of available URLs for the script.
** Use [[llGetFreeURLs]] to get the exact number of available URLs for the script.
** The number of allowed URLs is the same as the number of allowed prims on the parcel the object is over.
** The number of allowed URLs is the same as the number of allowed [[prim|prims]] on the [[Land#Parcel|parcel]] the [[object]] is over.
**: ''Object owner does not matter, all objects over a parcel will use the resource pool for that parcel.''
**: ''Object owner does not matter, all objects over a [[Land#Parcel|parcel]] will use the resource pool for that [[Land#Parcel|parcel]].''
**: ''Like prims, all the parcels owned by the same owner and in the same region share the same pool of resources.''
**: ''Like [[prim|prims]], all the [[Land#Parcel|parcels]] owned by the same owner and in the same [[region]] share the same pool of resources.''
**: ''If you have two parcels in a region that each support 100 URLs, then you could use all 200 in object(s) on a single parcel.''
**: ''If you have two [[Land#Parcel|parcels]] in a [[region]] that each support 100 URLs, then you could use all 200 in object(s) on a single [[Land#Parcel|parcel]].''
** The region's object bonus factor does not apply to available URLs.
** The [[region]]'s [[object]] bonus factor does not apply to available URLs.
**: ''If a parcel has a max of 300 prims in a region with a 2x bonus factor there will only be 150 urls allowed.''
**: ''If a [[Land#Parcel|parcel]] has a max of 300 [[prim|prims]] in a [[region]] with a 2x bonus factor there will only be 150 urls allowed.''
* Each resident has their own unique pool of available URLs with a max of 38 URLs per resident.
* Each resident has their own unique pool of available URLs with a max of 38 URLs per resident.
** This is 1 per attachment point, but all 38 could be used by a single attachment for example.
** This is 1 per attachment point, but all 38 could be used by a single attachment for example.
* Vehicles are special and lazily moved to resident pools by the following logic:
* Vehicles are special and lazily moved to resident pools by the following logic:
** Any object that has a resident sitting on it is a 'vehicle'
** Any [[object]] that has a resident sitting on it is a 'vehicle'
** Vehicles will use the url resources from the parcel they are over until the cross a parcel border.
** Vehicles will use the url resources from the [[Land#Parcel|parcel]] they are over until the cross a [[Land#Parcel|parcel]] border.
**: ''Specifically this prevents anyone from breaking your vending machine by sitting on it and making it a 'vehicle'.''
**: ''Specifically this prevents anyone from breaking your vending machine by sitting on it and making it a 'vehicle'.''
** When any object using URL resources with a resident sitting on it crosses a parcel boundary the resources will switch to the first sitting resident with enough resources. If no sitting agents have enough resources then the resources from the parcel being moved onto will be used. If even then there are not enough resources to use then the vehicle will be blocked from moving.
** When any [[object]] using URL resources with a resident sitting on it crosses a [[Land#Parcel|parcel]] boundary the resources will switch to the first sitting resident with enough resources. If no sitting agents have enough resources then the resources from the [[Land#Parcel|parcel]] being moved onto will be used. If even then there are not enough resources to use then the vehicle will be blocked from moving.
**: ''In short we do everything we can to find a pool to host the resources needed by the vehicle, but will block movement if we can't.''
**: ''In short we do everything we can to find a pool to host the resources needed by the vehicle, but will block movement if we can't.''
* Parcel Sale: When a parcel is sold such that it changes the total available URLs in the region for either resident (seller or buyer) such that more URLs are being used than are available some objects will be returned.
* Parcel Sale: When a [[Land#Parcel|parcel]] is sold such that it changes the total available URLs in the [[region]] for either resident (seller or buyer) such that more URLs are being used than are available some objects will be returned.
** The objects returned will be from youngest object to oldest object of those using URLs in each category in order of object category: Temporary, Other, Group, Owner, Selected/Sat upon.
** The objects returned will be from youngest [[object]] to oldest [[object]] of those using URLs in each category in order of [[object]] category: Temporary, Other, Group, Owner, Selected/Sat upon.
**: ''The '''only''' time objects are possibly returned is when parcels change owner, and only if more resources are being used than allowed.''
**: ''The '''only''' time objects are possibly returned is when [[Land#Parcel|parcels]] change owner, and only if more resources are being used than allowed.''
**: ''We return youngest temporary objects before older temporary objects before younger 'other' (owned by non-group, non-parcel-owner) objects etc.''
**: ''We return youngest temporary objects before older temporary objects before younger 'other' (owned by non-group, non-[[Land#Parcel|parcel]]-owner) objects etc.''


== Other Limitations ==
== Other Limitations ==
Line 114: Line 118:
* Size of headers of requests will be limited to 255 bytes. This is per header, not total.
* Size of headers of requests will be limited to 255 bytes. This is per header, not total.
* The size of responses to requests is not currently limited, but this is subject to review during testing.
* The size of responses to requests is not currently limited, but this is subject to review during testing.
* The content type of the returned data is always 'text/plain; charset=utf-8'
* The content type of the returned data is always <code>"text/plain; charset=utf-8"</code>
*: ''Allowing more content type options is a possibility for the future, but not guaranteed.''
*: ''Allowing more content type options is a possibility for the future, but not guaranteed.''
* There is a cap of 64 in flight requests per script. This is based on the maximum number of pending events in LSL. After hitting the 64 request limit, the simulator cap server returns '503 Service Unavailable' to the inbound request.
* There is a cap of 64 in flight requests per script. This is based on the maximum number of pending events in LSL. After hitting the 64 request limit, the simulator cap server returns '503 Service Unavailable' to the inbound request.
* ''We may throttle the rate we accept hits at the CAP server level as well. This is possible, but has not yet been decided.''
* ''We may throttle the rate we accept hits at the CAP server level as well. This is possible, but has not yet been decided.''
* HTML can be used to in-client browser, including media on a prim, with some restrictions. See [[llSetContentType]]
* HTML can be used to in-client browser, including media on a prim, with some restrictions. See [[llSetContentType]]
* If making a parser, remember that you should probably restrict access to only Linden Lab HTML URLs as to not have your bandwith stolen.
* If making a parser, remember that you should probably restrict access to only Linden Lab HTML URLs as to not have your bandwith stolen.

Revision as of 07:02, 5 January 2014

Introduction

This is the counterpart to llHTTPRequest. While llHTTPRequest enables LSL scripts request data from HTTP-accessible sources, HTTP-in enables outside sources to request data from scripts in Second Life. The key difference is that llHTTPRequest exchanges data when the script in SL wants; HTTP-in allows outside sources to determine when they need to communicate with scripts in SL.

Prior to HTTP-in, similar functionality could be achieved by polling with llHTTPRequest, llEmail and XML-RPC. All three are cumbersome and the latter two have serious scalability bottlenecks.

It is important to note that LSL HTTP servers cannot use HTML except in very limited circumstances. See Other Limitations for details.

Uses

  • Easily get data from LSL scripts to outside viewers, scripts or servers.
    • Web front end for a visitor counter or other statistics accumulator.
  • Easily get data into LSL scripts from outside viewers, scripts or servers.
    • A store with a web front end that communicates to an in-world object to exchange L$ and inventory items.
    • Inworld game for which an external program handles the primary game logic that needs to manipulate inworld items.
  • HUD UI when used with llSetContentType. See HTML HUD Demo.

Gory Technical Details follow. Or jump straight to the Script Examples.

Script API

Request a new LSL Server public URL.
An http_request event will be triggered with success or failure and include the returned key
HTTP-in uses port 12046, and HTTPS-in uses port 12043.
NOTE: URL's are assigned to the script that called them, an http_request event will not be triggered in a script separate from the one that requested the URL.

<lsl>request_id = llRequestURL();</lsl>

Similar to llRequestURL except requests an HTTPS / SSL URL.
An http_request event will be triggered with success or failure and include the returned key

<lsl>request_id = llRequestSecureURL();</lsl>

Clear the specific URL, used for both secure and non-secure URLs.

<lsl>llReleaseURL("http://sim3015.aditi.lindenlab.com:12046/cap/3ff4f3f2-ea08-76c1-cef6-a22b4a573a7c");</lsl>

Event triggered when an URL is hit:
  • id is unique to this request
  • Supported methods are "GET", "POST", "PUT", "DELETE"
  • body: The body of the request.
Event also triggered with response to llRequestURL and llRequestSecureURL
Send body to the requester with status code status
  • id is the id from http_request that maps to the specific request
  • sending a response to the requestor will clear the request and delete information associated with it
Returns the string for the specified header in the specified request. All received headers are converted to lower case and this function is case-sensitive. The returned string is limited to 255 characters.
  • Supported headers are:
  • "x-script-url": The base url, as originally received from llRequestURL or llRequestSecureURL.
  • "x-path-info": Any trailing path information from the requested url
  • "x-query-string": Any query arguments, the text past a ? in the url
  • "x-remote-ip": IP address of the host that made the request
  • "user-agent": The user-agent header as reported by the requester
  • "x-secondlife-shard"
  • "x-secondlife-object-name"
  • "x-secondlife-object-key"
  • "x-secondlife-region"
  • "x-secondlife-local-position"
  • "x-secondlife-local-rotation"
  • "x-secondlife-local-velocity"
  • "x-secondlife-owner-name"
  • "x-secondlife-owner-key"

   requested url:  https://sim3015.aditi.lindenlab.com:12043/cap/a7717681-2c04-e4ac-35e3-1f01c9861322/foo/bar?arg=gra
   x-script-url:   https://sim3015.aditi.lindenlab.com:12043/cap/a7717681-2c04-e4ac-35e3-1f01c9861322
   x-path-info:    "/foo/bar"
   x-query-string: "arg=gra"

This header information is valid for 30 seconds, or until llHTTPResponse is called.
Returns the number of URLs available to this script.

URL Lifetime Limitations

  • URLs are temporary!
  • URLs will be lost in the following cases, all detectable by the script events listed with them.
    • On object derez/rez: on_rez
    • On script save/reset: default state_entry (trickier in multi-state scripts)
    • On region cross or TP(attachments): changed event, CHANGED_REGION and CHANGED_TELEPORT. Testing this have it has been found that teleports within a region DO NOT cause a URL to be lost, therefore, you do not need to request a new URL on CHANGED_TELEPORT, because CHANGED_REGION will handle a teleport to a different region. If you choose to request a URL after a teleport, it is recommended to release the old URL to be sure you don't have too many used. (Stone Tremont Aug 8th 2010)
    • On region restart: changed event, flag CHANGED_REGION_START
  • When urls are 'lost' it means that all public urls for that script are gone, new ones will need to be requested and the new urls will not resemble the old ones.
  • Maintaining persistent URLs will require building or using an external service similar to how Dynamic DNS services work for tying domain names to dynamic IP addresses.

Contributed HTTP-in URL mapping implementations and services:

  • A Dynamic DNS service running on Google App Engine (contributed as an example) can be found in the forums here.
  • Yet another one, running on GAE, with password protected and private domains. http://wiki.secondlife.com/wiki/Public_Object_DNS
  • The SilverDay ObjectDNS is an easy to use dns-mapping-service with many configurable options (password protection, write protection, etc.) and an optional web-interface. The scripts are available here on the wiki (LSL-Script Library/Silverday ObjectDNS).

Resource Limitations

  • There are a limited number of URLs available in each region, split by land ownership exactly like prim limits.
    • Use llGetFreeURLs to get the exact number of available URLs for the script.
    • The number of allowed URLs is the same as the number of allowed prims on the parcel the object is over.
      Object owner does not matter, all objects over a parcel will use the resource pool for that parcel.
      Like prims, all the parcels owned by the same owner and in the same region share the same pool of resources.
      If you have two parcels in a region that each support 100 URLs, then you could use all 200 in object(s) on a single parcel.
    • The region's object bonus factor does not apply to available URLs.
      If a parcel has a max of 300 prims in a region with a 2x bonus factor there will only be 150 urls allowed.
  • Each resident has their own unique pool of available URLs with a max of 38 URLs per resident.
    • This is 1 per attachment point, but all 38 could be used by a single attachment for example.
  • Vehicles are special and lazily moved to resident pools by the following logic:
    • Any object that has a resident sitting on it is a 'vehicle'
    • Vehicles will use the url resources from the parcel they are over until the cross a parcel border.
      Specifically this prevents anyone from breaking your vending machine by sitting on it and making it a 'vehicle'.
    • When any object using URL resources with a resident sitting on it crosses a parcel boundary the resources will switch to the first sitting resident with enough resources. If no sitting agents have enough resources then the resources from the parcel being moved onto will be used. If even then there are not enough resources to use then the vehicle will be blocked from moving.
      In short we do everything we can to find a pool to host the resources needed by the vehicle, but will block movement if we can't.
  • Parcel Sale: When a parcel is sold such that it changes the total available URLs in the region for either resident (seller or buyer) such that more URLs are being used than are available some objects will be returned.
    • The objects returned will be from youngest object to oldest object of those using URLs in each category in order of object category: Temporary, Other, Group, Owner, Selected/Sat upon.
      The only time objects are possibly returned is when parcels change owner, and only if more resources are being used than allowed.
      We return youngest temporary objects before older temporary objects before younger 'other' (owned by non-group, non-parcel-owner) objects etc.

Other Limitations

  • Size of the body of the requests will be limited to 2k bytes.
  • Size of headers of requests will be limited to 255 bytes. This is per header, not total.
  • The size of responses to requests is not currently limited, but this is subject to review during testing.
  • The content type of the returned data is always "text/plain; charset=utf-8"
    Allowing more content type options is a possibility for the future, but not guaranteed.
  • There is a cap of 64 in flight requests per script. This is based on the maximum number of pending events in LSL. After hitting the 64 request limit, the simulator cap server returns '503 Service Unavailable' to the inbound request.
  • We may throttle the rate we accept hits at the CAP server level as well. This is possible, but has not yet been decided.
  • HTML can be used to in-client browser, including media on a prim, with some restrictions. See llSetContentType
  • If making a parser, remember that you should probably restrict access to only Linden Lab HTML URLs as to not have your bandwith stolen.
  • It is important to note that when appending a query string to a cap URL there MUST be a trailing slash between the cap guid and the query string token '?'. IE https://sim123.agni.lindenlab.com/cap/f73b4b94-012d-44f2-bd0c-16c328321221?arg=gra will return an HTTP 500, but https://sim123.agni.lindenlab.com/cap/f73b4b94-012d-44f2-bd0c-16c328321221/?arg=gra will succeed. (This doesn't seem to be true.) (I have confirmed: the slash is required when appending a query sting using the '?' token. --Stone Tremont)

Links