Difference between revisions of "Http response"

From Second Life Wiki
Jump to navigation Jump to search
(added explanation for status 499)
(we don't use the LSLG template anymore)
Line 1: Line 1:
{{LSL_Event|event_id=32|event_delay|event=http_response
{{LSL_Event|event_id=32|event_delay|event=http_response
|p1_type=key|p1_name=request_id|p1_desc=Matches return from {{LSLG|llHTTPRequest}}
|p1_type=key|p1_name=request_id|p1_desc=Matches return from [[llHTTPRequest]]
|p2_type=integer|p2_name=status|p2_desc=HTTP code (like 404 or 200)
|p2_type=integer|p2_name=status|p2_desc=HTTP code (like 404 or 200)
|p3_type=list|p3_name=metadata|p3_desc=List of HTTP_* constants and attributes
|p3_type=list|p3_name=metadata|p3_desc=List of HTTP_* constants and attributes
|p4_type=string|p4_name=body|p4_desc
|p4_type=string|p4_name=body|p4_desc
|event_desc=Triggered when task receives a response to one of its {{LSLG|llHTTPRequest}}<nowiki>s</nowiki>
|event_desc=Triggered when task receives a response to one of its [[llHTTPRequest]]<nowiki>s</nowiki>
|constants={{{!}}{{Prettytable}}
|constants={{{!}}{{Prettytable}}
{{!}}-{{Hl2}}
{{!}}-{{Hl2}}
Line 38: Line 38:
|also_header
|also_header
|also_events
|also_events
|also_functions=*{{LSLG|llHTTPRequest}}
|also_functions={{LSL DefineRow||[[llHTTPRequest]]}}
|also_articles
|also_articles
|also_footer
|also_footer
|notes=If for some reason while using {{LSLG|llHTTPRequest}}/http_response you are unable to parse a known good RSS feed or some other form of web contents, you will need to work around it outside of SecondLife. This is unlikely to change in the near future since checking the headers requires more overhead at the simulator level.
|notes=If for some reason while using [[llHTTPRequest]]/http_response you are unable to parse a known good RSS feed or some other form of web contents, you will need to work around it outside of SecondLife. This is unlikely to change in the near future since checking the headers requires more overhead at the simulator level.


Status 499 is never returned by a website in response to an {{LSLG|llHTTPRequest}} call.  This status indicates that the request timed out and the sim closed the connection before any response was received.
Status 499 is never returned by a website in response to an [[llHTTPRequest]] call.  This status indicates that the request timed out and the sim closed the connection before any response was received.
|mode
|mode
|deprecated
|deprecated

Revision as of 22:02, 2 September 2007

Description

Event: http_response( key request_id, integer status, list metadata, string body ){ ; }

Triggered when task receives a response to one of its llHTTPRequests

• key request_id Matches return from llHTTPRequest
• integer status HTTP code (like 404 or 200)
• list metadata List of HTTP_* constants and attributes
• string body
Constant Type Description
HTTP_BODY_TRUNCATED 0 integer Truncation point in bytes

Caveats


Examples

key http_request_id;

default
{
    state_entry()
    {
        http_request_id = llHTTPRequest("url", [], "");
    }

    http_response(key request_id, integer status, list metadata, string body)
    {
        if (request_id == http_request_id)
        {
            llSetText(body, <0,0,1>, 1);
        }
    }
}

Notes

If for some reason while using llHTTPRequest/http_response you are unable to parse a known good RSS feed or some other form of web contents, you will need to work around it outside of SecondLife. This is unlikely to change in the near future since checking the headers requires more overhead at the simulator level.

Status 499 is never returned by a website in response to an llHTTPRequest call. This status indicates that the request timed out and the sim closed the connection before any response was received.

See Also

Functions

•  llHTTPRequest

Deep Notes

Signature

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