Index: openacs-4/packages/xotcl-core/tcl/bgdelivery-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-core/tcl/bgdelivery-procs.tcl,v diff -u -N -r1.50 -r1.51 --- openacs-4/packages/xotcl-core/tcl/bgdelivery-procs.tcl 7 Aug 2017 23:48:30 -0000 1.50 +++ openacs-4/packages/xotcl-core/tcl/bgdelivery-procs.tcl 7 Oct 2017 18:14:44 -0000 1.51 @@ -509,10 +509,20 @@ {-delete false} {-content_disposition} status_code mime_type filename} { + Deliver the given file to the requestor in the background. This proc uses the background delivery thread to send the file in an event-driven manner without blocking a request thread. This is especially important when large files are - requested over slow (e.g. dial-ip) connections. + requested over slow connections. + + With NaviServer, this function is mostly obsolete, at least, when + writer threads are configured. The writer threads have as well the + advantage, that these can be used with https, while the bgdelivery + thread works directly on the socket. + + One remaining purpose of this function is h264 streaming delivery + (when the module is in use). + } { #ns_setexpires 1000000 @@ -523,9 +533,11 @@ ::xo::ConnectionContext require } set query [::xo::cc actual_query] + set secure_conn_p [security::secure_conn_p] set use_h264 [expr {[string match "video/mp4*" $mime_type] && $query ne "" && ([string match {*start=[1-9]*} $query] || [string match {*end=[1-9]*} $query]) - && [info commands h264open] ne ""}] + && [info commands h264open] ne "" + && !$secure_conn_p }] if {[info commands ns_driversection] ne ""} { set use_writerThread [ns_config [ns_driversection] writerthreads 0] @@ -538,6 +550,15 @@ ns_set put [ns_conn outputheaders] Content-Disposition "attachment;filename=\"$fn\"" } + if {$secure_conn_p && !$use_writerThread} { + # + # The bgdelivery thread does not work over https, so fall back + # to ns_returnfile. The writer thread works fine with https. + # + ns_returnfile $status_code $mime_type $filename + return + } + if {$use_h264} { if {0} { # we have to obtain the size from the file; unfortunately, this