Recent Articles

A DNS Puzzler
Here's an interesting puzzle involving DNS. It's about Windows, Linux, and OS X, and I don't have a complete answer yet, but I thought I'd share what I've found so far. The other day I was working on my Mac...

Lawrence On Embedded Virtualization
VMware and XenSource are moving to hardware near you: Virtualization: A feature of the hardware, not the OS?. It's not clear to me how much cost this will add - VMware ESX runs from $1,000.00 on up, but assuming...

Securing A Wireless Network Connection With WEP...
I have just set up a wireless connection at home - whenever I log on it says that the connection is unsecure - how do I secure it? I have a new Toshiba Laptop and a Phillips Router. I saw something about a WEP...

Server Monitor Alerts In ColdFusion 8
So this isn't exactly old news, but while I've played quite a bit with the new Server Monitor in ColdFusion 8, I never really took a good look at the Alerts section. This week I finally took some time to play with alerts.

Linux Security: It's Importance in Today's World
In spite of several other operating systems gaining a huge monopoly in the market, Linux has always has its own fan following. Even today, many people are realizing the strategic important of Linux as an operating...

Server Monitor API In Coldfusion 8
In an earlier post I talked a bit about how the Admin API has been updated in ColdFusion 8. For folks who don't know what this is - it is a way to get into the internals of ColdFusion directly from CFML. It requires...

Criteria For Non-Windows, VMware & Network...
With the announcement of the purchase of Engyro, Maarten from confirmed that the Engyro MPs were in fact pulled from the market. This put a crimp in the non-WIndows story for more than one person...


HTTP Conditional Gets In ColdFusion

By Raymond Camden

I've been working on performance updates to ColdFusionBloggers over the past week or so - and the primary area I'm working on is the aggregator.

One item that has been recommended to me by multiple people is to take a look at HTTP Conditional Gets. What in the heck is that?

Charles Miller has written an excellent blog post on it. I'd suggest reading it first. My short take on it is this:

HTTP Conditional Get is a way to ask a web server to return a document only if it hasn't changed. I simply tell the server some information about my last request, and the server will either return the full body, or a header saying nothing has changed.

Again - read Miller's post for more information. In order for this to work - the remote server has to support it of course - and has to return special information in the header for your requests. BlogCFC does this for it's RSS feed. So how can we use this in ColdFusion?

First off - you need to check for - and two headers: Etag and Last-Modified. If "result" is the result of a CFHTTP tag, this code would work:

Cost Effective Website and Network Monitoring
IPCheck Server Monitor - Free Download

The attributes.url value is just the URL. So at this point - we have our content, but we've also stored the ETag and LastModified. Now what I'll do when I hit the URL again is to pass in the values:

Now here is the cool part. All I have to do is check the result header. If the status code is 304, it means nothing changed. If I dump the entire result, I will see no fileContent variable. This means my traffic was reduced quite a bit. If the status code was anything but that - it means either the content changed. I'd then re-update my application cache.

What rocks is that if the remote server doesn't grok this stuff - it doesn't matter. Your GETs will still work. In my unscientific testing in my local copy of ColdFusionBloggers, I think I found that about 40% of my blogs supported it.

So - in working on this code, I found a good article by Pete Freitag on the topic: If-Modified-Since and CFML Part II. One interesting thing about his code is that he only works with one header value: If-Modified-Since. I asked him about that and he said he would respond on the blog. (He is busy now so it may be a bit.)

Later tonight I'm going to share a simple CFC that shows a way to wrap up this logic so you can do: contents = mycfc.get(someurl) and let the CFC worry about it.


About the Author:
Raymond Camden,

Raymond Camden is Vice President of Technology for roundpeg, Inc. A long time ColdFusion user, Raymond has worked on numerous ColdFusion books and is the creator of many of the most popular ColdFusion community web sites. He is an Adobe Community Expert, user group manager, and the proud father of three little bundles of joy.

About NetworkNewz
NetworkNewz editors, writers and contributors focus on both the big picture and the details of networking. At NetworkNewz our goal is to deliver to you The Key To Network Management.

NetworkNewz is brought to you by:

-- NetworkNewzis an iEntry, Inc. publication --
iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509
2007 iEntry, Inc.  All Rights Reserved  Privacy Policy  Legal

archives | advertising info | news headlines | newsletters | comments/feedback | submit article

The Keys To Network Management Ask Questions in the Networking Forum NetworkNewz News Archives About Us Feedback NetworkNewz Home Page About Article Archive News Downloads WebProWorld Forums Jayde iEntry Advertise Contact