Re: POST with PERL

2000-12-21 Thread apache

If you just visit the script directly rather than posting to it, do you see the script 
source code? If so, it sounds like you have a missing / invalid ScriptAlias entry. If 
you just add something like:

ScriptAlias /cgi-bin/ "/home/httpd/html/cgi-bin/"

... on the assumption that '/cgi-bin/' is the URI of the directory in which your 
script can be accessed, and that /home/httpd/html/cgi-bin/ is the path on the 
filesystem to that same directory. Add the above entry either in the global 
configuration (if the site is using the default settings) or in a VirtualHost 
directive (if that's how the site's being accessed).

Another thing to point out is that it's impossible (as far as I know) to have static 
files (such as web pages, images, etc.) and scripts in the same directory. The reason 
for this is that Apache will never serve a page within a ScriptAlias directory as 
above as-is to a browser - the files can only be executed (this is for security 
reasons as I understand it - so someone can't download a copy of your script, only 
execute it on the server).

Hope this helps, and sorry if I got the wrong end of the stick.

Andy.
-- 
Beauty is in the eye of the beholder... Oh, no - it's just an eyelash.

[EMAIL PROTECTED] wrote:

 Hi!

 I have a little problem. A wrote a perl-script to manage guestbook-like
 section of my page. Script is working, but from the shell. When I try to
 post a data through html form I get an error saying that post method is
 not suported by this document. It's in directory with options ExecCGI and
 FollowSymLinks. There is also a script handler for .cgi. What's the
 matter?
 Thanks from advance

 IronHand   mailto:[EMAIL PROTECTED]



HTTP authentication based sessioning with logout ability

2000-12-19 Thread apache

Hi there.

I've been trying to write a system to perform authentication using the 
www-authenticate (http authenatication) method. However, I need a client visiting the 
page and having been authenticated to be able to logout and have their browser forget 
the information (or at least be able to force the browser to re-authenticate within 
the same browser session).

As most browsers cache login details (sensibly - you don't want to enter your login 
details for each page you visit) the best system I can think of is to use dynamic 
realms. This would mean that when someone first visits the site, they will be given a 
random/sequential realm. When they then click on a logout button, the old realm is 
discarded, and if the browser tries to authenticate with the same realm it is refused 
(or alternatively the server just starts sending a different realm and the browser 
re-authenticates on the new realm). Significantly, the system needs to be accessible 
by several people simultaneously. The purpose is actually to allow someone accessing 
the site to log in, be served dynamic content on the basis of username (which I'm 
already doing), but have the option to log out and then back in as a different user.

I've been looking at different ways to do this, but haven't had any sucess as of yet. 
My first attempt was to use the module mod_auth_external to deal with authentication 
using a perl script (which would allow me to arbitrarily refuse login details even if 
they are correct, on the basis of other details such as realm). This is my preferable 
method (mainly because I understand it), but it seems that there's no way to integrate 
the realm into the auth_external system. This means that although I could refuse a 
username and password, I can't change the realm dynamically, and so I can't force the 
browser to re-authenticate (and without the realm information being passed to the 
script, I don't know if a visitor has re-authenticated with the same username or if 
their browser has simply sent the cached copy of the details).

After searching around for methods of dynamically assigning an authname, I stumbled 
across mod_perl. I've never in my life even looked at mod_perl (and I don't really 
understand object-oriented perl, I'm sorry to say - I came from a BASIC background - 
in more ways than one apparently). I also found an example script for assigning 
dynamic realms, but haven't been able to get it to work.

I have only been trying for a day, and I know it's bad of me to resort to a mailing 
list after such a short space of time, but I've trawled the Web for as much 
information as I can find but with no success.

The example mod_perl script I found was as follows:

From http://www.davin.ottawa.on.ca/archive/modperl/2000-09/msg00839.phtml

#

Here's a simple handler that will set the AuthType and AuthName
dynamically and handle the authentication for you. This handler will
prompt you for a password when you try to acess /manual with the
AuthName, "The Manual" and prompt with the AuthName "The Icons" when you
try to access /icons. These urls are part of Apaches basic installation
(that's if you did not remove the manual from your htdocs directory).
The authentication phase will let you in just as long you supply a
username and password. You can of course code such that it you can
authenicate against a .htpassword file, using Apache::Htpasswd.

Anyhow, this should show you that you can indeed change the AuthName
on-the-fly and also handle 
authentication without having to include AuthName,AuthType,AuthUserFile
explicitly in your httpd.conf.

Note: the authentication subroutine acted flaky, sometimes it worked and
other times it didn't. But the realms did change for the each uri. 

i hope this helps youhave fun ;)


Setting it up:

In your httpd.conf ( in a global area):

PerlHeaderParserHandler Apache::SetRealm;


=code

package Apache::SetRealm;

use Apache;
use Apache::Constants qw(:common);
sub handler {
my $r   = shift;

## Make Apache aware the we want to also handle the Authentication
phase using a custom
## handler, in this case the subroutine authenticate()
  $r-push_handlers(PerlAuthenHandler = \authenticate);
my $uri = $r-uri;

   ## only handle uri that are defined as protected, in this case the
only protected
   ## uri's are /icons and /manuals
return OK unless is_protected($r);
my $realm = get_realm($r);

## Construct the Header Field containing the type of authenticate
(Basic) and our
   ## realmname return by get_realm()
my $authheader = 'Basic realm="'.$realm.'"';

$r-header_out("WWW-Authenticate" ,$authheader);

## Return 401 to browser and prompt for login
$r-status(AUTH_REQUIRED);
$r-send_http_header("text/html");
return AUTH_REQUIRED;
}

sub get_realm {
 ## Get the AuthName for a speci

Please Help

1999-11-27 Thread apache


I've been sweating with this 1.3.6 apache and mod_perl 1.21, when I
compile mod_perl, there is no problem, but when I tried to compile apache
with mod_perl, there are so many errors and i couldn't make it work for so
long now.  I've read the manual on the web and follow pace by pace, but
can't get any luck out of it.. i've reinstall the perl with the new
version of 5.005.62 and it still has the same error when I do the make  in
/usr/local/apache . can anyone please help me? thank you.

My mode_perl compile cofig:  perl Makefile.PL NO_HTTPD=1 EVERYTHING=1
my apache config:./configure --prefix=/usr/local/apache \
 --activate-module=src/modules/php/libphp3.a \
 --activate-module=src/modules/perl/libperl.a

and when I run "make" the following is what i got.. lots of them..

.
.
.
Server.o(.text+0xe05): undefined reference to 'PL_stack_sp'
modules/perl/libperl.a(Server.o): In function 'boot_Apache(...)(long
module,void,...)(long double) static':
Server.o(.text+0xe2b): Undefined reference to 'PL_stack_sp'
Server.o(.text+0xe30): Undefined reference to 'PL_markstack_ptr'
Server.o(.text+0xe43): Undefined reference to 'PL_stack_base'
Server.o(.text+0xe49): Undefined reference to 'Perl_newXS'
Server.o(.text+0xe87): Undefined reference to 'Perl_newXs'
Server.o(.text+0xe9d): Undefined reference to 'Perl_newXs'
.
.
.
.


please help..

regards,
Thang 



Installation help

1999-11-24 Thread apache


I'm trying to setup ASP to work on apache, and as far as my understading
that I need mod_perl has to be installed before installing ASP module, but
I'm still confusing how to install mod_perl, I did as the manual said, and
I installed without any error, but when i put the config in httpd.conf for
the ASP to work then i got error and can't not start the apache..can
anyone please help?

error:
[root@mail conf]# httpd start
Syntax error on line 450 of /usr/local/apache/conf/httpd.conf:
Invalid command 'PerlHandler', perhaps mis-spelled or defined by a module
not in
cluded in the server configuration
/usr/sbin/httpd start: httpd could not be started  

my httpd config:
Alias /asp/ /usr/local/htdocs/asp/
Location /asp/
 SetHandler perl-script
 PerlHandler Apache::ASP
 PerlSetVar Global /tmp
/Location



thanks



helps

1999-11-24 Thread apache


can anyone show me how to build the perl modules into apache?  I have
previously compiled Apache 
1.3.6 with activated php module, and I would like to build perl modules
into the httpd without changing 
the previous config which has the  php modules installed.  

  I've tried to installed the mod_perl, but with not success, I need help,
can anyone help me out here? 
thanks a lot






Installation help

1999-11-24 Thread apache


Cliff, 
 thanks, and I did that, and now here is what i get for the error when I
recompile the apache, can you help. Thanks

this is just a part of the error, when I take off the
"--with-module=src/modules/libperl.a"  then there is no error.

regards,

Server.o(.text+0xe52): undefined reference to `PL_stack_base'
Server.o(.text+0xe87): undefined reference to `Perl_newXS'
Server.o(.text+0xe9d): undefined reference to `Perl_newXS'
Server.o(.text+0xeb3): undefined reference to `Perl_newXS'
Server.o(.text+0xec9): undefined reference to `Perl_newXS'
Server.o(.text+0xedf): undefined reference to `Perl_newXS'
modules/perl/libperl.a(Server.o)(.text+0xef5): more undefined references
to `Per
l_newXS' follow
modules/perl/libperl.a(Server.o): In function `boot_Apache(...)(long
double, voi
d,...)(long double) static':
Server.o(.text+0xf34): undefined reference to `PL_stack_base'
Server.o(.text+0xf39): undefined reference to `PL_sv_yes'
Server.o(.text+0xf50): undefined reference to `PL_stack_base'
Server.o(.text+0xf5b): undefined reference to `PL_stack_sp'
modules/perl/libperl.a(mod_perl_opmask.o): In function
`mod_perl_set_opmask':
mod_perl_opmask.o(.text+0x29): undefined reference to `Perl_croak'


On Wed, 24 Nov 1999, Cliff Rayman wrote:

 that errors means that mod-perl is NOT installed in your http server.
 somewhere you skipped an installation step.
 
 if it were me - I'd start from step one and try it again.
 
 cliff rayman
 genwax.com
 
 [EMAIL PROTECTED] wrote:
 
  I'm trying to setup ASP to work on apache, and as far as my understading
  that I need mod_perl has to be installed before installing ASP module, but
  I'm still confusing how to install mod_perl, I did as the manual said, and
  I installed without any error, but when i put the config in httpd.conf for
  the ASP to work then i got error and can't not start the apache..can
  anyone please help?
 
  error:
  [root@mail conf]# httpd start
  Syntax error on line 450 of /usr/local/apache/conf/httpd.conf:
  Invalid command 'PerlHandler', perhaps mis-spelled or defined by a module
  not in
  cluded in the server configuration
  /usr/sbin/httpd start: httpd could not be started
 
  my httpd config:
  Alias /asp/ /usr/local/htdocs/asp/
  Location /asp/
   SetHandler perl-script
   PerlHandler Apache::ASP
   PerlSetVar Global /tmp
  /Location
 
  thanks