CFHTTP Cookie问题 [英] CFHTTP Cookie Issue

查看:341
本文介绍了CFHTTP Cookie问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Railo-Express-4.1.1.009下有 cfhttp 的Cookie问题(我相信是这样)。



我的代码执行两步http调用。第一步使用远程应用程序执行授权。如果成功,远程服务器返回一个授权cookie,它被提取并传递给第二个调用,如下所示:

 < cfhttp url =http:// remoteserver / targetPathport =xxxxmethod =getresult =Local.responsethrowonerror =trueredirect =false> 
< cfhttpparam name =Actionvalue =Pingtype =URL/>
< cfhttpparam name =mansession_idvalue =#Local.result.authCookie#type =cookie/>
< / cfhttp>

http呼叫成功,但响应基本上说我未经授权。 (这就是权限被拒绝实际上意味着在这种情况下)。

 < response ='Error'message ='Permission denied '... />但是,完全相同的代码(从同一个框运行)与CF9成功:

 < response ='Success'ping ='Pong'... /> 

我双重检查了第一次cfhttp调用的响应头,并且验证了我传递正确的# Local.cs> CFHTTP Result = set-cookie:mansession_id =932a4086;

  • Local.result.authCookie = AUTHCOOKIE string 932a4086



  • 由于一切都一样,除了运行cfml的引擎之外, c $ c> cfhttp 可能是没有正确传递cookie。我已经尝试了一些东西,但我在这一点上的想法。



    更新:



    我决定尝试不同版本的Railo(因为Express版本让它这么容易),发现代码工作在3.3.3.001(但不是4.0.4.001)。

    解决方案

    我会安装 Fiddler ,然后将proxyServer = localhost和proxyPort = 8888属性添加到CFHTTP调用。然后,您可以通过提琴手观看HTTP请求。如果您的CF服务器在另一个框上,您仍然可以在桌面上运行Fiddler,只需在Fiddler的设置中启用允许其他计算机连接,然后在proxyServer属性中提供您的计算机名称,而不是localhost。



    你在一个伟大的情况下,你可以在一些环境中工作,而不是其他人,所以你应该能够看到发生了什么不同。



    您可以手动比较http请求,或者配置Fiddler使用差异工具。选择两个请求,然后右键单击 - >比较。我强烈推荐Scooter Software的 Beyond Compare 3 作为差异工具。



    请更新您的问题与您的发现,因为我想知道结果。


    I'm having (what I believe to be) a cookie problem with cfhttp under Railo-Express-4.1.1.009.

    My code performs a two step http call. The first step performs authorization with the remote application. If successful, the remote server returns an authorization cookie, which is extracted and passed to the second call like so:

    <cfhttp url="http://remoteserver/targetPath" port="xxxx" method="get" result="Local.response" throwonerror="true" redirect="false">
           <cfhttpparam name="Action" value="Ping" type="URL" />
           <cfhttpparam name="mansession_id" value="#Local.result.authCookie#" type="cookie" />
    </cfhttp>
    

    The http call is successful, but the response essentially says I'm not authorized. (That's what "permission denied" actually means in this context).

    <response='Error' message='Permission denied'... />
    

    However, the exact same code (run from the same box) succeeds with CF9:

    <response='Success' ping='Pong' ... />
    

    I double checked the response headers from the first cfhttp call, and verified I'm passing the correct #Local.result.authCookie# value to the second call:

    • CFHTTP Result = set-cookie : mansession_id="932a4086";
    • Local.result.authCookie = AUTHCOOKIE string 932a4086

    Since everything is the same, other than the engine running the cfml, I've concluded cfhttp probably isn't passing the cookie properly. I've tried a number of things, but I'm out of ideas at this point. Any ideas on how to resolve the problem or further troubleshoot it would be greatly appreciated.

    Update:

    I decided to try different versions of Railo (since the Express versions make it so easy) and found that the code works under 3.3.3.001 (but not 4.0.4.001). So something must be broken in 4.x.

    解决方案

    I would install Fiddler and then add the proxyServer=localhost and proxyPort=8888 attributes to the CFHTTP call. You can then watch the HTTP requests go out through fiddler. If your CF server is on another box, you can still run Fiddler on your desktop, just turn on 'Allow other machines to connect' in Fiddler's settings and provide your machine name instead of localhost in the proxyServer attribute.

    You're in the great situation that you can make work in some environments and not others, so you ought to be able to see what's happening differently.

    You can either compare the http requests manually, or configure Fiddler to use a diffing tool. Select two requests, then right-click->compare. I highly recommend Beyond Compare 3 from Scooter Software as a diffing tool.

    Do update your question with what you find, as I'd like to know the outcome.

    这篇关于CFHTTP Cookie问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆