Htmlfixit download script (perl) won't work



I’ve used this perl script many times in the past with different hosts and never had trouble.

I am trying to install it on a site I have hosted with dreamhost and for the life of me I cannot get it to work.

I have read the kbase, tried all that. I don’t know what to do.

The error log shows “premature end of headers” I tried the kbase info supplied to fix that and that won’t work either.

I did notice the htmlfixit script is using taintmode, I don’t know if that’s the problem.

I am also not too familiar with ssh, telnet and the likes. I really only know FTP, so whatever I did try from the kbase I may have done it wrong.

My test page is here.

I really need help with this, I don’t know what to do and I really need to get it working. I don’t want to have to switch hosts, but I love using this script to manage my downloads and keep track of things for me.



You may have to use shell to debug the situation.

  1. Edit the script
  2. Find the first line that says:

require "$path_to_lib/";3. Before that line, add this line:

BEGIN { print "Content-Type: text/plain\n\n"; }Then try to download the file, and you might see an error message from Perl. Once the error is fixed, the download link will show HTTP headers followed by the file contents until you remove the line above.

:cool: Perl / MySQL / HTML+CSS


Thanks for the help Atropos7.

I tried that and don’t see any new errors or anything different.

The error is:
failed to open log file
fopen: Permission denied
[Thu Nov 17 15:54:04 2005] [error] [client] Premature end of script headers: /home/mystica1/
[Thu Nov 17 15:54:04 2005] [error] [client] File does not exist: /home/mystica1/

I am not sure what you mean by shell, but I just used my text editor and uploaded with ftp. I don’t really know how to use shell. I have putty but I am really new to all this.


Works for me. Try editing to this:

[code]#!/usr/bin/perl -T

use strict;
use CGI::Carp qw(fatalsToBrowser);

#use warnings;
#use diagnostics;
require “./”;
downloader::run();[/code]And perhaps it will show you an error.

:cool: Perl / MySQL / HTML+CSS


well I could be wrong here… but isn’t:

that the url Fopen command that has been disabeled on DH because of security risks?



The script is written in Perl where there is no such lazy and insecure feature as opening files over HTTP.

Mystical also appears to not be using the script properly according to the documentation. defines a an application class - similar to how CGI::Application works. is a script that includes and then calls a method of that class to actually process the request.

A compile-time error occurs when attempting to call as CGI since it is simply a class definition. Either that or since a class definition by itself does not execute code, and thus has no output, Apache doesn’t see any HTTP headers.

Mystical should be linking to this URL:

instead of this URL:

At this time though for some reason calling on his site results in a plain text document that specifies a Location header. Probably just needs to remove the BEGIN { } block from and update the HTML to call the correct script file.

Also might be a good idea to re-examine the permissions the instructions tell you to set. and can be chmod 640 or 600 since they are libraries and not executables, nor does Apache need to serve them over the web. In other words, calling should result in a 401 Forbidden instead of showing the contents to the visitor!
:cool: Perl / MySQL / HTML CSS


Atropos7, thank you so much for everything. It works!

I was linking to my file incorrectly. I had used this so many times so I don’t know how I messed that up, it must have been from looking at code all day. Nonetheless, I got it to work with your help.

Thanks so much, and next time I will be sure I am linking correctly. :slight_smile:

Oh and I am a she. lol. :slight_smile: