Hi, Iâm trying to make cfhttp request with post method and
multipart=âyesâ attrib (trying to emulate form submiting). I use CF8 build
8.01, Wireshark, FF 3.6.16.
The problem is that I get Status code: 500 Internal Server Error in response
My cf code:
<cfscript>
request.strRAtr = {
method="post",
url="â¦.",
useragent="Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2.15)
Gecko/20110303 Firefox/3.6.15 (.NET CLR 3.5.30729)",
redirect="no",
multipart = "yes";
result = "variables.strReqRes"
};
request.arrRParam = [
{ type = "header",
name="Host",
value="â¦"
},
{ type = "header",
name="Accept",
value="text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
},
{ type = "header",
name="Accept-Language",
value="en-us,en;q=0.5"
},
{ type = "header",
name="Accept-Encoding",
value="gzip,deflate"
},
{ type = "header",
name="Accept-Charset",
value="ISO-8859-1,utf-8;q=0.7,*;q=0.7"
},
{ type = "header",
name="Keep-Alive",
value="115"
},
{ type = "header",
name="Connection",
value="keep-alive"
},
{ type = "header",
name="Referer",
value="â¦."
}
];
//Ð´Ð»Ñ Ð¿Ð°ÑамеÑÑа cfhttparam - cgi:cookie
request.strCookieParam = {
type="cgi",
name="Cookie",
value="â¦â¦",
encoded="no"
};
</cfscript>
<cfhttp attributecollection="#request.strRAtr#">
<cfloop from="1" to="#arrayLen(request.arrRParam)#" index="i">
<cfhttpparam type = "#request.arrRParam[i].type#"
name = "#request.arrRParam[i].name#"
value = "#request.arrRParam[i].value#">
</cfloop>
<cfhttpparam type = "formfield"
name = "wizardMode"
value = "â¦">
<cfhttpparam attributecollection="#request.strCookieParam#">
</cfhttp>
Iâve analysed the Wireshark â the difference between cfrequest and request
from FF is in <mime_multipart chunk> (I export captured data from Wireshark
into PDML â xml packet detail)
>From FF Iâve get:
<proto name="mime_multipart" showname="MIME Multipart Media Encapsulation,
Type: multipart/form-data, Boundary:
"---------------------------311112870412835"" size="4585" pos="936">
<field name="mime_multipart.type" showname="Type: multipart/form-data"
size="0" pos="936" show="multipart/form-data"/>
<field name="" show="First boundary:
-----------------------------311112870412835\r\n" size="46" pos="936"
value="2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d3331313131323837303431323833350d0a"/>
<field name="mime_multipart.part" showname="Encapsulated multipart part: "
size="57" pos="982" show=""
value="436f6e74656e742d446973706f736974696f6e3a20666f726d2d646174613b206e616d653d2277697a6172644d6f6465220d0a0d0a74727565">
<field name="mime_multipart.header.content-disposition"
showname="Content-Disposition: form-data; name="wizardMode"\r\n\r\n"
size="53" pos="982" show="form-data;name=\"wizardMode\""
value="436f6e74656e742d446973706f736974696f6e3a20666f726d2d646174613b206e616d653d2277697a6172644d6f6465220d0a0d0a"/>
<field name="data" value="74727565"/>
<field name="data.data" showname="Data: 74727565" size="4" pos="1035"
show="74:72:75:65" value="74727565"/>
<field name="data.len" showname="Length: 4" size="0" pos="1035"
show="4"/>
</field>
And from CFHTTP:
<proto name="mime_multipart" showname="MIME Multipart Media Encapsulation,
Type: multipart/form-data, Boundary:
"-----------------------------7d0d117230764"" size="6297" pos="1049">
<field name="mime_multipart.type" showname="Type: multipart/form-data"
size="0" pos="1049" show="multipart/form-data"/>
<field name="" show="First boundary:
-------------------------------7d0d117230764\r\n" size="46" pos="1049"
value="2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d376430643131373233303736340d0a"/>
<field name="mime_multipart.part" showname="Encapsulated multipart part:
(text/plain)" size="98" pos="1095" show=""
value="436f6e74656e742d446973706f736974696f6e3a20666f726d2d646174613b206e616d653d2277697a6172644d6f6465220d0a436f6e74656e742d547970653a20746578742f706c61696e3b20636861727365743d5554462d380d0a0d0a74727565">
<field name="mime_multipart.header.content-disposition"
showname="Content-Disposition: form-data; name="wizardMode"\r\n"
size="51" pos="1095" show="form-data;name=\"wizardMode\""
value="436f6e74656e742d446973706f736974696f6e3a20666f726d2d646174613b206e616d653d2277697a6172644d6f6465220d0a"/>
<field name="mime_multipart.header.content-type" showname="Content-Type:
text/plain; charset=UTF-8\r\n\r\n" size="43" pos="1146"
show="text/plain;charset=UTF-8"
value="436f6e74656e742d547970653a20746578742f706c61696e3b20636861727365743d5554462d380d0a0d0a"/>
<proto name="data-text-lines" showname="Line-based text data: text/plain"
size="4" pos="1189">
<field name="" show="true" size="4" pos="1189" value="74727565"/>
</proto>
</field>
As you can see, CFHTTP creates «Encapsulated multipart part: (text/plain)»
and «data-text-lines» â why??? I suppose, that this difference is
explanation of Status code: 500 Internal Server Error in response. Am I right?
And what I have to do for right post in that case?
Thanks.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:343789
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm