On Sat, 15 Jan 2005 23:30:27 +1300, Adam Cameron <[EMAIL PROTECTED]> wrote:
> Is this a "passed to" or a "pulled from" situation here?

A few commonly used, "universally supported" CGI variables are
*passed* to CF with the initial request. That's what you see when you
CFDUMP CGI scope.

Whenever you reference anything else in CGI scope, CF makes a call
back through the connector to *pull* the requested value from the web
server (if it is available).

> but it strikes me as the webserver would have a
> bunch of "CGI" values, and it would be up to the plug-in (in this case
> ColdFusion) to say "Can I have them please?".  Is this not how it works?

No. Some variables are so commonly used that it is more efficient
overall to pass them with the request. Making a call back through the
connector is relatively expensive.

> Why would CF take a subset of them, rather than the whole lot?  Or why
> would the webserver only *pass* a subset of them?

For performance.

> Is this something I missed in the CF docs?  Serious question.

I'm not sure whether it's mentioned in the docs because, for the most
part, developers don't need to know. They can ask for CGI.something
and get either the actual value of something or a blank string if the
web server doesn't support it.

> "Because some browsers do not support some CGI variables, ColdFusion always
> returns True when it tests for the existence of a CGI variable, regardless
> of whether the browser supports the variable."

I think that's because CGI.foo always exists and might be a blank
string (or a real value).

> What *ON EARTH* was the thinking there?  What does CF have to do with
> client browsers and what they return?

In order to determine the result of isDefined("CGI.foo"), CF checks
its local set of CGI variables and if it isn't present, it has to make
a callback to the connector to get the CGI variable. That returns a
blank string or a real value. Therefore isDefined() always returns
true. You could argue that the connector should distinguish between a
supported, available CGI variable and an unsupported, missing CGI
variable but I suspect that is not so simple (I don't know enough
about the entrails of CGI processing in web servers).

> This makes no sense.  If CF retrieved the full list of CGI variables that
> the webserver had, then there'd be none of this "does it or doesn't it?"
> carry-on going on.

And it would pass a *huge* amount of data with every request. I don't
think you want that performance overhead?

Now, the other thing to be aware of is the impact of doing
isDefined("foo") - because CF searches through a bunch of scopes if
you do not qualify your variable name, it can check CGI scope. If foo
is not defined in variables scope, CF looks elsewhere. Go see the docs
but it should be clear that isDefined("foo") could well end up
checking for CGI.foo which means a callback to the connector, just in
case the connected web server actually supports a CGI variable called
foo. That's why I strongly recommend
structKeyExists(scopename,"varname") instead...

And if you don't like this behavior...

http://www.macromedia.com/go/wish
-- 
Sean A Corfield -- http://www.corfield.org/
Team Fusebox -- http://www.fusebox.org/
Breeze Me! -- http://www.corfield.org/breezeme
Got Gmail? -- I have 5 invites to give away!

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

---
You are currently subscribed to cfaussie as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]
Aussie Macromedia Developers: http://lists.daemon.com.au/

Reply via email to