Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Apache: Users

[no subject]

 

 

Apache users RSS feed   Index | Next | Previous | View Threaded


zstrebly at roadrunner

Aug 7, 2013, 3:48 PM

Post #1 of 6 (48 views)
Permalink
[no subject]

I am using mod_fcgid with apache 2.4. Is there a FastCgiConfig equivalent or a way that I can get the same result as if I set the –flush option on FastCgiConfig in a mod_fastcgi application. I need to send custom headers from my application. Put another way I want to send the equivalent of a cgi nph-file.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe [at] httpd
For additional commands, e-mail: users-help [at] httpd


zstrebly at roadrunner

Aug 7, 2013, 3:55 PM

Post #2 of 6 (46 views)
Permalink
[no subject] [In reply to]

I am using mod_fcgid with apache 2.4. Is there a FastCgiConfig equivalent or a way that I can get the same result as if I set the –flush option on FastCgiConfig in a mod_fastcgi application. I need to send custom headers from my application. Put another way I want to send the equivalent of a cgi nph-file.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe [at] httpd
For additional commands, e-mail: users-help [at] httpd


zstrebly at roadrunner

Aug 7, 2013, 3:57 PM

Post #3 of 6 (46 views)
Permalink
[no subject] [In reply to]

I am using mod_fcgid with apache 2.4. Is there a FastCgiConfig equivalent or a way that I can get the same result as if I set the –flush option on FastCgiConfig in a mod_fastcgi application. I need to send custom headers from my application. Put another way I want to send the equivalent of a cgi nph-file.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe [at] httpd
For additional commands, e-mail: users-help [at] httpd


zstrebly at roadrunner

Aug 7, 2013, 3:59 PM

Post #4 of 6 (45 views)
Permalink
[no subject] [In reply to]

I am using mod_fcgid with apache 2.4. Is there a FastCgiConfig equivalent or a way that I can get the same result as if I set the –flush option on FastCgiConfig in a mod_fastcgi application. I need to send custom headers from my application. Put another way I want to send the equivalent of a cgi nph-file.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe [at] httpd
For additional commands, e-mail: users-help [at] httpd


zstrebly at roadrunner

Aug 7, 2013, 4:10 PM

Post #5 of 6 (45 views)
Permalink
[no subject] [In reply to]

I am using mod_fcgid with apache 2.4. Is there a FastCgiConfig equivalent or a way that I can get the same result as if I set the –flush option on FastCgiConfig in a mod_fastcgi application. I need to send custom headers from my application. Put another way I want to send the equivalent of a cgi nph-file.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe [at] httpd
For additional commands, e-mail: users-help [at] httpd


zstrebly at roadrunner

Aug 8, 2013, 8:27 AM

Post #6 of 6 (31 views)
Permalink
[no subject] [In reply to]

I am using Perl code from an old book that refers to mod_fastcgi but I have mod_fcgid installed. I had to comment out some code ( before exit) and change Accept() to eliminate some errors in conf/error_log. However, I still get a 500 instead of what is desired and a message saying: AuthUserFile not specified in the configuration. As I understand it, the script should take its place.
Thanks again.


#!/usr/bin/perl -Tw
use strict;
use FCGI;
my $lives=1000;
my $content="\nContent-type: text/plain\n\n";
my %status=(
200 => "Status: 200 - OK". $content,
401 => "Status: 401 - Unauthorized".$content,
403 => "Status: 403 - Forbidden".$content
);
my $authfile="/usr/local/apache2/exmar/conf/passwd/passwords";
my %password;
unless (open USERS,$authfile) { die "Failed to open authfile - $!\n";}
while (<USERS>) {
chomp;
my ($user,$cryptpw)=split /:/;
$password{$user}=$cryptpw;
}
close USERS;
#-------------------------------------------------------------------------------------------------
my $r = FCGI::Request(\*STDIN, \*STDOUT, \*STDERR);
while ($r->Accept()>=0) {
foreach my $var (
'FCGI_ROLE', 'FCGI_APACHE_ROLE', 'SCRIPT_NAME',
'REMOTE_ADDR', 'REMOTE_USER', 'REMOTE_PASSWORD',
'REQUEST_URI'
){ $ENV{$var}=~/(.*)/ and $ENV{$var}=$1 if exists $ENV{$var};}

if ($ENV{FCGI_ROLE} eq 'AUTHORIZER') {
SWITCH: foreach ($ENV{FCGI_APACHE_ROLE}) {

/^ACCESS_CHECKER/ and access_checker_role(),last SWITCH;
/^AUTHENTICATOR/ and authenticator_role(),last SWITCH;
/^AUTHORIZER/ and authorizer_role(),last SWITCH;

}
} else {
responder_role();
}
last unless $lives--;
#last if -M $ENV{SCRIPT_NAME} < 0 ;-----------------------------
#last if -M $ENV{$authfile} < 0 ;-----------------------------
}
exit 0;
#---------------------------------------------------------------------------------------
sub responder_role{
print $status{500},
"This is an authentication application!\n";
"Configuring it as a responder is a server error\n";
}
sub access_checker_role {
if ($ENV{REMOTE_ADDR} eq "::1") {
print $status{200};
} else {
print $status{401};
}
}
#--------------------------------------------------------------------------------------------
sub authenticator_role {

my $user=$ENV{REMOTE_USER};
my $sent_password=$ENV{REMOTE_PASSWORD};
if (defined($sent_password) and defined($user) and exists $password{$user}) {
if (crypt $sent_password,$password{$user}) {
print $status{200};
} else {
} print $status{401};

} else {
print $status{401};
}
}
sub authorizer_role {
my $user=$ENV{REMOTE_USER};

if ($ENV{REQUEST_URI}=~m|/$user/|) {
print $status{200};
} else {
print $status{401};
}
}


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe [at] httpd
For additional commands, e-mail: users-help [at] httpd

Apache users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.