Difference between revisions of "LlHTTPResponse"

From Second Life Wiki
Jump to navigation Jump to search
m (added link to http status code list)
m
Line 4: Line 4:
|func=llHTTPResponse
|func=llHTTPResponse
|p1_type=key|p1_name=request_id|p1_desc=A valid HTTP request key.
|p1_type=key|p1_name=request_id|p1_desc=A valid HTTP request key.
|p2_type=integer|p2_name=status|p2_desc=[http://en.wikipedia.org/wiki/List_of_HTTP_status_codes HTTP Status] (200, 400, 404, etc)
|p2_type=integer|p2_name=status|p2_desc={{Wikipedia|List_of_HTTP_status_codes|HTTP Status}} (200, 400, 404, etc)|p2_hover=HTTP Status (200, 400, 404, etc)
|p3_type=string|p3_name=body|p3_desc=Contents of the response.
|p3_type=string|p3_name=body|p3_desc=Contents of the response.
|func_footnote=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).
|func_footnote=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).

Revision as of 21:29, 8 December 2012

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 "Wikipedia logo"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

See Also

Events

•  http_request

Functions

•  llGetFreeURLs
•  llRequestURL
•  llRequestSecureURL
•  llReleaseURL
•  llGetHTTPHeader
•  llSetContentType

Articles

•  LSL http server

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 );