huangsheng2 发表于 2009-6-12 23:23:23

http response是重定向的,如何用web_reg_save_para做关联

一般资料上说的web_reg_save_para都是直接从下一次访问的reponse获得关联值,我现在遇到一个问题,这下一次的response本身只是一个server端的redirect,我要获得的关联值在再下一次的response中,此时我如何做关联。谢谢啦。

Fin 发表于 2009-6-12 23:39:33

你能确定 下一次的RESPONSE 的页面里面你要关联的东西在HTML 页面里面的位置吗? 如果可以用 web_reg_find() 试一试,但愿可行...

huangsheng2 发表于 2009-6-12 23:49:05

我在extended log中发现我录制只生成一个web_url(...),其实执行了两次,在服务器端产生了两个response,一个是redirect,一个是包含我要关联的response.所以我关心如何捕获。

Fin 发表于 2009-6-13 00:04:16

那就在那个 response 上面加 这两个函数任意一个就可以吧...

huangsheng2 发表于 2009-6-13 00:06:58

第二个真实的response在我客户端没有对应的http request呀。

Fin 发表于 2009-6-13 00:12:31

我也搞不清了, 你录制的是什么啊? 如果可能的话,给我个地址,我是否能登录,我去录制,或者把代码发上来这样也方便与问题排查.

huangsheng2 发表于 2009-6-13 00:13:24

我明天9点贴代码。谢谢。晚安。

Fin 发表于 2009-6-13 00:22:09

88

huangsheng2 发表于 2009-6-13 09:18:45

10点到10点半贴出代码

huangsheng2 发表于 2009-6-13 12:59:08

我写的要关联的LR脚本: (左边数字是行号)
65:        web_reg_save_param("lt1",
                "LB/IC=login2.asp?lt=",
                "RB/IC=%3a",
                "Ord=1",
                "Search=All",
                LAST);

72:        web_reg_save_param("lt2",
                "LB/IC=%3a",
                "RB/IC=%3a",
                //"Ord=1",
                "Search=All",
                LAST);

79:        web_reg_save_param("lt3",
                "LB/IC=%3a",
                "RB/IC=&service=",
                //"Ord=1",
                LAST);

85:        web_url("IndexIframeLogin.asp",
                "URL=http://www.s00.com/IndexIframeLogin.asp",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=http://www.s00.com/",
                //"Snapshot=t26.inf",
                "Snapshot=t26.inf",
                "Mode=HTTP",
      //"Mode=HTML",
                LAST);
95:        lr_output_message("%s", lr_eval_string("{lt1}"));
96:        lr_output_message("%s", lr_eval_string("{lt2}"));
97:        lr_output_message("%s", lr_eval_string("{lt3}"));
107:                    web_concurrent_end(NULL);

如果我在run time setting 设置standard log:
Action.c(72): Registering web_reg_save_param was successful       
Action.c(79): Registering web_reg_save_param was successful       
Action.c(85): Registering web_url("IndexIframeLogin.asp") was successful       
Action.c(95):
Action.c(96):
Action.c(97):
Action.c(85): Redirecting "http://www.sdo.com/IndexIframeLogin.asp" (redirection depth is 0)          
Action.c(85): To location "http://lt.cas.sdo.com:8171/cas/login?service=http://www.sdo.com/IndexIframeLogin.asp"          
Action.c(107): web_concurrent_end was successful, 5827 body bytes, 2152 header bytes, 12 chunking overhead bytes       
我从Generated Log中得到的日志:其实我要访问的 URL=http://www.sdo.com/IndexIframeLogin.asp, 服务器端跳转到了http://lt.cas.sdo.com:8171/cas/login?

****** Request Header For Transaction With Id 38 ******
GET /IndexIframeLogin.asp HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */*
Referer: http://www.sdo.com/
Accept-Language: zh-cn
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 2.0.50727)
Host: www.sdo.com
Connection: Keep-Alive
Cookie: ASPSESSIONIDCQTBTCDT=CGCENDKABDKPILBBMOCIBCDJ


$$$$$$ Request Header For Transaction With Id 38 Ended $$$$$$

****** Response Header For Transaction With Id 38 ******
HTTP/1.1 302 Object moved
Server: sdo
Date: Fri, 12 Jun 2009 07:54:16 GMT
Content-Type: text/html
Connection: keep-alive
Via: www1
Pragma: No-Cache
Location: http://lt.cas.sdo.com:8171/cas/login?service=http://www.sdo.com/IndexIframeLogin.asp
Content-Length: 205
Expires: Thu, 11 Jun 2009 07:54:16 GMT
Set-Cookie: refererURL=http%253A%2F%2Fwww%2Esdo%2Ecom%2FIndexIframeLogin%2Easp; domain=sdo.com; path=/
Cache-control: no-cache


$$$$$$ Response Header For Transaction With Id 38 Ended $$$$$$

****** Response Body For Transaction With Id 38 ******
<head><title>Object moved</title></head>
<body><h1>Object Moved</h1>This object may be found <a HREF="http://lt.cas.sdo.com:8171/cas/login?service=http://www.sdo.com/IndexIframeLogin.asp">here</a>.</body>

$$$$$$ Response Body For Transaction With Id 38 Ended $$$$$$

****** Start Log Message ******

Start Frames Hierarchy Tree Dump
/
End Frames Hierarchy Tree Dump

$$$$$$ End Log Message $$$$$$

****** Request Header For Transaction With Id 40 ******
GET /images/bg1.gif HTTP/1.1
Accept: */*
Referer: http://www.sdo.com/
Accept-Language: zh-cn
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 2.0.50727)
Host: www.sdo.com
Connection: Keep-Alive
Cookie: ASPSESSIONIDCQTBTCDT=CGCENDKABDKPILBBMOCIBCDJ


$$$$$$ Request Header For Transaction With Id 40 Ended $$$$$$

****** Response Header For Transaction With Id 40 ******
HTTP/1.1 200 OK
Server: sdo
Date: Fri, 12 Jun 2009 07:54:16 GMT
Content-Type: image/gif
Connection: keep-alive
Cache-Control: max-age=1296000
Via: www3
Content-Length: 1271
Last-Modified: Tue, 20 Jan 2009 15:22:08 GMT
Accept-Ranges: bytes

huangsheng2 发表于 2009-6-13 13:10:08

还有用extended log好象是取到关联值了, 我想问一下,我到底是否取到关联值了呢?

Action.c(85): t=4019ms: 394-byte request headers for "http://www.sdo.com/IndexIframeLogin.asp" (RelFrameId=1, Internal ID=7)   
Action.c(107):   GET /IndexIframeLogin.asp HTTP/1.1\r\n
Action.c(107):   Referer: http://www.sdo.com/\r\n
Action.c(107):   Accept-Language: zh-cn\r\n
Action.c(107):   User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Mozilla/4.0 (compatibl
Action.c(107):   e; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR 2.0.50727; InfoPath.2)\r\n
Action.c(107):   Accept-Encoding: gzip, deflate\r\n
Action.c(107):   Accept: */*\r\n
Action.c(107):   Connection: Keep-Alive\r\n
Action.c(107):   Host: www.sdo.com\r\n
Action.c(107):   Cookie: ASPSESSIONIDCQTCSCCT=IGICDMEBBCLGKLHEAIOBCIEA\r\n
Action.c(107):   \r\n
Action.c(85): t=4069ms: 443-byte response headers for "http://www.sdo.com/IndexIframeLogin.asp" (RelFrameId=1, Internal ID=7)   
Action.c(107):   HTTP/1.1 302 Object moved\r\n
Action.c(107):   Server: sdo\r\n
Action.c(107):   Date: Sat, 13 Jun 2009 04:43:05 GMT\r\n
Action.c(107):   Content-Type: text/html\r\n
Action.c(107):   Connection: keep-alive\r\n
Action.c(107):   Via: www1\r\n
Action.c(107):   Pragma: No-Cache\r\n
Action.c(107):   Location: http://lt.cas.sdo.com:8171/cas/login?service=http://www.sdo.com/IndexIframeLogin
Action.c(107):   .asp\r\n
Action.c(107):   Content-Length: 205\r\n
Action.c(107):   Expires: Fri, 12 Jun 2009 04:43:06 GMT\r\n
Action.c(107):   Set-Cookie: refererURL=http%253A%2F%2Fwww%2Esdo%2Ecom%2FIndexIframeLogin%2Easp; domain=sdo
Action.c(107):   .com; path=/\r\n
Action.c(107):   Cache-control: no-cache\r\n
Action.c(107):   \r\n
Action.c(85): t=4100ms: 205-byte response body for "http://www.sdo.com/IndexIframeLogin.asp" (RelFrameId=1, Internal ID=7)   
Action.c(107):   <head><title>Object moved</title></head>\n
Action.c(107):   <body><h1>Object Moved</h1>This object may be found <a HREF="http://lt.cas.sdo.com:8171/ca
Action.c(107):   s/login?service=http://www.sdo.com/IndexIframeLogin.asp">here</a>.</body>\n
Action.c(85): Redirecting "http://www.sdo.com/IndexIframeLogin.asp" (redirection depth is 0)          
Action.c(85): To location "http://lt.cas.sdo.com:8171/cas/login?service=http://www.sdo.com/IndexIframeLogin.asp"          
Action.c(107): t=4115ms: Request done "http://www.sdo.com/IndexIframeLogin.asp"       
Action.c(107): t=4123ms: Connecting to host 61.172.252.176:8171       
Action.c(107): t=4140ms: Connected socket from 222.73.62.164:5884 to 61.172.252.176:8171 in 2 ms       
Action.c(85): t=4143ms: 460-byte request headers for "http://lt.cas.sdo.com:8171/cas/login?service=http://www.sdo.com/IndexIframeLogin.asp" (RelFrameId=1, Internal ID=8)   
Action.c(107):   GET /cas/login?service=http://www.sdo.com/IndexIframeLogin.asp HTTP/1.1\r\n
Action.c(107):   Referer: http://www.sdo.com/\r\n
Action.c(107):   Accept-Language: zh-cn\r\n
Action.c(107):   User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Mozilla/4.0 (compatibl
Action.c(107):   e; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR 2.0.50727; InfoPath.2)\r\n
Action.c(107):   Accept-Encoding: gzip, deflate\r\n
Action.c(107):   Accept: */*\r\n
Action.c(107):   Connection: Keep-Alive\r\n
Action.c(107):   Host: lt.cas.sdo.com:8171\r\n
Action.c(107):   Cookie: refererURL=http%253A%2F%2Fwww%2Esdo%2Ecom%2FIndexIframeLogin%2Easp\r\n
Action.c(107):   \r\n
Action.c(85): t=4205ms: 461-byte response headers for "http://lt.cas.sdo.com:8171/cas/login?service=http://www.sdo.com/IndexIframeLogin.asp" (RelFrameId=1, Internal ID=8)   
Action.c(107):   HTTP/1.1 200 OK\r\n
Action.c(107):   Date: Sat, 13 Jun 2009 04:43:06 GMT\r\n
Action.c(107):   Server: Microsoft-IIS/6.0\r\n
Action.c(107):   X-Powered-By: ASP.NET\r\n
Action.c(107):   P3P: CP=CAO PSA OUR\r\n
Action.c(107):   Cache-Control: no-cache\r\n
Action.c(107):   Via: Gauss\r\n
Action.c(107):   X-AspNet-Version: 2.0.50727\r\n
Action.c(107):   Set-Cookie: CAS_LOGIN_STATE=0; domain=sdo.com; expires=Fri, 12-Jun-2009 04:43:06 GMT; path
Action.c(107):   =/\r\n
Action.c(107):   Set-Cookie: SDO_SDID=0; domain=sdo.com; expires=Fri, 12-Jun-2009 04:43:06 GMT; path=/\r\n
Action.c(107):   Cache-Control: private\r\n
Action.c(107):   Content-Type: text/html; charset=gb2312\r\n
Action.c(107):   Content-Length: 1460\r\n
Action.c(107):   \r\n
Action.c(85): t=4245ms: 999-byte response body for "http://lt.cas.sdo.com:8171/cas/login?service=http://www.sdo.com/IndexIframeLogin.asp" (RelFrameId=1, Internal ID=8)   
Action.c(107):   \r\n
Action.c(107):   \r\n
Action.c(107):   <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >\r\n
Action.c(107):   <HTML>\r\n
Action.c(107):   \t<HEAD>\r\n
Action.c(107):   \t\t<title>Login</title>\r\n
Action.c(107):   \t\t<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">\r\n
Action.c(107):   \t\t<meta name="CODE_LANGUAGE" Content="C#">\r\n
Action.c(107):   \t\t<meta name="vs_defaultClientScript" content="JavaScript">\r\n
Action.c(107):   \t\t<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">\r
Action.c(107):   \n
Action.c(107):   \t\t\r\n
Action.c(107):   \t\t\r\n
Action.c(107):   \t\t\r\n
Action.c(107):   \t\t<script language="javascript">\r\n
Action.c(107):   \t\t\tfunction Rdirect()\r\n
Action.c(107):   \t\t\t{\r\n
Action.c(107):   \t\t\t    var path    =   "http://www.sdo.com/login2.asp?lt=Gauss-1ce80662-fa66-4cf6-9c97-
Action.c(107):   a6bc018d3264-2009-06-13_12%3a43%3a06.009&service=http%3a%2f%2fwww.sdo.com%2fIndexIframeLog
Action.c(107):   in.asp%3fcas%3d1";\r\n
Action.c(107):   \t\t\t    if (0 < path.length)\r\n
Action.c(107):   \t\t\t      location.href = path;\r\n
Action.c(107):   \t\t\t    else\r\n
Action.c(107):   \t\t\t      location.href = "http://www.sdo.com/login2.asp?lt=Gauss-749abb60-6616-4f3d-a
Action.c(107):   006-13ee532c6ab4-2009-06-13_12:43:06.009&error=8|无效的Url";\r\n
Action.c(107):   \t\t\t      \r\n
Action.c(107):   \t\t\t\t//location.replace("http://www.sdo.com/login2.asp?lt=Gauss-1ce80662-fa66-4cf6-9c97
Action.c(107):   -a6bc018d3264-2009-06-13_12%3
Action.c(107): Notify: Saving Parameter "lt1 = Gauss-1ce80662-fa66-4cf6-9c97-a6bc018d3264-2009-06-13_12"
Action.c(107): Notify: Saving Parameter "lt2 = 43"
Action.c(107): Notify: Saving Parameter "lt3 = 06.009"
Action.c(85): t=4296ms: 461-byte response body for "http://lt.cas.sdo.com:8171/cas/login?service=http://www.sdo.com/IndexIframeLogin.asp" (RelFrameId=1, Internal ID=8)   
Action.c(107):   a43%3a06.009&service=http%3a%2f%2fwww.sdo.com%2fIndexIframeLogin.asp%3fcas%3d1");\r\n
Action.c(107):   \t\t\t}\r\n
Action.c(107):   \t\t</script>\r\n
Action.c(107):   \t\t\r\n
Action.c(107):   \t</HEAD>\r\n
Action.c(107):   \t<body MS_POSITIONING="GridLayout" onload="Rdirect()";>\r\n
Action.c(107):   \t\t<form name="Form1" method="post" action="login.aspx?service=http%3a%2f%2fwww.sdo.com%2
Action.c(107):   fIndexIframeLogin.asp" id="Form1">\r\n
Action.c(107):   <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKMTk3MjI4NTA5MmRkjp
Action.c(107):   /FGCefEtp5ngvCD+XSmGBxJOI=" />\r\n
Action.c(107):   \r\n
Action.c(107):   \t\t\t\r\n
Action.c(107):   \t\t\t\r\n
Action.c(107):   \t\t</form>\r\n
Action.c(107):   \t</body>\r\n
Action.c(107):   </HTML>\r\n
Action.c(107): t=4326ms: Request done "http://lt.cas.sdo.com:8171/cas/login?service=http://www.sdo.com/IndexIframeLogin.asp"       
Action.c(107): web_concurrent_end was successful, 5827 body bytes, 2152 header bytes, 12 chunking overhead bytes       
Action.c(110): web_concurrent_start started       
Action.c(110): web_concurrent_start was successful       
Action.c(111): web_url("ibw_tool.js") started       
Action.c(111): Registering web_url("ibw_tool.js") was successful       
Action.c(119): web_url("ibw_public.js") started       
Action.c(119): Registering web_url("ibw_public.js") was successful       

云层 发表于 2009-6-14 18:04:16

没心情看你写了什么,试试看将search in 设置为ALL应该就可以了

Fin 发表于 2009-6-14 21:29:38

我也录制了一下 SDO 登录, 产生了大量的 COOKIES 晕了..
页: [1]
查看完整版本: http response是重定向的,如何用web_reg_save_para做关联