invalid command name "hgetvars"
    while executing
"hgetvars"
    (in namespace eval "::request" script line 3)
    invoked from within
"namespace eval ::request $script"
    ("::try" body line 12)

OUTPUT BUFFER:

puts -nonewline "" hgetvars if {![var exists b]} { headers numeric 400 puts "

Mailbox not specified.

" return } if {![var exists mid]} { headers numeric 400 puts "

Message-Id not specified.

" return } if {[catch {open /home/smirnov/Mail/$VARS(b)} F]} { headers numeric 404 puts -error "$VARS(b) $F" puts "

Could not open $VARS(b)

" return } set idfound 0 set inheader 0 while {[gets $F line] != -1} { if {$inheader} { switch -regexp -- $line { {***:(?i)^Message-Id: <} { regexp -nocase \ {Message-Id: <([^>]+)>} \ $line junk mid if {$mid == $VARS(mid)} { set idfound 1 } } {^$} { set inheader 0 } } } else { switch -regexp -- $line { {^From } { if $idfound break set full {} set inheader 1 } } } append full $line \n } close $F if {!$idfound} { headers numeric 404 puts "

Could not find ``$VARS(mid)'' in $VARS(b)

" return } if {[var exists text]} { # Output raw-text version of the message: headers set X-Misha text-only headers type text/plain puts $full return } set title $VARS(b) if {[regexp -nocase {\nSubject: *([^\n]+)\n} $full junk subject]} { append title ": $subject" } puts -nonewline " " puts $title puts -nonewline "
"

	set full [string map {< < > > @ @} $full]
	set refs [regexp -inline -nocase -indices -all \
	    {(In-Reply-To|References): +([^\n]+) *\n} $full]
	if {[var exists d]} {
		foreach e $refs {
			puts "``$e: [string range \
			   $full [lindex $e 0] [lindex $e 1]]''\n"
		}
	}
	set shift 0
	foreach {junk junk mids} $refs {
		set urls {}
		set begin [expr [lindex $mids 0] + $shift]
		set end [expr [lindex $mids 1] + $shift]
		foreach mid [split \
		    [string range $full $begin $end]] {
			# < and > are both of length 4:
			set mid [string range $mid 4 end-4]
			set mid [string map {@ @} $mid]
			# Some chars, which may be valid in Message-Id:
			# need escaping in a URL:
			set emid [string map {+ %2B $ %24 & %26} $mid]
			if {[var exists d]} {
				puts "Id: $mid\n"
			}
			regsub {mid=[^&]+} $ENVS(REQUEST_URI) "mid=$emid" url
			lappend urls "<$mid>"
		}
		set urls [join $urls]
		incr shift [expr [string length $urls] - $end + $begin - 1]
		incr begin -1
		incr end
		set full [string range $full 0 \
		    $begin]$urls[string range $full $end end]
	}
	if { [var exists d] && [ array exists ENVS ] } {
    
		puts ""
	}


puts -nonewline "
"

	#regsub {<([^\s>]{3,})>} $full {\<\1;\>} full

	puts $full

puts -nonewline "
"