- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Re: Counter for file download on perl
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-11-2008 04:24 AM
тАО12-11-2008 04:24 AM
Counter for file download on perl
http server WASD, all file are really present
and have RWED RWED RWED RWED.
This is simple perl code
-------------------------------------------
use VMS::Stdio qw( &flush &getname &remove &rewind &setdef &sync &tmpnam
&vmsopen &vmssysopen &waitfh &writeof );
my $file="vnc.zip";
my $fullpath="$file";
open E,">err.log";
$f = vmssysopen ("$file",O_RDONLY,0,"ctx=bin") or die $!;
close E;
print "Cache-control: no-cache\n";
print "Content-type: application/force-download\n";
print "Content-Length: ".(-s $fullpath)."\n";
print "Content-Disposition: attachment; filename=$file \n\n";
while (<$f>){print};close $f;
-------------------------------------------
WASD returns error 502
BUT!!
if I change $file="vnc.zip" to
$file="count.txt"
script allows me to save file. It is working!
What I'm doing wrong?
Please note - vnc.zip and count.txt are here and have full control
And one thing - $! is empty.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-11-2008 04:29 AM
тАО12-11-2008 04:29 AM
Re: Counter for file download on perl
What should it be: bug in perl, WASD or in my head ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-11-2008 04:59 AM
тАО12-11-2008 04:59 AM
Re: Counter for file download on perl
What is the perl version you are trying now? 5.10?
What are the file attributes for the wroking file and for the failing (zip) file? stream_lf? fixed/512?
Can you not run and evaluate the script outside a web server context, simply on a command line?
If that fails, try to get an IO trace going
1) SET WATCH FILE/CLA=MAJOR
or
2) Place the file on an LD device and enable trace.
hth,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-11-2008 05:06 AM
тАО12-11-2008 05:06 AM
Re: Counter for file download on perl
Ok, using DCL:
$write sys$output "Cache-control: no-cache"
$write sys$output "Content-type: application/force-download"
$write sys$output "Content-Length: 1024"
$write sys$output "Content-Disposition: attachment; filename=","vnc.zip"
$write sys$output ""
$!
$ type vnc.zip
File is downloded. But corrupted.
Ok, I've wrote a simple C utility that opens binary file and put it into out.
Not help.
Is it possible task to make download counter in WASD??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-11-2008 05:09 AM
тАО12-11-2008 05:09 AM
Re: Counter for file download on perl
>What are the file attributes for the wroking file and for the failing (zip) file? stream_lf? fixed/512?
fixed 512.
>Can you not run and evaluate the script outside a web server context, simply on a command line?
In command line, how I say, it works fine
Also it works fine on my Apache environment
PERL 5.8.0
WASD (do not know version)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-11-2008 06:00 AM
тАО12-11-2008 06:00 AM
Re: Counter for file download on perl
$FILE="DISK$USER_1:[ALEXEY.PUBLIC_HTML.CGI-BIN]VNC.ZIP"
$SHORT="VNC.ZIP"
$SIZE=F$FILE_ATTRIBUTES("''FILE'","EOF") * 512
$write sys$output "Cache-control: no-cache"
$write sys$output "Content-type: application/force-download"
$write sys$output "Content-Length: ",SIZE
$write sys$output "Content-Disposition: attachment; filename=",SHORT
$write sys$output ""
$!
$type 'FILE'
But I do not understand behavor of perl with WASD.
So any suggestion would be nice...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-11-2008 03:00 PM
тАО12-11-2008 03:00 PM
Re: Counter for file download on perl
$ perldoc -f sysread
Regarding changing the name from vnc.zip to count.txt, there is nothing in Perl I'm aware of that would treat a file differently based on file type, so that would have to be something in WASD and/or your browser.
As far as $! being empty, you only check it after the initial open, so anything involved in reading the file or writing data down the pipe could fail silently.
BTW, Perl 5.8.0 is pretty ancient. 5.8.8 is current with release candidates for 5.8.9 now circulating if you have a compelling reason to stay with 5.8.x. I'd recommend 5.10.0 or later for any serious new work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-12-2008 01:56 AM
тАО12-12-2008 01:56 AM
Re: Counter for file download on perl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-12-2008 02:14 PM
тАО12-12-2008 02:14 PM
Re: Counter for file download on perl
What version WASD are you running ?
$ mcr ht_exe:httpd_ssl /version
or
$ mcr ht_exe:httpd /version
if you did not include SSL support when you installed it.
Versions prior to v8.2.0 were a little more particular about getting a "Status:",
"Content-type:" or "Location:" CGI header before any others. If your WASD version is of that vintage shuffling the order of the response headers may help.
Also is your perl up-to-date...
$ perl -v
Your script appears to work correctly on WASD/9.3.0 and perl v5.8.6.
'No 502, just a save dialog'
(tested by someone else, I have WASD but not perl on my VMS box)
You may also get significant value from the integrated 'WATCH' facility
http://wasd.vsm.com.au/ht_root/doc/htd/htd_2000.html
Finally, there is an active user community using and supporting WASD. I suggest you look on the product homepage for an email address for Mark Daniels, and contact him directly.
JT:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-15-2008 05:14 AM
тАО12-15-2008 05:14 AM
Re: Counter for file download on perl
Wim