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?
XFileSharing Pro - XFileSharing and mod_perl
XFileSharing and mod_perl
Last edited by webzi on Oct 30, 2009 1:46 pm, edited 1 time in total.
- PilgrimX182
- Posts: 2186
- Joined: Mar 22, 2006 1:39 pm
I believe your problem with redirection is only on Login stage.
Here goes solution: in index.cgi replace
with
Here goes solution: in index.cgi replace
Code: Select all
&LoginPage($ENV{REQUEST_URI});
Code: Select all
&LoginPage;
- PilgrimX182
- Posts: 2186
- Joined: Mar 22, 2006 1:39 pm
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:
To fix redirect error comment this in index.cgi:
Code: Select all
$f->{redirect}=shift||$f->{redirect};
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?
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.