Re: [AOLSERVER] ns_getform/form.tcl change

2002-11-24 Thread Jim Wilcoxson
I posted a change yesterday to form.tcl, the purpose being to ensure
that temp files got deleted if the upload is aborted.  But I goofed
and changed ns_atclose to unlink; not good.

Here is another diff.  The idea is to unlink the main temp file right
after creating it, before ns_conncptofp has a chance to abort, and
register the "atclose" unlink commands right after the individual temp
files are opened.

Jim

*** form.tcl.aolTue Aug  1 13:36:17 2000
--- form.tclSun Nov 24 08:52:55 2002
***
*** 119,120 
--- 119,121 
}
+   ns_unlink $tmpfile
ns_conncptofp $fp
***
*** 123,125 
close $fp
-   ns_unlink $tmpfile
}
--- 124,125 
***
*** 201,202 
--- 201,203 
}
+   ns_atclose "ns_unlink -nocomplain $tmpfile"

***
*** 207,213 

-   ns_atclose "ns_unlink -nocomplain $tmpfile"
-
close $tmp
seek $fp $end
!   ns_set put $form $name.tmpfile $tmpfile

--- 208,212 

close $tmp
seek $fp $end
!   ns_set update $form $name.tmpfile $tmpfile

[jim /home/nsadmin/modules/tcl]$ sum form.tcl.aol
13540 7



[AOLSERVER] ns_getform/form.tcl change

2002-11-23 Thread Jim Wilcoxson
During file uploads with mime/multipart, we've noticed that if a user aborts
an upload, the temp files hang around.  Here's a patch to modules/tcl/form.tcl
that fixes this problem by unlinking the temp files immediately after they
are created.  This works on Unix, but may not be portable on other platforms.

IMO, there is still an outstanding problem where ns_getform returns
Error: Success, but I've never figured that one out.  Probably EAGAIN
happening or something...

Jim


$ diff -c1 form.tcl newform.tcl
*** form.tclSat Nov 23 19:02:26 2002
--- newform.tcl Sat Nov 23 19:11:38 2002
***
*** 119,120 
--- 119,121 
}
+   ns_unlink $tmpfile
ns_conncptofp $fp
***
*** 123,125 
close $fp
-   ns_unlink $tmpfile
}
--- 124,125 
***
*** 201,202 
--- 201,203 
}
+   ns_unlink -nocomplain $tmpfile

***
*** 206,209 
}
-
-   ns_atclose "ns_unlink -nocomplain $tmpfile"