使用FireBug嗅探相关候选者我通常有这个响应头:
Response Headersview source
Cache-Control no-cache, no-store
Content-Length 0
Date Fri, 08 Mar 2013 13:22:37 GMT
Expires Thu, 01 Jan 1970 00:00:00 GMT
Location http://c24jbs300014.test.local:8080/something/someotherthing/171330/considertakingadump?24
Pragma no-cache
Server Apache-Coyote/1.1
在上面的响应标题中,我将值24与此相关联:
web_reg_save_param_ex(
"ParamName=correlationID",
"LB=considertakingadump?",
"RB=",
SEARCH_FILTERS,
"Scope=Headers",
LAST);
它被拾取,它可以在脚本中进行关联:
web_submit_data("submitit",
"Action=http://c29jbsl00015.test.local:8080/something/treatment/{someothercorrelatedvalue}/someotherstuff?{correlationID}-1.IBehaviorListener.0-tabbedPanel-content-panels-0-panel-tableBody-somepoint-0-somepoint-somepoint-somepoint",
"Method=POST",
"RecContentType=text/xml",
"Referer=http://c29jbsl00015.test.local:8080/something/treatment/{someothercorrelatedvalue}/someotherstuff?9",
"Snapshot=t63.inf",
"Mode=HTTP",
ITEMDATA,
"Name=valgtBeslutning", "Value=0", ENDITEM,
LAST);
然而,当查看日志(扩展参数替换)时,我发现很多响应都是构造的URL的一部分,如下所示:
Action.c(618): Redirecting "http://c29jbsl00015.test.local:8080/something/treatment/171334/considerit?24&10Content-Length:+0HTTP/1.1+200+OKServer:+Apache-Coyote/1.1Date:+Fri,+08+Mar+2013+13:27:35+GMTExpires:+Thu,+01+Jan+1970+00:00:00+GMTPragma:+no-cacheCache-Control:+no-cache,+no-storeContent-Type:+text/html%3Bcharset=UTF-8Transfer-Encoding:+chunked-1.ILinkListener-nesteContent-Length:+0HTTP/1.1+200+OKServer:+Apache-Coyote/1.1Date:+Fri,+08+Mar+2013+13:27:35+GMTExpires:+Thu,+01+Jan+1970+00:00:00+GMTPragma:+no-cacheCache-Control:+no-cache,+no-storeContent-Type:+text/html%3BcharsetContent-Length: 0HTTP/1.1 200 OKServer: Apache-Coyote/1.1Date: Fri, 08 Mar 2013 13:27:35 GMTExpires: Thu, 01 Jan 1970 00:00:00 GMTPragma: no-cacheCache-Control: no-cache, no-storeContent-Type: text/html;charset=UTF-8Transfer-Encoding: chunked-1.IBehaviorListener.0-tabbedPanel-content-panels-0-panel-tableBody-kontrollpunkter-0-kontrollpunkt-beslutningForm-valgtBeslutning" (redirection depth is 0) [MsgId: MMSG-26694]
我的服务器响应中没有正确的边界是原因。
有没有办法说“即设置右边界到换行符(\ n)”或类似的东西,在我的web_reg_save_param()中切断这个漫长而无用的信息?在我的服务器响应中的数字24之后?
答案 0 :(得分:3)
是的,您可以使用非可见控制字符,例如\ r,\ n,\ t,...作为左边界或右边界条件。
如果您的变量内容行始终以“location”开头,以“\ n”结尾,您需要最后两个字符,那么您始终可以捕获整行,然后使用C的标准字符串处理功能拉动该行的最后两个字符,例如将“移动指针”的游戏播放到字符串的最后两个字符
&lr_eval_string("{My_captured_long_line}")[strlen(lr_eval_string("{My_captured_long_line}")) -2]
答案 1 :(得分:3)
为什么不使用SaveLen
web_reg_save_param_ex(
"ParamName=correlationID",
"LB=considertakingadump?",
"RB=",
"savelen=2",
SEARCH_FILTERS,
"Scope=Headers",
LAST);