Index: include/db.h
===================================================================
--- include/db.h	(revision 8670)
+++ include/db.h	(working copy)
@@ -481,6 +481,7 @@
 	int		no;
 	char		*name;
 	char		url[MAX_STRING_LEN];	/* excessive length is required to support macros */
+	int		follow;
 	int		timeout;
 	char		posts[MAX_STRING_LEN];
 	char		required[HTTPSTEP_REQUIRED_LEN_MAX];
Index: src/zabbix_server/httppoller/httptest.c
===================================================================
--- src/zabbix_server/httppoller/httptest.c	(revision 8670)
+++ src/zabbix_server/httppoller/httptest.c	(working copy)
@@ -301,13 +301,6 @@
 		(void)curl_easy_cleanup(easyhandle);
 		return;
 	}
-	if(CURLE_OK != (err = curl_easy_setopt(easyhandle, CURLOPT_FOLLOWLOCATION, 1)))
-	{
-		zabbix_log(LOG_LEVEL_ERR, "Cannot set CURLOPT_FOLLOWLOCATION [%s]",
-			curl_easy_strerror(err));
-		(void)curl_easy_cleanup(easyhandle);
-		return;
-	}
 	if(CURLE_OK != (err = curl_easy_setopt(easyhandle,CURLOPT_WRITEFUNCTION ,WRITEFUNCTION2)))
 	{
 		zabbix_log(LOG_LEVEL_ERR, "Cannot set CURLOPT_WRITEFUNCTION [%s]",
@@ -342,7 +335,7 @@
 
 	lastfailedstep=0;
 	httptest->time = 0;
-	result = DBselect("select httpstepid,httptestid,no,name,url,timeout,posts,required,status_codes from httpstep where httptestid=" ZBX_FS_UI64 " order by no",
+	result = DBselect("select httpstepid,httptestid,no,name,url,timeout,posts,required,status_codes,follow from httpstep where httptestid=" ZBX_FS_UI64 " order by no",
 		httptest->httptestid);
 	now=time(NULL);
 	while((row=DBfetch(result)) && !err_str)
@@ -359,6 +352,7 @@
 		strscpy(httpstep.posts,row[6]);
 		strscpy(httpstep.required,row[7]);
 		strscpy(httpstep.status_codes,row[8]);
+		httpstep.follow=atoi(row[9]);
 
 		DBexecute("update httptest set curstep=%d,curstate=%d where httptestid=" ZBX_FS_UI64,
 			httpstep.no,
@@ -440,9 +434,17 @@
 				lastfailedstep = httpstep.no;
 			}
 		}
-
 		if( !err_str )
 		{
+			if(CURLE_OK != (err = curl_easy_setopt(easyhandle, CURLOPT_FOLLOWLOCATION, httpstep.follow)))
+			{
+				zabbix_log(LOG_LEVEL_ERR, "Cannot set CURLOPT_FOLLOWLOCATION [%s]", curl_easy_strerror(err));
+				err_str = strdup(curl_easy_strerror(err));
+				lastfailedstep = httpstep.no;
+			}
+		}
+		if( !err_str )
+		{
 			memset(&page, 0, sizeof(page));
 			if(CURLE_OK != (err = curl_easy_perform(easyhandle)))
 			{
Index: frontends/php/include/locales/en_gb.inc.php
===================================================================
--- frontends/php/include/locales/en_gb.inc.php	(revision 8670)
+++ frontends/php/include/locales/en_gb.inc.php	(working copy)
@@ -147,6 +147,7 @@
 	'S_VARIABLES'=>					'Variables',
 	'S_STEP'=>					'Step',
 	'S_STEPS'=>					'Steps',
+	'S_FOLLOW_REDIRECTS'=>				'Follow redirects',
 	'S_TIMEOUT'=>					'Timeout',
 	'S_POST'=>					'Post',
 	'S_REQUIRED'=>					'Required',
Index: frontends/php/include/forms.inc.php
===================================================================
--- frontends/php/include/forms.inc.php	(revision 8670)
+++ frontends/php/include/forms.inc.php	(working copy)
@@ -359,6 +359,7 @@
 		$name = get_request('name', '');
 		$url = get_request('url', '');
 		$posts = get_request('posts', '');
+		$follow_redirects = get_request('follow_redirects', 1);
 		$timeout = get_request('timeout', 15);
 		$required = get_request('required', '');
 		$status_codes = get_request('status_codes', '');
@@ -366,6 +367,7 @@
 		$form->addRow(S_NAME, new CTextBox('name', $name, 50));
 		$form->addRow(S_URL, new CTextBox('url', $url, 80));
 		$form->addRow(S_POST, new CTextArea('posts', $posts, 50, 10));
+		$form->addRow(S_FOLLOW_REDIRECTS, new CCheckBox('follow_redirects', $follow_redirects, 1, $value=1));
 		$form->addRow(S_TIMEOUT, new CNumericBox('timeout', $timeout, 5));
 		$form->addRow(S_REQUIRED, new CTextBox('required', $required, 80));
 		$form->addRow(S_STATUS_CODES, new CTextBox('status_codes', $status_codes, 80));
@@ -511,6 +513,7 @@
 		foreach($steps as $stepid => $s){
 			if(!isset($s['name']))		$s['name'] = '';
 			if(!isset($s['timeout']))	$s['timeout'] = 15;
+			if(!isset($s['follow_redirects']))	$s['follow_redirects'] = 0;
 			if(!isset($s['url']))		$s['url'] = '';
 			if(!isset($s['posts']))		$s['posts'] = '';
 			if(!isset($s['required']))	$s['required'] = '';
@@ -532,6 +535,7 @@
 				'&list_name=steps&stepid='.$stepid.
 				url_param($s['name'],false,'name').
 				url_param($s['timeout'],false,'timeout').
+				url_param($s['follow_redirects'],false,'follow_redirects').
 				url_param($s['url'],false,'url').
 				url_param($s['posts'],false,'posts').
 				url_param($s['required'],false,'required').
Index: frontends/php/include/httptest.inc.php
===================================================================
--- frontends/php/include/httptest.inc.php	(revision 8670)
+++ frontends/php/include/httptest.inc.php	(working copy)
@@ -44,7 +44,7 @@
 		return $status;
 	}
 
-	function db_save_step($hostid, $applicationid, $httptestid, $testname, $name, $no, $timeout, $url, $posts, $required, $status_codes, $delay, $history, $trends){
+	function db_save_step($hostid, $applicationid, $httptestid, $testname, $name, $no, $timeout, $follow, $url, $posts, $required, $status_codes, $delay, $history, $trends){
 		if($no <= 0){
 			error(S_SCENARIO_STEP_NUMBER_CANNOT_BE_LESS_ONE);
 			return false;
@@ -61,9 +61,9 @@
 			$httpstepid = get_dbid("httpstep","httpstepid");
 
 			if (!DBexecute('insert into httpstep'.
-				' (httpstepid, httptestid, name, no, url, timeout, posts, required, status_codes) '.
+				' (httpstepid, httptestid, name, no, url, timeout, follow, posts, required, status_codes) '.
 				' values ('.$httpstepid.','.$httptestid.','.zbx_dbstr($name).','.$no.','.
-				zbx_dbstr($url).','.$timeout.','.
+				zbx_dbstr($url).','.$timeout.','. $follow.','.
 				zbx_dbstr($posts).','.zbx_dbstr($required).','.zbx_dbstr($status_codes).')'
 				)) return false;
 		}
@@ -71,7 +71,7 @@
 			$httpstepid = $httpstep_data['httpstepid'];
 
 			if (!DBexecute('update httpstep set '.
-				' name='.zbx_dbstr($name).', no='.$no.', url='.zbx_dbstr($url).', timeout='.$timeout.','.
+				' name='.zbx_dbstr($name).', no='.$no.', url='.zbx_dbstr($url).', timeout='.$timeout.', follow='.$follow.','.
 				' posts='.zbx_dbstr($posts).', required='.zbx_dbstr($required).', status_codes='.zbx_dbstr($status_codes).
 				' where httpstepid='.$httpstepid)) return false;
 		}
@@ -259,12 +259,13 @@
 			foreach($steps as $sid => $s){
 				if(!isset($s['name']))		$s['name'] = '';
 				if(!isset($s['timeout']))	$s['timeout'] = 15;
+				if(!isset($s['follow_redirects']))	$s['follow_redirects'] = 0;
 				if(!isset($s['url']))		$s['url'] = '';
 				if(!isset($s['posts']))		$s['posts'] = '';
 				if(!isset($s['required']))	$s['required'] = '';
 				if(!isset($s['status_codes']))	$s['status_codes'] = '';
 
-				$result = db_save_step($hostid, $applicationid, $httptestid, $name, $s['name'], $sid+1, $s['timeout'], 
+				$result = db_save_step($hostid, $applicationid, $httptestid, $name, $s['name'], $sid+1, $s['timeout'], $s['follow_redirects'], 
 					$s['url'], $s['posts'], $s['required'],$s['status_codes'], $delay, $history, $trends);
 
 				if(!$result){
Index: frontends/php/popup_httpstep.php
===================================================================
--- frontends/php/popup_httpstep.php	(revision 8670)
+++ frontends/php/popup_httpstep.php	(working copy)
@@ -44,6 +44,7 @@
 		'name'=>	array(T_ZBX_STR, O_OPT,  null,	NOT_EMPTY.KEY_PARAM(),'isset({save})'),
 		'url'=>		array(T_ZBX_STR, O_OPT,  null,	NOT_EMPTY,		'isset({save})'),
 		'posts'=>	array(T_ZBX_STR, O_OPT,  null,	null,			'isset({save})'),
+		'follow_redirects'=>	array(T_ZBX_INT, O_OPT,  null,  IN('0,1') , null),
 		'timeout'=>	array(T_ZBX_INT, O_OPT,  null,	BETWEEN(0,65535),	'isset({save})'),
 		'required'=>	array(T_ZBX_STR, O_OPT,  null,	null,			'isset({save})'),
 		'status_codes'=>array(T_ZBX_INT_RANGE, O_OPT,  null,	null,		'isset({save})'),
@@ -78,7 +79,7 @@
 <script language="JavaScript" type="text/javascript">
 <!--
 
-function add_httpstep(formname,name,timeout,url,posts,required,status_codes){
+function add_httpstep(formname,name,timeout,follow,url,posts,required,status_codes){
         var form = window.opener.document.forms[formname];
 
         if(!form){
@@ -88,6 +89,7 @@
 
 	add_var_to_opener_obj(form,'new_httpstep[name]',name);
 	add_var_to_opener_obj(form,'new_httpstep[timeout]',timeout);
+	add_var_to_opener_obj(form,'new_httpstep[follow_redirects]',follow);
 	add_var_to_opener_obj(form,'new_httpstep[url]',url);
 	add_var_to_opener_obj(form,'new_httpstep[posts]',posts);
 	add_var_to_opener_obj(form,'new_httpstep[required]',required);
@@ -103,6 +105,7 @@
 			zbx_jsvalue($_REQUEST['dstfrm']).','.
 			zbx_jsvalue($_REQUEST['name']).','.
 			zbx_jsvalue($_REQUEST['timeout']).','.
+			zbx_jsvalue(get_request('follow_redirects', 0)).','.
 			zbx_jsvalue($_REQUEST['url']).','.
 			zbx_jsvalue($_REQUEST['posts']).','.
 			zbx_jsvalue($_REQUEST['required']).','.
@@ -118,7 +121,7 @@
 <script language="JavaScript" type="text/javascript">
 <!--
 
-function update_httpstep(formname,list_name,stepid,name,timeout,url,posts,required,status_codes){
+function update_httpstep(formname,list_name,stepid,name,timeout,follow,url,posts,required,status_codes){
 	var form = window.opener.document.forms[formname];
 
 	if(!form){
@@ -128,6 +131,7 @@
 
 	add_var_to_opener_obj(form,list_name + '[' + stepid + '][name]',name);
 	add_var_to_opener_obj(form,list_name + '[' + stepid + '][timeout]',timeout);
+	add_var_to_opener_obj(form,list_name + '[' + stepid + '][follow_redirects]',follow);
 	add_var_to_opener_obj(form,list_name + '[' + stepid + '][url]',url);
 	add_var_to_opener_obj(form,list_name + '[' + stepid + '][posts]',posts);
 	add_var_to_opener_obj(form,list_name + '[' + stepid + '][required]',required);
@@ -146,6 +150,7 @@
 			zbx_jsvalue($_REQUEST['stepid']).','.
 			zbx_jsvalue($_REQUEST['name']).','.
 			zbx_jsvalue($_REQUEST['timeout']).','.
+			zbx_jsvalue(get_request('follow_redirects', 0)).','.
 			zbx_jsvalue($_REQUEST['url']).','.
 			zbx_jsvalue($_REQUEST['posts']).','.
 			zbx_jsvalue($_REQUEST['required']).','.
