rss
twitter
Find out what I'm doing, Follow Me :)
0


Recently came across a really bizarre issue with CFHTTP. Look at the code below:

<cfset variables.protocols = "https://,http://">
<cfset variables.link = "www.adobe.com/products/coldfusion/">
<cfloop list="#variables.protocols#" index="protocol">
    <cfhttp url="#protocol##variables.link#" method="get" timeout="10"/>
    <cfoutput>Status: #cfhttp.StatusCode#<br></cfoutput><cfflush>
</cfloop>



See anything wrong with it? No? Well, here is the output I get:

Status: 200 OK
Status: Connection Failure. Status code unavailable.



And no, both the URL's are valid and you can access them through browser or with CFHTTP outside of CFLOOP. Turns out it's a bug in CFHTTP. When CFHTTP is used inside CFLOOP you can't follow an "https" request with "http" request. Huh? Ya, that's what I thought...

I was ready to file a bug report, but before doing that tested it in CF 9 to see what happens and voila, it works!

So, whatever the bug was, it's fixed in CF 9.

7

At my work place we were setting up local development environment for all the developer. Our setup was pretty standard. Local development environment for all developer, Subversion (SVN) for version control and development/test server for QA. To make this setup painless for developers, one of the main requirement was to export the code to our development server when it was committed to SVN. To do something like that, SVN has what they call "hooks". These are essentially scripts that are run on certain repository events. The events are:

  • start-commit - This is run before commit transaction begins, can be used to do special permission checking.
  • pre-commit - This is run when the transaction is complete, but before commit. Often used to validate things such as a non zero length log message.
  • post-commit - This is run after the transaction has been committed and a revision number created. Can be used for sending emails, or backing up repository or in our case exporting the changed files.
  • pre-revprop-change - Runs before a revision property change. Can be used to check permissions.
  • post-revprop-change - Runs after a revision property change. Can be used to email or backup these changes.

More information on hooks here http://svnbook.red-bean.com/en/1.1/ch05s02.html

So, with this knowledge I thought it should be easy enough to just do an SVN export command in the post-commit hook, right? Well, I should know better. Nothing ever is quite that simple. But, hopefully after you read this post, it will be for you. I will go step by step on how to get it working and the issues I faced.

If you are someone like me who doesn't like to read long posts, go ahead and download the script and play with it. If it works for you, great! Otherwise keep reading :)

Read More