[request_params]

Description

Link: [request_params]
Author: Jason Huck
Category: Client
Version: 8.x
License:
Posted: Jun. 01, 2006
Updated: Jan. 01, 0001
More by this author...
Returns a map of items in the client request header.

Parameters

none


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.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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

06/01/2006, Johan Sölve
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);
Email:


Password:



Newest

Most Popular