XFileSharing Pro - XFileSharing and mod_perl

Message
Author
webzi
Posts: 14
Joined: Jan 10, 2009 1:15 pm

XFileSharing and mod_perl

#1 Postby webzi » Oct 23, 2009 7:47 am

Hello.

I would like to start XFileSharing on mod_perl (v2) but I came across a few problems.

Below I am enclosing the configuration.

Apache conf:
Alias /cgi-bin/ /path_to/cgi-bin/

<Location /cgi-bin/>
SetHandler perl-script
#PerlResponseHandler ModPerl::Registry // That doesn't work stable.
PerlResponseHandler ModPerl::PerlRun
PerlOptions +ParseHeaders
PerlSendHeader On
Options +ExecCGI
PerlOptions +SetupEnv
</Location>

In index.cgi I added appropriate required paths to cgi-bin and Modules:
use lib qw(some_paths);
I also implemented changes in Template.pm because of the visibility templates (mod_perl requires absolute paths to resources).
$options->{filename} = '/path_to/cgi-bin/'.$options->{filename} if ($options->{filename} =~ /Templates/);

The service almost works but all of $ses->redirect() don't work.
(IMHO some behaviours of mod_perl aren't supported in Session.pm)

Is it generally speaking possible to run XFileSharing on mod_perl?
Last edited by webzi on Oct 30, 2009 1:46 pm, edited 1 time in total.

webzi
Posts: 14
Joined: Jan 10, 2009 1:15 pm

#2 Postby webzi » Oct 24, 2009 3:06 pm

any reply?

webzi
Posts: 14
Joined: Jan 10, 2009 1:15 pm

#3 Postby webzi » Oct 26, 2009 6:33 pm

ADMIN can i get answer?

User avatar
PilgrimX182
Posts: 2182
Joined: Mar 22, 2006 1:39 pm

#4 Postby PilgrimX182 » Oct 27, 2009 7:37 am

I believe your problem with redirection is only on Login stage.
Here goes solution: in index.cgi replace

Code: Select all

&LoginPage($ENV{REQUEST_URI});

with

Code: Select all

&LoginPage;

webzi
Posts: 14
Joined: Jan 10, 2009 1:15 pm

#5 Postby webzi » Oct 28, 2009 6:39 am

Hi.

The problem still exists. The last swap didn't any good.
Here is the result (after clicking on "login" link):

Moved
The document has moved here.

where here is a link which contans:
apache2::RequestRec=SCALAR(0x2a1a8c0)

$ses->redirect() doesn't work i.e.: switching language

Any suggestions?

User avatar
PilgrimX182
Posts: 2182
Joined: Mar 22, 2006 1:39 pm

#6 Postby PilgrimX182 » Oct 28, 2009 8:01 am

If you're interested upcoming 1.6 version is optimized for mod_perl, fixed all these errors there.

To fix redirect error comment this in index.cgi:

Code: Select all

$f->{redirect}=shift||$f->{redirect};

webzi
Posts: 14
Joined: Jan 10, 2009 1:15 pm

#7 Postby webzi » Oct 30, 2009 1:04 pm

I would like to share referring observations of starting XFileSharingPro on mod_perl (and virtualhosts)

So that the main system applies one should make a few alterations

In (index.cgi):

sub Register (
my $msg = shift;
#--- dummy workaround calling Subroutine Register wihout parameters casuses Apache2::RequestRec=SCALAR(0x2417918)
my $mess = $msg unless ($msg =~ 'Apache2::RequestRec');
[...]

In (cgi-bin/Modules/WSD/Filter.pm):
line:
$libref = DynaLoader::dl_load_file("/full_path_to/cgi-bin/Modules/WSD/Filter$file_version.so");
needs full (absolute) path.


In (index.cgi):
sub Download2
{
[...]
from:
#$ses->redirect($file->{direct_link}) if $no_checks && $ses->getUser->{usr_direct_downloads}; //causes Internal server error
to:
$ses->redirect($file->{direct_link}) if $no_checks;
[...]

And now main system works fine (I think so).

The second matter concerns services with files (images, movies, audios etc.)

When a link has been created, I click on the link an has got errors in my apache logs:

Premature end of script headers: dl.cgi

then:

/cgi-bin/dl.cgi/fs2hsdpegfzum6z3d3dno5qmxwaeodwc62qlookmae/some_file.rar did not send an HTTP header

(sugestion: mod_perl caches loaded modules and dl.cgi loads randomly XFSConfig.pm from several virtual hosts, which I have)

In other cases:

malformed header from script. Bad header=\xb6\xc8\x7f: dl.cgi

then:

Apache2::RequestIO::print: (103) Software caused connection abort at /path_to_host_1/cgi-bin/Modules/CGI/Carp.pm line 253


In other cases (in browser):

Error happened when generating Download Link.
Please try again or Contact administrator.
(
Software error:

Error1 at /path_to_service/cgi-bin/api.cgi line 18.

For help, please send mail to this site's webmaster, giving this error message and the time and date of the error.
)


Any suggestion?
Last edited by webzi on Oct 30, 2009 1:31 pm, edited 1 time in total.

User avatar
PilgrimX182
Posts: 2182
Joined: Mar 22, 2006 1:39 pm

#8 Postby PilgrimX182 » Oct 30, 2009 1:15 pm

Suggestion: don't use mod_perl and dl.cgi :)


Return to “XFileSharing Pro”



Who is online

Users browsing this forum: No registered users and 0 guests