Changeset 466 for trunk/gui/scripts


Ignore:
Timestamp:
Jun 8, 2006 4:09:31 PM (18 years ago)
Author:
mmc
Message:

Fixed the filexfer server so that it doesn't complain when a transfer
is stopped mid stream. This happens when a large file is being
transferred and the user closes his web browser.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/scripts/filexfer.tcl

    r413 r466  
    698698        set s [clock seconds]
    699699        set date [clock format $s -format {%a, %d %b %Y %H:%M:%S %Z}]
    700         puts $cid "Last-Modified: $date"
     700        catch { puts $cid "Last-Modified: $date" }
    701701        response $cid body -type text/html -string {<html>
    702702<head>
     
    871871            set s [clock seconds]
    872872            set date [clock format $s -format {%a, %d %b %Y %H:%M:%S %Z}]
    873             puts $cid [format "HTTP/1.1 %s
     873            catch {
     874                puts $cid [format "HTTP/1.1 %s
    874875Date: %s
    875876Server: Rappture
    876877Connection: %s" $params(-status) $date $params(-connection)]
     878            }
    877879        }
    878880
     
    889891                }
    890892            }
    891             puts $cid [format "Content-type: %s\nContent-length: %d\n" \
    892                 $params(-type) [string length $params(-string)]]
     893            catch {
     894                puts $cid [format "Content-type: %s\nContent-length: %d\n" \
     895                    $params(-type) [string length $params(-string)]]
     896            }
    893897
    894898            if {$mime2type($params(-type)) == "binary"} {
     
    896900                set olde [fconfigure $cid -encoding]
    897901                fconfigure $cid -buffering none -encoding binary
    898                 puts -nonewline $cid $params(-string)
    899                 flush $cid
     902                catch {
     903                    puts -nonewline $cid $params(-string)
     904                    flush $cid
     905                }
    900906                fconfigure $cid -buffering line -encoding $olde
    901907            } else {
    902908                # ascii data -- send normally
    903                 puts $cid $params(-string)
     909                catch {
     910                    puts $cid $params(-string)
     911                }
    904912            }
    905913        }
     
    976984                set s [file mtime $params(-path)]
    977985                set date [clock format $s -format {%a, %d %b %Y %H:%M:%S %Z}]
    978                 puts $cid "Last-Modified: $date"
     986                catch { puts $cid "Last-Modified: $date" }
    979987
    980988                response $cid body -type $mtype -string $data
Note: See TracChangeset for help on using the changeset viewer.