//place this in global.h 
  
int HttpRetCode; 
int i=0; 
char depthVal[10]; 
char cTransactName[20000]; 
  
recursiveRedirect_open() 

    web_set_max_html_param_len("10000"); 
  
    web_reg_save_param("cRedirectUrl", 
                "LB=Location: ", 
                "RB=\r\n", 
                "notfound=warning", 
                "Search=Headers", 
                LAST); 
  
    web_reg_save_param("cTransactionName", 
                "LB=https://Domain.com/", 
                "RB=\r\n", 
                "Search=Headers", 
                "notfound=warning", 
                LAST); 
  
    web_reg_save_param("httpCode", 
                "LB=HTTP/1.1 ", 
                "RB= ", 
                "Search=Headers", 
                "ORD=1", 
                "notfound=warning", 
                LAST); 

  
recursiveRedirect_close() 

  
    HttpRetCode = atoi(lr_eval_string("{httpCode}")); 
    lr_output_message("xReturnCode=%d",  HttpRetCode); 
  
    if(HttpRetCode == 302)//If redirect 
    { 
        i++; 
        web_reg_save_param("cRedirectUrl", 
                "LB=Location: ", 
                "RB=\r\n", 
                "Search=Headers", 
                "notfound=warning", 
                LAST); 
  
        web_reg_save_param("cTransactionName", 
                "LB=https://https://Domain.com/", 
                "RB=\r\n", 
                "Search=Headers", 
                "notfound=warning", 
                LAST); 
  
        web_reg_save_param("httpCode", 
               "LB=HTTP/1.1 ", 
               "RB= ", 
               "ORD=1", 
               "notfound=warning", 
               LAST); 
  
sprintf(cTransactName, "Redirect_depth_%d_%s", i,lr_eval_string("{cTransactionName}")); 
lr_start_transaction(cTransactName); 
web_url(cTransactName, "URL={cRedirectUrl}", "Mode=HTTP", LAST); 
lr_end_transaction(cTransactName, LR_AUTO); 
HttpRetCode = web_get_int_property(HTTP_INFO_RETURN_CODE); 
recursiveRedirect_close(); 
  

else

    return; 
}
//In your action file
Place this in the beginning of the action file
 
web_set_option("MaxRedirectionDepth", "0", LAST ); //This is the key
 
recursiveRedirect_open();
web_url("url_which_gets_redirected","http://sampleredirect.com/",LAST);
recursiveRedirect_close();

深圳湖北籍软件测试群 275212937

loadrunner处理HTTP重定向请求的更多相关文章

  1. Java Servlet(九):转发请求与重定向请求区别

    转发: <% pageContext.setAttribute("pageContextAttr", "pageContextAttribute"); r ...

  2. Loadrunner模拟JSON接口请求进行测试

    Loadrunner模拟JSON接口请求进行测试     一.loadrunner脚本创建 1.Insert - New step -选择Custom Request -  web_custom_re ...

  3. LoadRunner之自定义HTTP请求

    LoadRunner之自定义HTTP请求 性能测试开发脚本时使用的都是同样的模式.对在性能测试规划时指定的典型业务逻辑场景进行录制,形成基本的脚本骨架. 录制脚本后需要对脚本进行编辑,以满足性能测试需 ...

  4. LoadRunner:关联HTTP请求

    LoadRunner:关联HTTP请求 本例通过一个使用HTTP/HTML协议发送.获取服务器数据的vuser脚本,分析LoadRunner如何进行HTTP关联. 下面这个例子包括两个事务:上传数据到 ...

  5. 细说Redirect重定向请求(情节分享)

         前些日子在开发公司项目接口的时候,由于需要与第三方平台对接,由于接口之前的层层封装,不断的需要转发,把人差点搞糊涂了.本来以为之前对Redirect的认识足够清楚,可是到实际开发之前我还是没 ...

  6. Spring 梳理-跨重定向请求传递数据-Flash

    Spring MVC Flash Attribute 的讲解与使用示例 1. Spring MVC 3.1版本加了一个很有用的特性,Flash属性,它能解决一个长久以来缺少解决的问题,一个POST/R ...

  7. 03 重定向,请求转发,cookie,session

    重定向: /* 之前的写法 response.setStatus(302); response.setHeader("Location", "login_success. ...

  8. springmvc重定向请求。

    SpringMVC重定向传参数的实现(来自网友) 验证了我说的,从model层中拿来的数据,不管什么类型,都是通过隐含模型,中转,放入request中的.除非你特意把这些数据放到session域中. ...

  9. 在LoadRunner中设置HTTP请求time-out的时间

    Error -27728: Step download timeout (120 seconds) has expired when downloading non-resource(s) [MsgI ...

随机推荐

  1. 数据结构-链表逆置(c++模板类实现)

    链表结点类模板定义: template <class T> class SingleList; template <class T> class Node { private: ...

  2. 最牛逼android上的图表库MpChart(一) 介绍篇

    最牛逼android上的图表库MpChart一 介绍篇 MpChart优点 MpChart是什么 MpChart支持哪些图表 MpChart效果如何 最牛逼android上的图表库MpChart(一) ...

  3. 【C语言】文件

    fopen fseek fprintf fclose 先用这几个函数

  4. IOS - 屏幕适配

    原文:Beginning Auto Layout Tutorial in iOS 7: Part 1 感谢翻译小组成员@answer-huang(博客)热心翻译.如果您有不错的原创或译文,欢迎提交给我 ...

  5. -bash: pod: command not found

    OS X 系统没升级之前用的 cocoapods 一点儿问题都没有,但是升级成版本10.11.4 OS X EI Capitan之后,在终端除了cd 指令可以用之外,其他任何指令输入都是提示-bash ...

  6. 解决eclipse ctrl+鼠标左键不能用

    选择[Window]菜单 Preferences ——>General——>Editors——>Text Editors——>Hyperlinking 把勾都点上,然后确定KE ...

  7. 月考(cogs 1176)

    [题目描述] 在上次的月考中Bugall同学违反了考场纪律还吃了处分,更可气的是在第二天的校会时 间学校就此事做了全校通报. 现已知在当天校会时间有总共N个同学听到了有关Bugall的处分决定.  B ...

  8. c语言强制类型转换

    一.强制类型转换 printf("3/2+100.5=%f",3/2+100.5);//100.5错误表达 printf ("    (float)3/(float)2 ...

  9. eclipse上安装abator插件

    下面是我看了网上的有一点需要强调:网址 http://ibatis.apache.org/tools/abator然后全选,然后是==>重启就好了 eclipse上安装abator插件参考:ht ...

  10. NYOJ926(概率)

    题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=926 设最终A获胜的概率为P,则B获胜的概率为1-P: 因此我们只需要考虑A获胜的概率即可 ...