Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

FastCGI anyone?

64 views
Skip to first unread message

Mel

unread,
Feb 3, 2003, 10:24:42 AM2/3/03
to
is fastCGI.tcl up-to-date with new tcl versions?

when i do "package require cgi;package require Fcgi" i get the error
"invalid command gets" !!
can anyone help me pleeeeezzzzz

thanks


Don Porter

unread,
Feb 3, 2003, 10:30:23 AM2/3/03
to
In article <FLv%9.232$1r4....@news.uswest.net>, Mel wrote:
> is fastCGI.tcl up-to-date with new tcl versions?
>
> when i do "package require cgi;package require Fcgi" i get the error
> "invalid command gets" !!

Please cut and paste the whole stack trace. (Find it as the value
of the global variable ::errorInfo).

--
| Don Porter Mathematical and Computational Sciences Division |
| donald...@nist.gov Information Technology Laboratory |
| http://math.nist.gov/~DPorter/ NIST |
|______________________________________________________________________|

Tom Poindexter

unread,
Feb 3, 2003, 1:36:27 PM2/3/03
to


Unfortunately, I haven't been able to keep up with Fcgi.tcl. Here is a
patch that might work, gleaned from an old post. You'll have to manually
edit the fcgi.tcl file to get it working.

Good luck.


>Hello,
>
>yesterday I downloaded the FastCGI package from Tom Poindexter. But
>whenever I tried to include it into a TCL program, I only got two
>error messages:
>
>invalid command name "puts"
>invalid command name "gets"
>

The problem is in Tcl's 'auto_import' procedure, introduced in Tcl 8.0.3.
I have a work-around, which is to rename the auto_import procedure while
the commands are imported. Here's a snippet of code that should get you
going:

fcgi.tcl line 1040:

# export application interfacess and stdio wrapper commands
namespace export FCGI_Accept FCGI_Finish FCGI_SetExitStatus \
FCGI_StartFilterData FCGI_SetBufSize
namespace export gets read flush puts eof

} ;# end of namespace eval fcgi


# Tcl 8.0.3 introduces 'auto_import' which blows the hell out of
# our stdio renaming scheme; disable the auto_import command while importing
# our namespace commands.

catch {auto_import}
if {[string length [info commands auto_import]] > 0} {
rename auto_import FCGI_auto_import_
}

# make the application use fcgi wrappers for these io commands
namespace import -force fcgi::gets
namespace import -force fcgi::read
mespace import -force fcgi::flush
namespace import -force fcgi::puts
namespace import -force fcgi::eof

# import the application fcgi commands
namespace import fcgi::FCGI_Accept
namespace import fcgi::FCGI_Finish
namespace import fcgi::FCGI_SetExitStatus
namespace import fcgi::FCGI_StartFilterData
namespace import fcgi::FCGI_SetBufSize


# undo the auto_import bugfix
if {[string length [info commands FCGI_auto_import_]] > 0} {
rename FCGI_auto_import_ auto_import
}


# finis


--
Tom Poindexter
tpoi...@nyx.net
http://www.nyx.net/~tpoindex/

John Sequeira

unread,
Feb 4, 2003, 10:24:23 AM2/4/03
to
Mel,

I'm currently working on a FastCGI port of OpenACS - a tcl web dev.
framework built on AOLServer.

It's working well with Apache/mod_fcgi, but I ran into the same
problem as you.

My solution (a variant on Tom's, but a bit more hackish?) was to use

interp alias {} gets {} fcgi::gets
interp alias {} read {} fcgi::read

instead of

namespace import -force fcgi::gets
namespace import -force fcgi::read


Then it works pretty well for FastCGIExternalServer (where you specify
a port and manually launch interpreter instances.).

i.e. ( in Apache httpd.conf )

Alias /fcgi/ "/Apache/fcgi/"
<Directory /Apache/fcgi>
SetHandler fastcgi-script
Allow from all
Options ExecCGI
</Directory>

FastCgiExternalServer /Apache/fcgi/openacs.tcls -host
192.168.101.94:8999

I'd be very interested in hearing if you get dynamic servers working.
I've tried both Windows and RH8, Apache 1.3 & 2.x, FastCGI/plain tcl
and FastCGI/tcl+c extension (which I couldn't get to build) but no
luck so far. There's a new release of FastCGI that could have fixed
some of the issues I was having, so I'm going to give it another
shot. If you get there first, *please* let me know.


Thanks,

John Sequeira
joh...@pobox.com
http://www.pobox.com/~johnseq/projects/portable.nsd


p.s. Tom - thanks so much for this library.

tpoi...@nyx.net (Tom Poindexter) wrote in message news:<10442973...@irys.nyx.net>...

Tom Poindexter

unread,
Feb 4, 2003, 1:05:47 PM2/4/03
to
In article <94aaee82.03020...@posting.google.com>,
John Sequeira <john...@hotmail.com> wrote:


>My solution (a variant on Tom's, but a bit more hackish?) was to use
>
>interp alias {} gets {} fcgi::gets
>interp alias {} read {} fcgi::read
>
>instead of
>
>namespace import -force fcgi::gets
>namespace import -force fcgi::read


Using interp looks find to me, and more importantly, works as well as my
temporary renaming of auto_import.


>http://www.pobox.com/~johnseq/projects/portable.nsd
>
>
>p.s. Tom - thanks so much for this library.

You're welcome, and nice work to you and Michael on the portable.nsd project.

0 new messages