Difference between revisions of "LlHTTPResponse"

From Second Life Wiki
Jump to: navigation, search
m
m (added reference to CONTENT_TYPE_* constants in also_constants)
Line 69: Line 69:
 
</lsl>
 
</lsl>
 
|helpers
 
|helpers
 +
|also_constants=
 +
{{LSL DefineRow|1=|2={{LSL Const|CONTENT_TYPE_TEXT}}|3={{#var:comment}}}}
 +
{{LSL DefineRow|1=|2={{LSL Const|CONTENT_TYPE_HTML}}|3={{#var:comment}}}}
 +
{{LSL DefineRow|1=|2={{LSL Const|CONTENT_TYPE_XML}}|3={{#var:comment}}}}
 +
{{LSL DefineRow|1=|2={{LSL Const|CONTENT_TYPE_XHTML}}|3={{#var:comment}}}}
 +
{{LSL DefineRow|1=|2={{LSL Const|CONTENT_TYPE_ATOM}}|3={{#var:comment}}}}
 +
{{LSL DefineRow|1=|2={{LSL Const|CONTENT_TYPE_JSON}}|3={{#var:comment}}}}
 +
{{LSL DefineRow|1=|2={{LSL Const|CONTENT_TYPE_LLSD}}|3={{#var:comment}}}}
 +
{{LSL DefineRow|1=|2={{LSL Const|CONTENT_TYPE_FORM}}|3={{#var:comment}}}}
 +
{{LSL DefineRow|1=|2={{LSL Const|CONTENT_TYPE_RSS}}|3={{#var:comment}}}}
 
|also_functions=
 
|also_functions=
 
{{LSL DefineRow||[[llGetFreeURLs]]}}
 
{{LSL DefineRow||[[llGetFreeURLs]]}}

Revision as of 07:01, 1 January 2014

Summary

Function: llHTTPResponse( key request_id, integer status, string body );

Responds to request_id with status and body.

• key request_id A valid HTTP request key.
• integer status HTTP Status (200, 400, 404, etc)
• string body Contents of the response.

The response need not be made inside the http_request event but if it does not happen in a timely fashion the request will time out (within 25 seconds).

Caveats

  • This call must be made by the script containing the http_request event where the request_id was received.
  • There is no limit, other than script size, to the amount of data that can be sent by this function.
    • llHTTPRequest can truncate the response length in receiving scripts. Be aware when using them together for prim-to-prim communications.
  • Returns 'content-type: text/plain' by default. Use llSetContentType to optionally return 'text/html' if being viewed by the object owner within a Second Life client.
All Issues ~ Search JIRA for related Bugs

Examples

<lsl> string url;

default {

   changed(integer change)
   {
if (change & (CHANGED_REGION_START

Deep Notes

History

All Issues

~ Search JIRA for related Issues
   llHTTPImageResponse() - function for sending image data as a response to an HTTP request

Signature

function void llHTTPResponse( key request_id, integer status, string body );