Rob Gonda's Blog

cfhttp and gzip compression

I just wasted an hour with a simple cfhttp post problem, and I wouldn't wish any of my readers to go through the same process.

I was integrating with a bank to get a deposit slip completely filled up with client information and allow my client to print it without leaving my site. When I manually posted the form to the bank it worked, but through CF I kept getting a Connection Failed in the body. I knew if wasn't blocking me, because it also provided me with an ASP session cookie; so I looked at the headers using an http packet sniffer and I saw two variables that could be a problem: Transfer-Encoding: chunked, and Content-Encoding: gzip.

After an hour, I discovered that CF, or even worse, Java will not accept gzip encoding, so right when I was about to give up, I found that I can request a specific encoding by supplying http headers for 'Accept-Encoding'.

Here's the magic:


<cfhttpparam type="Header" name="Accept-Encoding" value="deflate;q=0">
<cfhttpparam type="Header" name="TE" value="deflate;q=0">


After I added those two lines inside my cfhttp, everything started working like a charm (as it should).

Next time you get a Connection Failed and have absolutely no clue on why it is behaving that way, make sure you check the content encoding of that web server.

TrackBacks
There are no trackbacks for this entry.

Trackback URL for this entry:
http://www.robgonda.com/blog/trackback.cfm?7DDAA65C-3048-7431-E40F98C78609CCA1

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
This blog is running version 5.9.003. Contact Blog Owner