change or bug?

3 posts Page 1 of 1
Snarfster
Junior Member
Posts: 2
Joined: 06 Feb 2007, 12:49


not sure what changed but used to be able to download .exe files from explorer when clicking on file name OR right click on file name then choose save target as...

now I get this when clicking on file...
[url]https://xxx.xx.xxx.xxx:xxxx/cgi/addon_cse.cgi?do=view&p=/home/bob/tester&f=snarfer.0.7.2.exe#new[/url]

and it opens a window with file as a text file

OR

right-click method brings up file name/type as addon_cse.htm

thoughts? thanks much.
matteo
Junior Member
Posts: 4
Joined: 15 Apr 2007, 13:15


It seems a bug to me.
Find below the way I fixed it:
Code: Select all
$ diff -u addon_cse.cgi.orig addon_cse.cgi
--- addon_cse.cgi.orig     2007-01-08 10:12:10.000000000 +0100
+++ addon_cse.cgi       2007-04-15 14:10:45.392933920 +0200
@@ -14,7 +14,7 @@
 require 'parseform.pl';

 if (!$ACL{all}) {
-       print "Content-type: text/html\r\n\r\n";
+       print "Content-type: text/html\n\n";
        print "You do not have access to access the ConfigServer Explorer.\n";
        exit;
 }
@@ -24,8 +24,6 @@

 my %form = parseform();

-print "Content-type: text/html\r\n\r\n";
-
 $webpath = '/';
 $script = 'addon_cse.cgi';
 $demo = 0;
@@ -35,9 +33,11 @@
        exit;
 }
 elsif ($form{do} eq "console") {
+       print "Content-type: text/html\n\n";
        defheader("ConfigServer Explorer Console Command Output");
 }
 else {
+       print "Content-type: text/html\n\n";
        defheader("ConfigServer Explorer");
 }

@@ -771,8 +771,8 @@
 my @data = <IN>;
 close (IN);

-print STDOUT "content-type: application/octet-stream\n";
-print STDOUT "content-disposition: inline; filename=$form{f}\n\n";
+print STDOUT "Content-type: application/octet-stream\n";
+print STDOUT "Content-disposition: inline; filename=$form{f}\n\n";
 binmode (STDOUT);
 print STDOUT @data;
HTH,
Matteo
matteo
Junior Member
Posts: 4
Joined: 15 Apr 2007, 13:15


Here is the previous patch proposal plus Content-size header to help browser progress bar:
Code: Select all
$ diff -u addon_cse.cgi.orig addon_cse.cgi
--- addon_cse.cgi.orig     2007-01-08 10:12:10.000000000 +0100
+++ addon_cse.cgi       2007-04-15 14:55:18.994484704 +0200
@@ -14,7 +14,7 @@
 require 'parseform.pl';

 if (!$ACL{all}) {
-       print "Content-type: text/html\r\n\r\n";
+       print "Content-type: text/html\n\n";
        print "You do not have access to access the ConfigServer Explorer.\n";
        exit;
 }
@@ -24,8 +24,6 @@

 my %form = parseform();

-print "Content-type: text/html\r\n\r\n";
-
 $webpath = '/';
 $script = 'addon_cse.cgi';
 $demo = 0;
@@ -35,9 +33,11 @@
        exit;
 }
 elsif ($form{do} eq "console") {
+       print "Content-type: text/html\n\n";
        defheader("ConfigServer Explorer Console Command Output");
 }
 else {
+       print "Content-type: text/html\n\n";
        defheader("ConfigServer Explorer");
 }

@@ -766,13 +766,16 @@
 # start view
 sub view {

-open (IN, "<$webpath$form{p}/$form{f}") or die $!;
+my $file = "$webpath$form{p}/$form{f}";
+open (IN, "< $file") or die $!;
+my $size = (-s "$file");
 binmode (IN);
 my @data = <IN>;
 close (IN);

-print STDOUT "content-type: application/octet-stream\n";
-print STDOUT "content-disposition: inline; filename=$form{f}\n\n";
+print STDOUT "Content-type: application/octet-stream\n";
+print STDOUT "Content-length: $size\n";
+print STDOUT "Content-disposition: inline; filename=$form{f}\n\n";
 binmode (STDOUT);
 print STDOUT @data;
3 posts Page 1 of 1