<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://panoptic.com/mediawiki/aolserver/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Jcaruso</id>
	<title>AOLserver Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://panoptic.com/mediawiki/aolserver/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Jcaruso"/>
	<link rel="alternate" type="text/html" href="https://panoptic.com/wiki/aolserver/Special:Contributions/Jcaruso"/>
	<updated>2026-04-08T22:25:23Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.34.2</generator>
	<entry>
		<id>https://panoptic.com/mediawiki/aolserver/index.php?title=Ns_returnfile&amp;diff=5158</id>
		<title>Ns returnfile</title>
		<link rel="alternate" type="text/html" href="https://panoptic.com/mediawiki/aolserver/index.php?title=Ns_returnfile&amp;diff=5158"/>
		<updated>2008-08-20T00:55:12Z</updated>

		<summary type="html">&lt;p&gt;Jcaruso: Minor clarification.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; ns_returnfile 200 &amp;quot;application/zip&amp;quot; $filepath&lt;br /&gt;
 ns_returnfile 200 [ns_guesstype $file] $filepath&lt;br /&gt;
&lt;br /&gt;
==== Caveat programmor ====&lt;br /&gt;
&lt;br /&gt;
ns_returnfile uses [[fastpath]] caching internally, and fastpath caching may fail to distinguish between two files on the same filesystem which have the same inode, mtime, and size (serving one file in lieu of the other).  This can happen if a file is generated, returned to the user, and then deleted.  For example, in the following sample code the second call to ns_returnfile will return /var/tmp/myfile rather than /var/tmp/myotherfile:&lt;br /&gt;
&lt;br /&gt;
 set file [open &amp;quot;/var/tmp/myfile&amp;quot; &amp;quot;w&amp;quot;]&lt;br /&gt;
 puts $file &amp;quot;ABC123&amp;quot;&lt;br /&gt;
 close $file&lt;br /&gt;
 ns_returnfile 200 text/plain &amp;quot;/var/tmp/myfile&amp;quot;&lt;br /&gt;
 ns_unlink -nocomplain &amp;quot;/var/tmp/myfile&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 set file [open &amp;quot;/var/tmp/myotherfile&amp;quot; &amp;quot;w&amp;quot;]&lt;br /&gt;
 puts $file &amp;quot;XYZ987&amp;quot;&lt;br /&gt;
 close $file&lt;br /&gt;
 ns_returnfile 200 text/plain &amp;quot;/var/tmp/myotherfile&amp;quot;&lt;br /&gt;
 ns_unlink -nocomplain &amp;quot;/var/tmp/myotherfile&amp;quot;&lt;br /&gt;
&lt;br /&gt;
When returning &amp;quot;dynamic&amp;quot; file data like this, a safer practice would be to use [[ns_return]] or ns_returnfp instead (since they don't use fastpath caching).  For example:&lt;br /&gt;
&lt;br /&gt;
 set fd [open $myfile]&lt;br /&gt;
 ns_return 200 [ns_guesstype $myfile] [read $fd]&lt;br /&gt;
 close $fd&lt;br /&gt;
&lt;br /&gt;
==== Want to name the file returned? ====&lt;br /&gt;
&lt;br /&gt;
ns_set update [ns_conn outputheaders] content-disposition &amp;quot;attachment; filename=1.abc&amp;quot;&lt;/div&gt;</summary>
		<author><name>Jcaruso</name></author>
		
	</entry>
	<entry>
		<id>https://panoptic.com/mediawiki/aolserver/index.php?title=Ns_returnfile&amp;diff=5157</id>
		<title>Ns returnfile</title>
		<link rel="alternate" type="text/html" href="https://panoptic.com/mediawiki/aolserver/index.php?title=Ns_returnfile&amp;diff=5157"/>
		<updated>2008-08-19T23:07:32Z</updated>

		<summary type="html">&lt;p&gt;Jcaruso: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; ns_returnfile 200 &amp;quot;application/zip&amp;quot; $filepath&lt;br /&gt;
 ns_returnfile 200 [ns_guesstype $file] $filepath&lt;br /&gt;
&lt;br /&gt;
==== Caveat programmor ====&lt;br /&gt;
&lt;br /&gt;
ns_returnfile uses [[fastpath]] caching internally, and fastpath caching may fail to distinguish between two files on the same filesystem which have the same inode, mtime, and size (serving one file in lieu of the other).  This can happen if a file is generated, returned to the user, and then deleted.  For example, in the following sample code the second call to ns_returnfile will return /var/tmp/myfile rather than /var/tmp/myotherfile:&lt;br /&gt;
&lt;br /&gt;
 set file [open &amp;quot;/var/tmp/myfile&amp;quot; &amp;quot;w&amp;quot;]&lt;br /&gt;
 puts $file &amp;quot;ABC123&amp;quot;&lt;br /&gt;
 close $file&lt;br /&gt;
 ns_returnfile 200 text/plain &amp;quot;/var/tmp/myfile&amp;quot;&lt;br /&gt;
 ns_unlink -nocomplain &amp;quot;/var/tmp/myfile&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 set file [open &amp;quot;/var/tmp/myotherfile&amp;quot; &amp;quot;w&amp;quot;]&lt;br /&gt;
 puts $file &amp;quot;XYZ987&amp;quot;&lt;br /&gt;
 close $file&lt;br /&gt;
 ns_returnfile 200 text/plain &amp;quot;/var/tmp/myotherfile&amp;quot;&lt;br /&gt;
 ns_unlink -nocomplain &amp;quot;/var/tmp/myotherfile&amp;quot;&lt;br /&gt;
&lt;br /&gt;
When returning &amp;quot;dynamic&amp;quot; file data like this, a safer practice would be to use [[ns_return]] or ns_returnfp instead.  For example:&lt;br /&gt;
&lt;br /&gt;
 set fd [open $myfile]&lt;br /&gt;
 ns_return 200 [ns_guesstype $myfile] [read $fd]&lt;br /&gt;
 close $fd&lt;br /&gt;
&lt;br /&gt;
==== Want to name the file returned? ====&lt;br /&gt;
&lt;br /&gt;
ns_set update [ns_conn outputheaders] content-disposition &amp;quot;attachment; filename=1.abc&amp;quot;&lt;/div&gt;</summary>
		<author><name>Jcaruso</name></author>
		
	</entry>
	<entry>
		<id>https://panoptic.com/mediawiki/aolserver/index.php?title=Ns_returnfile&amp;diff=5156</id>
		<title>Ns returnfile</title>
		<link rel="alternate" type="text/html" href="https://panoptic.com/mediawiki/aolserver/index.php?title=Ns_returnfile&amp;diff=5156"/>
		<updated>2008-08-19T23:05:58Z</updated>

		<summary type="html">&lt;p&gt;Jcaruso: Added a clearer explanation of the fastpath caching issue&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; ns_returnfile 200 &amp;quot;application/zip&amp;quot; $filepath&lt;br /&gt;
 ns_returnfile 200 [ns_guesstype $file] $filepath&lt;br /&gt;
&lt;br /&gt;
==== Caveat programmor ====&lt;br /&gt;
&lt;br /&gt;
ns_returnfile uses [[fastpath]] caching internally, and fastpath caching may fail to distinguish between two files on the same filesystem which have the same inode, mtime, and size (serving one file in lieu of the other).  This can happen if a file is generated, returned to the user, and then deleted.  For example, in the following sample code the second call to ns_returnfile will return /var/tmp/myfile rather than /var/tmp/myotherfile:&lt;br /&gt;
&lt;br /&gt;
 set file [open &amp;quot;/var/tmp/myfile&amp;quot; &amp;quot;w&amp;quot;]&lt;br /&gt;
 puts $file &amp;quot;ABC123&amp;quot;&lt;br /&gt;
 close $file&lt;br /&gt;
 ns_returnfile 200 text/plain &amp;quot;/var/tmp/myfile&amp;quot;&lt;br /&gt;
 ns_unlink -nocomplain &amp;quot;/var/tmp/myfile&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 set file [open &amp;quot;/var/tmp/myotherfile&amp;quot; &amp;quot;w&amp;quot;]&lt;br /&gt;
 puts $file &amp;quot;XYZ987&amp;quot;&lt;br /&gt;
 close $file&lt;br /&gt;
 ns_returnfile 200 text/plain &amp;quot;/var/tmp/myotherfile&amp;quot;&lt;br /&gt;
 ns_unlink -nocomplain &amp;quot;/var/tmp/myotherfile&amp;quot;&lt;br /&gt;
&lt;br /&gt;
When returning &amp;quot;dynamic&amp;quot; file data like this, a safer practice would be to use [[ns_return]] or ns_returnfp instead.  For example:&lt;br /&gt;
&lt;br /&gt;
 set fd [open $myfile]&lt;br /&gt;
 ns_unlink $myfile; # So that nothing else can access the file from the filesystem&lt;br /&gt;
 ns_return 200 [ns_guesstype $myfile] [read $fd]&lt;br /&gt;
 close $fd&lt;br /&gt;
&lt;br /&gt;
==== Want to name the file returned? ====&lt;br /&gt;
&lt;br /&gt;
ns_set update [ns_conn outputheaders] content-disposition &amp;quot;attachment; filename=1.abc&amp;quot;&lt;/div&gt;</summary>
		<author><name>Jcaruso</name></author>
		
	</entry>
</feed>