//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. Linux/Unix命令

    MAC 中自定义环境变量 打开:nano .bash_profile 查看:cat text 保存退出:Ctrl+C,Y #在.bash_profile 中添加tree alias tree=&quo ...

  2. 执行HQL语句出现Remember that ordinal parameters are 1-based

    今天使用hibernate出个奇怪的错误,第一次碰到 Remember that ordinal parameters are 1-based! 原因是 问题发生的原因是:hql语句里不需要参数,却添 ...

  3. October 7th 2016 Week 41st Friday

    The land didn't move, but moved; the sea was not still, yet was still. 大地止而亦行,大海动而亦静. Remember that ...

  4. August 30th 2016 Week 36th Tuesday

    If you keep on believing, the dreams that you wish will come true. 如果你坚定信念,就能梦想成真. I always believe ...

  5. http://poj.org/problem?id=3278(bfs)

    Catch That Cow Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 76935   Accepted: 24323 ...

  6. Jmeter 函数

    一._csvRead 函数 _cvsRead函数是从外部读取参数,csvRead函数可以从一个文件中读取多个参数. 步骤: 1.先新建一个文件,例如c.txt,里面的数据存放为 web@qq.com, ...

  7. js 删除确定

    "<td><a href='shanchu.php?c={$v[0]}' onclick=\"return confirm('确定删除么?')\"> ...

  8. PHP中比较两个时间的大小与日期的差值

    在这里我们全用到时间戳 mktime(hour,minute,second,month,day,year,[is_dst])     其参数可以从右向左省略,任何省略的参数都会被设置成本地日期和时间的 ...

  9. Delphi中DLL的创建和使用

    参考:http://blog.csdn.net/ninetowns2008/article/details/6311663 结合这篇博客:http://www.cnblogs.com/xumenger ...

  10. js onclick="return test()"事件返回值,对有些事件,会影响默认动作的执行。如:onclick和onsubmit

    onclick="return test()"事件返回值,对有些事件,会影响默认动作的执行.如:onclick和onsubmit <body> <!--事件返回值 ...