Lasso Soft Inc. > Home

[request_params]

Linkrequest_params
AuthorJason Huck
CategoryClient
Version8.x
Licensehttp://opensource.org/licenses/artistic-license.php
Posted01 Jun 2006
Updated01 Jun 2006
More by this author...

Description

Returns a map of items in the client request header.

Sample Usage

request_params->find('Host');

-> 'www.omnipilot.com'

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.

define_tag(
	'params',
	-namespace='request_',
	-priority='replace',
	-description='Returns a map of the items in the request header.'
);
	local('in') = client_headers;
	#in->replace('\r\n','\r')&replace('\n','\r');
	#in = #in->split('\r');
	
	local('out' = map);
	
	iterate(#in, local('i'));
		local('name') = #i->split(':')->first;
		local('value') = #i->removeleading(#name + ':')&trim&;
		#out->insert(#name = #value);
	/iterate;

	return(@#out);
/define_tag;

Related Tags

Comments

01 Jun 2006, Johan Solve

To use with IIS...

Note that when running under IIS, all header fields seem to be prefixexd by HTTP_ .
The usage example would in that case need to be
request_params->find('HTTP_Host');

Unless the tag is updated for example like this (a bit blunt though):
local('value') = #i->removeleading(#name + ':')&trim&;
#value->removeleading('HTTP_');
#out->insert(#name = #value);

Please log in to comment

Subscribe to the LassoTalk mail list

LassoSoft Inc. > Home

 

 

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