Htmlfixit download script (perl) won't work

apps

#1

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

http://htmlfixit.com/free.php#down_counter

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. http://www.mystical-twilight.com/temp.php

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.

Thanks.


#2

You may have to use shell to debug the situation.

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

require "$path_to_lib/htmlfixit-lib.pl";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


#3

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 70.29.41.102] Premature end of script headers: /home/mystica1/mystical-twilight.com/downloader/download.pl
[Thu Nov 17 15:54:04 2005] [error] [client 70.29.41.102] File does not exist: /home/mystica1/mystical-twilight.com/internal_error.html

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.


#4

Works for me. Try editing dl.pl to this:

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

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

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

:cool: Perl / MySQL / HTML+CSS


#5

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

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

-Matttail


#6

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.

download.pl defines a an application class - similar to how CGI::Application works.
dl.pl is a script that includes download.pl and then calls a method of that class to actually process the request.

A compile-time error occurs when attempting to call download.pl 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:
http://example.com/dl.pl?id=somefile.zip

instead of this URL:
http://example.com/download.pl?file=somefile.zip

At this time though for some reason calling dl.pl on his site results in a plain text document that specifies a Location header. Probably just needs to remove the BEGIN { } block from download.pl 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. download.pl and htmlfixit-lib.pl 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 http://example.com/htmlfixit-lib.pl should result in a 401 Forbidden instead of showing the contents to the visitor!
:cool: Perl / MySQL / HTML CSS


#7

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:

Thanks!