// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Extract a simple HTTPS host // Not compiled or tested in-world // Setup: Edit URL and touch as owner. // Stop / restore: Remove or disable. This example only calculates and reports to the owner. // Notes: Accepts a hostname with optional numeric port, but not IPv6 literals, userinfo, or arbitrary schemes. Parsing is not destination validation and makes no request. // License: see LICENSE in this distribution. // Original Incoprea example. MIT. string URL="https://example.org:443/library?q=lamp"; default { touch_start(integer count) { if(llDetectedKey(0)!=llGetOwner()) return; if(llSubStringIndex(llToLower(URL),"https://")!=0) { llOwnerSay("HTTPS URL required."); return; } string rest=llGetSubString(URL,8,-1); list parts=llParseStringKeepNulls(rest,["/","?","#"],[]); string authority=llList2String(parts,0); if(authority=="" || llSubStringIndex(authority,"@")!=-1 || llSubStringIndex(authority,"[")!=-1 || llSubStringIndex(authority," ")!=-1) { llOwnerSay("Unsupported or empty authority."); return; } list hostport=llParseStringKeepNulls(authority,[":"],[]); if(llGetListLength(hostport)>2) { llOwnerSay("Unsupported authority."); return; } string host=llToLower(llList2String(hostport,0)); if(host=="") { llOwnerSay("Empty hostname."); return; } if(llGetListLength(hostport)==2) { string port=llList2String(hostport,1); integer j; if(port=="" || llStringLength(port)>5) { llOwnerSay("Invalid port."); return; } for(j=0;j65535) { llOwnerSay("Port out of range."); return; } } llOwnerSay("Host: "+host); } changed(integer flags) { if(flags & CHANGED_OWNER) llResetScript(); } }