View Full Version : CGI's can't be downloaded
estratos
02-06-2009, 01:14 AM
I've placed some binary CGI files into a directory of my web server (outside cgi-bin) for download. The problem is that when I try to download the CGI's with wget, these CGI's seem to be executed by the server instead of being served as simple files.
Is there a way of disabling the execution of CGI's from a given directory in my web server?
Thanks in advance,
Daniel.
Treeluvin
02-06-2009, 02:16 AM
Add this line a .htaccess file in the directory of your cgi scripts
Options -ExecCGI
estratos
02-06-2009, 02:35 AM
Thanks Treeluvin.
After creating .htaccess, I get this new error when I try to download any of the cgi's:
HTTP request sent, awaiting response... 403 Forbidden
10:31:56 ERROR 403: Forbidden.
... this seems to be more complicated than I thought...
Daniel.
siguie
02-06-2009, 03:25 AM
What do you mean by "binary" cgi's? If you name a file xxxx.cgi it will probably be interpreted as a perl script since .cgi and.pl are often used interchangeably. Oh and that would not be a binary file ... just a Common Gateway Interface type file.
Are you talking about cgi video files?
estratos
02-06-2009, 03:39 AM
Thanks Siguie for your reply.
With "binary" I mean that the CGI's are C-compiled, not Perl or PHP. Moreover, the cgi's can't be run on X86 platforms as they were developed for an embedded system. As you can imagine, I'm just trying to setup a very simple repository of files.
Thanks again,
Daniel.
felgall
02-06-2009, 01:01 PM
Have you thought of zipping the files and uploading the zipped versions. They would then be able to be downloaded and unzipped without any confusion attempting to run them.
estratos
02-06-2009, 03:08 PM
Thanks Stephen.
That's what I did for other projects but, for this one, the embedded platform that should download the files has no way to unzip them. Anyway, changing the file extension does the trick. This is not an elegant solution but it's the only one I can imagine so far.
Thanks guys for your help.
Daniel.
siguie
02-07-2009, 03:42 AM
Well you may want to try removing cgi from "Apache Handlers" and "Mime Types" in CPanel. I've never tried this BUT if the system doesn't know what to do with the .cgi extension it may let you download the file.
Just a thought ... and to be honest I can't imagine it being a very good one :rolleyes: but now I want to see if it works :cool:
felgall
02-07-2009, 12:40 PM
You could use PHP to serve the files and add a content-disposition:attachment header
Treeluvin
02-08-2009, 08:21 AM
Sorry estratos, I completely missed what you were trying to accomplish. :(
You could add something like this to your .htaccess file, replacing 'cgi' with whatever extension you're using for your CGI scripts
AddHandler server-parsed cgi
AddType text/plain cgi
Which would display your code like a normal text file.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.