#host# - where are you from?

ColdFusion Add comments

There i was busy coding an app and I did a fairly routine CFDUMP, <cfdump var=”#host#”> ran my page and didn’t see what I expected. Instead I saw the hostname of the server I was talking to - which puzzled me. I had in fact typo’ed and should have cfdumped ‘hosts’ which I was expecting to be a dump of an XML packet. It turns out that a number of the CGI variables are accessible without their http_ prefix. Obviously <cfdump var=”#host#”> gives the same result as <cfdump var=”#http_host#”> (assuming no other in a higher priority scope!) and <cfdump var=”#cgi.http_hosts#”>. Not scoping my Cfdump meant that CF searched all the scopes it usually does and found a match just without the http_ prefix.

Not that it’s particular important - but just something to watch out for. I’ve confirmed it on CF6.1 (Solaris) and on CF7 (Windows) where i came across it initially.

Leave a Reply

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in