Added a diagram to the README showing the connections between different parts of the prim-dns server environment
24 lines
1.2 KiB
Plaintext
24 lines
1.2 KiB
Plaintext
string jsonrpc_notification(string method, string params_type, list params)
|
|
{
|
|
return llList2Json(JSON_OBJECT, ["jsonrpc", "2.0", "method", method, "params", llList2Json(params_type, params)]);
|
|
}
|
|
|
|
default
|
|
{
|
|
link_message(integer sender, integer num, string str, key id)
|
|
{
|
|
string jsonrpc_method = llJsonGetValue(str, ["method"]);
|
|
|
|
if (jsonrpc_method == "prim-dns:request")
|
|
{
|
|
key request_id = (key) llJsonGetValue(str, ["params", "request-id"]);
|
|
string method = llJsonGetValue(str, ["params", "method"]);
|
|
string headers = llJsonGetValue(str, ["params", "headers"]);
|
|
string body = llJsonGetValue(str, ["params", "body"]);
|
|
|
|
llMessageLinked(sender, 0, jsonrpc_notification("prim-dns:set-content-type", JSON_OBJECT, ["request-id", request_id, "content-type", CONTENT_TYPE_XHTML]), NULL_KEY);
|
|
llMessageLinked(sender, 0, jsonrpc_notification("prim-dns:response", JSON_OBJECT, ["request-id", request_id, "status", 200, "body", "<html xmlns=\"http://www.w3.org/1999/xhtml\"><body style=\"background-color: black; color: green; font-family: monospace;\"><b>Hello, world!</b></body></html>"]), NULL_KEY);
|
|
}
|
|
}
|
|
}
|