Lasso Soft Inc. > Home

[client_host]

Linkclient_host
AuthorJohan Solve
CategoryClient
Version6.x
LicensePublic Domain
Posted15 Feb 2006
Updated06 Sep 2006
More by this author...

Description

This tag returns the host name from the visitor's request header. Useful for example to implement virtual hosts functionality in Lasso.

Sample Usage

[client_host]

Source Code

Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.

 (replace: '\r\n', '\r');
	#requestheader -> (replace: '\n', '\r');
	#requestheader	= #requestheader -> (split: '\r');
	iterate: #requestheader, (local: 'headerfield');
		if: #headerfield -> (beginswith: 'Host:');
			#output=#headerfield;
			#output -> (removeleading: 'Host:');
			#output -> trim;
			loop_abort;
		else: #headerfield -> (beginswith: 'HTTP_Host:');
			// try to find header field modified by IIS (all fields are prefixexd by HTTP_)
			#output=#headerfield;
			#output -> (removeleading: 'HTTP_Host:');
			#output -> trim;
			loop_abort;
		/if;
	/iterate;
	return: #output;
/define_tag;

?>

Related Tags

Comments

No comments

Please log in to comment

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2014 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft