R
Robert Klemme
<snip>totally reasonable stuff</snip>
That sums it up very nicely!
Kind regards
robert
That sums it up very nicely!
Kind regards
robert
Time to make it make sense.
Thought's this was intersting. On Matz's blog there was this snippet:
require 'cgi'
require 'fcgi.so'
class CGI
class Fast < CGI
CONTINUATION = []
def Fast::new(*args)
at_exit do
if CONTINUATION[0]
CONTINUATION[0].call
end
end
callcc do |c|
CONTINUATION[0] = c
end
fcgi = FCGI::accept
unless fcgi CONTINUATION[0] = nil
exit
end
$defout = fcgi.out super(*args)
end
end
end
Does that make sense? Here's what matz says about it:
<quote>
About how to make correction of the existing CGI program minimum and
make it
FastCGI correspondence
Before, such a trick has been written.
[ above code here ]
I change "require'cgi'" into "require'fcgi'" and think that remarkable
CGI
will operate as it is only by rewriting "CGI.new" to "CGI::Fast.new."
</quote>
T.
Hi,
In message "fastcgi & continuations (Re: Idea: Webshare)"
on Tue, 31 Aug 2004 15:14:29 +0900, Patrick May
|I wasn't able to make this continuation trick work for me. It flip
|flops -- it works the first time, crashes the second time, then
|mod_fastcgi restarts the process and the cycle repeats.
|
|I wish I could make these continuations work, though.
Need more info. Operating system, interpreter version, Apache version
etc.
Let me throw you a wrinkle to think about.
File uploads. If you adopt a model where you are passing a request
object
to the webapp, and the webapp may not even be on the same machine as
the
webserver, what is the best way to handle uploaded files?
You can't just create a tempfile like the current CGI does. Do you
transfer
the data with the request, but then write it to tempfiles on the other
side? Does Drb provide a way that one could write the uploaded files
to
tempfiles on the server, but that one could access the tempfiles via
the
request object in the webapp? Could be cool. Might be a bad idea.
sform = Request.Form('var') // overrides Url
surl = Request.Url('var') //asp uses querystring..too long
Session('var') = surl //cant remember how to do that in ruby but it
aint clean.
//out
Response.Write(Session('var'))//puts works but this is more readable
This seems to be a powerpc bug. Here is a more simple example:
continuation = []
at_exit{
puts 'at_exit'
continuation[0].call unless continuation[0].nil?
}
callcc{ |c|
continuation[0] = c
}
puts 'running'
This code runs in the expected continuous loop on linux. On my mac
(10.2) I get the error:
[~/programming/narf] patsplat% ruby bug.rb
running
at_exit
running
bug.rb:9: compile error (SyntaxError)
bug.rb:9: [BUG] Bus Error
ruby 1.8.1 (2003-12-25) [powerpc-darwin]
Abort
[~/programming/narf] patsplat%
Does this happen on any other platform? Is this an OS X limitation?
Cheers,
Patrick
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.