Forum OpenACS Q&A: Images getting lost with ns_returnfile on Win


did anyone ever experience this behaviour: On subsequent pages with lots of images presented by ns_returnfile images get lost.

Example: I have 10 images per page and go on with hitting a "next" button. After about 20-30 images more and more images are not rendered until no images at all are rendered. This is on Win machines and IE and Opera. NS only sometimes.

Could this be related somehow to keepalive problems?

Posted by Don Baccus on
It could ... are there any errors in the log?  Normally when a socket is dropped on a file upload such as this an error is returned to AOLserver and it dutifully logs it.
Nothing in the logs. Only my own statements before and after the ns_returnfile command.

I did it like this:

img src="returnimg.tcl"
(10 times on a page)

the returnimg.tcl simply calls ns_returnfile.

The browser gets so confused it gets also in trouble with other images once the problems begin.

Really strange behaviour!

Posted by Andrei Popov on
My experience shows that *any* binary file stored in OpenACS (3.2.5, 4.x) when running on Windows gets totally messed up and is never properly returned.  I've tried to find out why, to no avail: it does get properly stored in database, but somewhere between a SELECT and an ns_return things go haywire...
Posted by David Walker on
ns_return cannot return binary content without a patch to aolserver.
ns_returnfile should return binary content fine on any aolserver.

Do you have a page I could visit to see this happening?

I'm sorry, this is not yet a site connected to the Internet.

But I used Ethereal to view the page headers sent between the client and AOLserver.

It seems like Opera and IE both send "If-Modified-Since" Keys and AOLserver responds happily with "304 Not Modified" but only Opera renders the images then.
Maybe this path is worth investigating on.

I first thought the problem is related with a "max-age" key (of 3600 seconds) I'm returning in the header with the file as AOLserver itself returns also a "Last-Modified-Since" and maybe the two keys conflict (Unexcusable non-reading of Cache/Proxy Documentation on my part...). Strange thing.

Do you know where to start/tweak configs to FORCE the server to never respond with a L-M-S key? I'll try to overwrite this in my script now but I'll guess it happens somewhere else.

Also interesting: The Browser Icon indicating that it loads/waits for objects always turns around in IE. So it seems to wait forever for the images.
Ok, I know more:

I have to ns_set idelkey [ns_conn headers] "Last-Modified" to force ns_returnfile to not ignore the status code of "200" I call it with. When I do it, Int. Explorer always receives the images with ns_returnfile - I validated this with Ethereal.

BUT! this §&$&§& IE does not render them.

I give up. Never try to understand your computer.

Posted by David Walker on
What other headers were being returned besides Last-Modified?
The following looks pretty normal. As I said, the problem only starts to occurr the second or third page (with 10 images per page). Request with Internet Explorer 6.0:
GET /images/img.adp?img_id=171

Accept: */*

Referer: http://intra:8000/people/col1/browse.adp?step=30

Accept-Language: en

Accept-Encoding: gzip, deflate

User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows 98)

Host: intra:8000

Connection: Keep-Alive

Answer AOLserver to Internet Explorer 6.0:

HTTP/1.0 200 OK

Cache-control: max-age=3600

Last-Modified: Sat, 13 Apr 2002 10:14:37 GMT

MIME-Version: 1.0

Date: Tue, 25 Jun 2002 15:03:14 GMT

Server: AOLserver/3.4

Content-Type: image/jpeg

Content-Length: 13129

Connection: keep-alive

(Image is not rendered)

Request with Opera 6.0:

GET /images/img.adp?img_id=173

User-Agent: Mozilla/4.0 (compatible; MSIE 5.0; Windows 98) Opera 6.0

Accept: text/html, image/png, image/jpeg, image/gif, image/x-xbitmap, //*/*

Accept-Language: en

Accept-Encoding: defalte, gzip, x-gzip, identity, *;q=0

Referer: http://intra:8000/people/col1/browse.adp?step=30

If-Modified-Since: Mon, 22 Apr 2002 08:06:42 GMT

Host: intra:8000

Connection: Keep-Alive, TE

TE: deflate, gzip, chunked, identity, trailers

Answer AOLserver to Opera 6.0:

HTTP/1.0 304 Not Modified

Cache-control: max-age=3600

Last-Modified: Mon, 22 Apr 2002 08:06:42 GMT

MIME-Version: 1.0

Date: Tue, 25 Jun 2002 15:17:33 GMT

Server: AOLserver/3.4

Connection: close

(Image is rendered, in general, I have no problem with Opera or Netscape or ...)
I got the same problem here. Does anybody knows a fix ?

My site is at

I have finaly found that my problem was with the images file themself !