ColdFusion CFHTTP Post 正在执行第二个 GET 请求
我正在使用 ColdFusion 8。
我正在向远程服务器执行 CFHTTP Post。 远程站点查看了他们的日志,他们说我的代码正在执行 POST,然后立即执行第二个 GET 请求。
这是我的代码(URL 已更改):
<cfhttp url="https://www.theurlofthesite.com" method="POST" port="443" resolveurl="yes" redirect="yes">
<cfhttpparam type="FORMFIELD" name="type" value="SALES">
<cfhttpparam type="FORMFIELD" name="account" value="10003">
<cfhttpparam type="FORMFIELD" name="Submit" value="Submit+Request">
</cfhttp>
<Cfoutput>#cfhttp.fileContent#</CFOUTPUT>
<cfdump var="#cfhttp#">
有谁知道为什么他们在我的 POST 之后立即看到第二个 GET 请求吗? 它会破坏会话并且无法正确返回页面,因为(我们认为)
我肯定不会执行 GET,我只会执行一个 POST。
谢谢,
里奇
I am using ColdFusion 8.
I'm doing a CFHTTP Post to a remote server. The remote site has looked at their logs and they say my code is doing the POST, and then immediately doing a 2nd GET request.
Here is my code (the URL has been changed):
<cfhttp url="https://www.theurlofthesite.com" method="POST" port="443" resolveurl="yes" redirect="yes">
<cfhttpparam type="FORMFIELD" name="type" value="SALES">
<cfhttpparam type="FORMFIELD" name="account" value="10003">
<cfhttpparam type="FORMFIELD" name="Submit" value="Submit+Request">
</cfhttp>
<Cfoutput>#cfhttp.fileContent#</CFOUTPUT>
<cfdump var="#cfhttp#">
Does anyone have any idea why they are seeing a 2nd GET request right after my POST? it's trashing the session and not returing the page correctly because of this (we think)
I'm definately not doing a GET, I'm only doing the one POST.
thanks,
Rich
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我猜测您获得第二个 GET 的原因是您的 CFOUTPUT 将检索到的页面内容输出到浏览器中,然后当从检索到的页面呈现图像或该内容中的某些内容时,它充当 GET。
请记住,CFHTTP 不是有状态的。 我的意思是每个使用 CFHTTP 的请求都会创建一个新会话。 您可以通过在请求中使用 CFHTTPPARAM 传递 CFID/CFTOKEN 来让 CFHTTP 继续现有会话。 这可能可以解释您的会话问题。
I'm guessing the reason you get the second GET is that your CFOUTPUT outputs the retrieved page content into the browser, then when an image or something from that content is rendered from the retrieved page it acts as a GET.
Remember that CFHTTP is not stateful. By this I mean that each request with CFHTTP will create a new session. You can get CFHTTP to continue with an existing session by passing in CFID/CFTOKEN through with CFHTTPPARAM in the request. This might explain your session issues.
不确定...既然医生说...
Not sure... Since the doc said...
如果您使用的是 Firefox,请确保根据您的要求关闭 firebug 和 ySlow。 他们会两次触发您的网址来设置其数据,当您不知道他们正在这样做时,这可能是一个真正的问题。
另外,除非需要,否则请尝试关闭重定向。
If you are using firefox, make sure you have firebug and ySlow turned off for your request. They fire your urls twice to set up their data and can be a real problem when you don't know that they are doing that.
Also, try turning the redirect off unless you need it.
好的,我切换到 CF 5 服务器,它停止执行第二次 GET。 它现在只是在执行
POST
,因此这可能是 CF 8 的一个怪癖。OK, I switched over to a CF 5 server, and it stopped doing the 2nd GET. it's just doing a
POST
now, so it might be a quirk with CF 8.此代码是否位于自定义 CF 标签内? 如果是这样,则调用
或
调用自定义标签两次! (一次用于开始标记,一次用于结束标记。)
Is this code inside a custom CF tag? If so then calling
or
Calls the custom tag TWICE! (Once for the start tag and once for the end.)