I have a cgi script that sends a pdf to the browser (content type application/pdf). It simply writes headers, then copies a pdf file to the response (STDOUT). It then takes a few additional actions (audit logging to a file or another HTTP server).

This script has worked fine with apache and earlier versions of IIS.

With the move to IIS 6 on windows 2003, the actions after the file copy no longer take place. A lot of experimentation led to the following observation. If I delay copying the final newline of the PDF file to STDOUT until after the audit action, the script completes properly. If I move the copying of the final newline before the audit action, the audit action doesn't complete. (Note that I close the input pdf file before the audit action in both cases).

This is very mysterious. How can IIS or the browser know that the final newline is special? It appears that the browser closes the connection when the download is complete and this causes IIS to terminate the CGI script. However, I've tried a 'print STDOUT "\n";' rather than taking the last byte from the PDF library and get the same effect. So it can't be that some sort of end of file mark is being sent.

It is also not a matter of acrobat saying that the file is complete, because the same thing happens when I ask firefox to open the file with notepad.

Any help would be appreciated.

Thanks in advance
Horace


The perl version is:

This is perl, v5.6.1 built for MSWin32-x86-multi-thread
(with 1 registered patch, see perl -V for more detail)

Copyright 1987-2001, Larry Wall

Binary build 628 provided by ActiveState Tool Corp.
http://www.ActiveState.com
Built 15:41:05 Jul  4 2001

_______________________________________________
Perl-Win32-Web mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to