There is an Httpd_Suspend call that mostly just turns off the
fileevents on the socket. If you call that and then return from
your domain handler, then the request will just hang around until
you ultimately call Httpd_ReturnData or Httpd_ReturnFile.
Unfortunately, the standard domain handers don't have any protocol
that understands this. One idea is to use a special error code,
much like the "HTTPD_REDIRECT" error code used to trigger page requests.
Assume you set up some event that will complete your page,
suppose you could
return -code error -errorCode HTTPD_SUSPEND
to unwind the current page. Then, augment the back-stop in Url_Dispatch
to understand this error code and call Httpd_Suspend, and it might work nicely.
I'll append a patch, but take it with a grain of salt - not much testing
has been done on it.
>>>"John Buckman" said:
> We're completing our own Tcl-to-SQL library, and have the opportunity of
> implementing the SQL library with async-calls.
>
> So, for example, a SQL select query would have some --code "..." associated
> with it, that runs once the SQL select query completes
>
> The reason I bring this up here, is that instead of using multithreading
> inside TclHttpd, we'd prefer to use the single-threaded version of
> TclHttpd, and pages that render asynchronously, when the operation
> completes. I have some ideas on how I could hack TclHttpd to do this, but
> I'm wondering (Brent?) if there could be a standard mechanism for doing
> this. Perhaps one could register a page as "unfinished" and then call a
> "finisher" proc once the page was available.
>
> --
>
> About our TclDBTools library:
>
> We're using Rogue Wave's DBTools library (a commercial C++ library
> (www.roguewave.com), and it will support Oracle, ODBC, Microsoft-SQL,
> Sybase, DB2 & Informix, all native, on both Unix and Windows. We're going
> to make the library open-source and available to all, in a few weeks.
>
>
>
-- Brent Welch <[EMAIL PROTECTED]>
http://www.ajubasolutions.com
Scriptics changes to Ajuba Solutions
scriptics.com => ajubasolutions.com
Index: url.tcl
===================================================================
RCS file: /home/cvs/external/tclhttpd/lib/url.tcl,v
retrieving revision 1.27
diff -c -r1.27 url.tcl
*** url.tcl 2000/05/19 06:45:51 1.27
--- url.tcl 2000/07/24 22:23:15
***************
*** 160,174 ****
proc Url_Unwind {sock ei ec} {
! # URL implementations can raise an error and put redirect info
! # into the errorCode variable, which should be of the form
! # HTTPD_REDIRECT $newurl
set key [lindex $ec 0]
set error [lindex [split $ei \n] 0]
! if {[string match HTTPD_REDIRECT $key]} {
! Httpd_Redirect [lindex $ec 1] $sock
! return
}
switch -glob -- $ei {
--- 160,186 ----
proc Url_Unwind {sock ei ec} {
! # URL implementations can raise special errors to unwind their processing.
set key [lindex $ec 0]
set error [lindex [split $ei \n] 0]
! switch -- $key {
! HTTPD_REDIRECT {
!
! # URL implementations can raise an error and put redirect info
! # into the errorCode variable, which should be of the form
! # HTTPD_REDIRECT $newurl
!
! Httpd_Redirect [lindex $ec 1] $sock
! return
! }
! HTTPD_SUSPEND {
!
! # The domain handler has until Httpd(timeout2) to complete this request
!
! Httpd_Suspend $sock
! return
! }
}
switch -glob -- $ei {