Monday, November 08, 2010 at 12:03 AM.

on includeHttp (url) {
	<<12/29/2000; 12:08:23 PM by DW
		<<You provide an http url, we'll get the contents and include it in your Manila page. As usual we cache the request for one hour. Maximum size that we'll return is 32K, so it's only good for relatively small snippets.
		<<We do not neuter curly braces in the text received through HTTP. If you call this script from another script that is then processed beware, you should neuter the text first, otherwise you could open a security hole. We felt it was important to not neuter the text because other languages, notably JavaScript, use curly braces in their syntax, and that's a totally legitimate use for this macro.
	local (maxsize = 32767);
	if not defined (user.webbrowser.cache) {
		new (tabletype, @user.webbrowser.cache)};
	local (adrincache = @user.webbrowser.cache.[url], flread = true);
	if defined (adrincache^) {
		if () <= adrincache^.timeExpires {
			flread = false}}
	else {
		new (tabletype, adrincache);
		adrincache^.ctReads = 0;
		adrincache^.ctHits = 0};
	if flread {
		try {
			local (pta = html.getpagetableaddress ());
			local (urllist = string.urlSplit (url), server = urllist [2], path = urllist [3]);
			local (headers); new (tabletype, @headers); headers.referer = pta^.url;
			local (s = string.httpResultSplit (tcp.httpClient (server:server, path:path, timeOutTicks:60*30, flmessages:false, ctFollowRedirects:5, adrHdrTable:@headers)));
			html.setpagetableaddress (pta);
			if sizeof (s) > maxsize {
				scriptError ("Can't include because the file is larger than " + maxsize + " characters.")};
			adrincache^.text = s}
		else {
			adrincache^.text = "<b>[</b>Macro error: " + tryError +"<b>]</b>"};
		adrincache^.timeExpires = () + (60 * 60)};
	return (adrincache^.text)}

This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.