How to change all the url of a particular website.. (append session id)
Hi . Hmm since i cannot get the cookie set by another URLDo you have any other suggestions for my problem. Current, i intend to pass the session id via the url. But the problem is let say first time i pass a url http://www.nus.edu.sg?sessionid=eeddffg i could get the sessionid from my mod perl module.. But subsequently, the value of the sessionid id is lost, as it proceed to get other request type(eg image). I intend to intercept the first request, and append the sessionid to the other requests before it is lost. Do your have any idea how to do? Thanks kheeTEck - Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, May 17, 2001 12:07 AM Subject: RE: Fw: How to get cookie from a mod_perl proxy You cannot get a cooking that was set by another URL. Original Message: - From: ktgoh [EMAIL PROTECTED] Date: Mon, 14 May 2001 19:35:08 +0800 To: [EMAIL PROTECTED] Subject: Fw: How to get cookie from a mod_perl proxy > Hi, I am writing a perl_mod script for apache that will act as a proxy to > intercept all requests that comes through my proxy. I want to set a cookie in > the client's browser (to store a session ID) and retrieve it each time the > user make a request to other URL (assuming he has set my proxy as his proxy in > his browser configuration). > > My question is: Am i able to get the cookie i have set, from the client? I can > set the cookie for the client, but I have not been able to retrieve it so > far:(. Any help here is much appreciated. > > Regards, > Firestar > > Mail2Web - Check your email from the web at http://www.mail2web.com/ .
RE: DB_File::Lock and the STOP button
Hi, If a script using DB_File::Lock is interrupted by the STOP button, the file will be appropriately unlocked. When using DB_File::Lock, there really is no "critical section" for making sure that the lock will be released appropriately. If a fatal exception happens while the database is open, the lock will be released when the perl garbage collector removes the tied variable. When this variable is cleaned up and "untied", DB_File::Lock catches the untie call and removes the lock while also closing the database in the correct order. This is why DB_File::Lock exists: to catch this case. If the locking was done like this: Gain_lock() Open_database() Use database Close_database() Loose_lock() Then there would be a "critical" section where if the code was interrupted by the STOP button or a die() exception, the user wouldn't be guaranteed that the database and/or lock would be closed and what order that would happen. If you are using DB_File::Lock, the code running while the database is open is still "critical" in another sense: other processes are prevented from getting locks they may desire. So, it's important to make sure that your code doesn't do any unnecessary time-consuming processing while the database is open. David -Original Message- From: Dave Edsall - The Tauminator [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 16, 2001 3:47 PM To: [EMAIL PROTECTED] Subject: DB_File::Lock and the STOP button I have a question about DB_File::Lock with a database and users hitting the STOP button. We have recently converted a database from an ASCII flat file to db file. The ASCII flat file used flock() to lock the files. Now that we have switched to DB_File, we have adopted DB_File::Lock as our locking mechanism What we have essentially is: my($strDBFilename) = "msglist.db"; my($locking)="write"; tie(%msglistdb, 'DB_File::Lock', $strDBFilename,O_CREAT|O_RDWR, 0644,$DB_HASH,$locking) [...critical stuff...] untie(%msglistdb); If everything goes normally, this will provide a locked fence file that will be unlocked when the file is closed during the untie. If I have read the mod_perl guide correctly, when a user hits the STOP button on a browser while the "critical stuff" is being processed, the script will abort and the files will be closed and the fence file unlocked because we magically go out of scope at the point of the abort. Is this a correct reading? Will the lock be removed when the user hits the STOP button? If so, for my own erudition, can someone explain to me why we go out of scope in this case and why/how the files are closed when we go out of scope? Thanks in advance, Dave
Re: authorization and mod_perl
On Wed, May 16, 2001 at 01:39:45PM -0400, barries wrote: > On Wed, May 16, 2001 at 12:07:28PM -0400, Vivek Khera wrote: > > > > I don't think location takes a glob pattern. > > A nit: it can. , and can all take > shell-like globs using ?, *, and []/[!...]/[^...] operators, looks like. > No equivalent to {a,b,c} alternation, AFAICS. according to /usr/share/doc/apache-doc/manual/mod/core.html, # matches exactly # matches filename glob # matches full regex, with tilde # matches full regex and similar for and -- What do I need manners for? I already got me a wife. -- Adam Pontipee, "Seven Brides for Seven Brothers" [EMAIL PROTECTED] http://sourceforge.net/projects/newbiedoc -- we need your brain! http://www.dontUthink.com/ -- your brain needs us!
DB_File::Lock and the STOP button
I have a question about DB_File::Lock with a database and users hitting the STOP button. We have recently converted a database from an ASCII flat file to db file. The ASCII flat file used flock() to lock the files. Now that we have switched to DB_File, we have adopted DB_File::Lock as our locking mechanism What we have essentially is: my($strDBFilename) = "msglist.db"; my($locking)="write"; tie(%msglistdb, 'DB_File::Lock', $strDBFilename,O_CREAT|O_RDWR, 0644,$DB_HASH,$locking) [...critical stuff...] untie(%msglistdb); If everything goes normally, this will provide a locked fence file that will be unlocked when the file is closed during the untie. If I have read the mod_perl guide correctly, when a user hits the STOP button on a browser while the "critical stuff" is being processed, the script will abort and the files will be closed and the fence file unlocked because we magically go out of scope at the point of the abort. Is this a correct reading? Will the lock be removed when the user hits the STOP button? If so, for my own erudition, can someone explain to me why we go out of scope in this case and why/how the files are closed when we go out of scope? Thanks in advance, Dave
Re: Apache::DBI missing methods?!
> > Hi, > > I've just joined the list looking for an answer to this. A couple of > others have posted the same problem but I couldn't find any answers. > > I'm running RH6.2 with standard Apache, perl and mod_perl rpms. I'm > hitting a brick wall if I include a 'PerlModule Apache::DBI' line in > httpd.conf - Apache starts up but shuts down immediately. I created a test > script that just use's the module and I get the following error > > Can't locate object method "module" via package "Apache" at > /usr/lib/perl5/site_perl/5.005/Apache/DBI.pm line 202. BEGIN > failed--compilation aborted at ./test.pl line 4. > > Which must be what's frying httpd. > Well, first of all, you can't just make a perl script with use Apache::xx and expect perl to run it - the Apache::xx family is only usable from within the mod_perl environment, so that's probably what's causing your error - but that wouldn't happen in Apache... Try looking at your error_log for clues on what's killing Apache. Issac Internet is a wonderful mechanism for making a fool of yourself in front of a very large audience. --Anonymous Moving the mouse won't get you into trouble... Clicking it might. --Anonymous PGP Key 0xE0FA561B - Fingerprint: 7E18 C018 D623 A57B 7F37 D902 8C84 7675 E0FA 561B
NameWithVirtualHost
I"m running Apache 1.3.12 + mod_perl 1.25 I'm looking to fully optimized my mod_perl scripts and in the process I'm finding that I can't totaly seperate my virtual hosts. I'm finding that sub procedure that are in modules that I write will get redefined across vhosts. I did extensive research on this and did all the tricks that was suggest but with no luck. An example test script is like this. /index.pl: # #!/bin/perl -w use strict; require "/path/to/custom/module/test.pm" &testmodulepackage::main(); exit; # Now test.pm would be duplicated and would have simular calls but differnet outputs. Am I assuming correctly that in vhostA.com's /index.pl what ever is 'required' for use is compleatly local to that vhost? or once it's required, it's global but the only thing that is local to that vhost is what ever is in the /index.pl code-wise? That's what I'm getting to assume here. my config is simple here are lines in my dynamic httpd httpd.conf file: #PerlModule Apache::StatINC SetHandler perl-script PerlHandler Apache::RegistryNG->handler Options +ExecCGI #PerlSendHeader On #PerlInitHandler Apache::StatINC #PerlSetVar StatINCDebug On PerlRequire /vhost/bin/apache-dynamic/startup.pl and the lines in startup.pl: #! /usr/bin/perl use strict; use Apache::RegistryNG; use CGI (); use DBI (); use DBD::Pg (); 1; nothing changes if the $Apache::Registry::NameWithVirtualHost = 1 is in the startup.pl or not. If I change the SetHandler perl-script to SetHandler cgi-script all the modules in the startup.pl load and are cached and shared but my scripts are not. I can provide output from perl-status if anyone wishes to C that. But from what I gather, Apache does correctly place all calls in the correct name spaces. -- Jason J. Czerak ([EMAIL PROTECTED]) Linux Systems Evangelist Jasnik Services, LLC http://www.Jasnik.net
Re: Any way to make StatINC work for imported modules?
Whoops. Pilot error. Cancel that. Sorry. //Thomas "Thomas K. Burkholder" wrote: > Hi, > > I'm using mod_perl without the registry, because it seems a bit faster > and, well, more elegant. This means, in essence, that the configuration > is: > > PerlInitHandler Apache::StatINC > PerlSetEnv PERL5LIB /home/burkhold/perl/local/share/perl/5.6.0 > > SetHandler 'perl-script' > PerlHandler 'Foo::Foo' > > > Now, Foo.pm, containing Foo::Foo is found at the PERL5LIB location > specified. If I add: > > use Bar::Bar to Foo.pm (in the path specified by PERL5LIB above), > although Foo.pm is properly reloaded, I get an error that Bar::Bar is > not found. > > It looks like StatINC only attempts to reload files referenced in the > initial configuration and files referenced by the initial configuration; > anyone know how to make it load new files without restarting the > server? Is it a bug? (It seems like a bug). > > Thanks for any help, > > //Thomas > Thomas K. Burkholder > [EMAIL PROTECTED]
Any way to make StatINC work for imported modules?
Hi, I'm using mod_perl without the registry, because it seems a bit faster and, well, more elegant. This means, in essence, that the configuration is: PerlInitHandler Apache::StatINC PerlSetEnv PERL5LIB /home/burkhold/perl/local/share/perl/5.6.0 SetHandler 'perl-script' PerlHandler 'Foo::Foo' Now, Foo.pm, containing Foo::Foo is found at the PERL5LIB location specified. If I add: use Bar::Bar to Foo.pm (in the path specified by PERL5LIB above), although Foo.pm is properly reloaded, I get an error that Bar::Bar is not found. It looks like StatINC only attempts to reload files referenced in the initial configuration and files referenced by the initial configuration; anyone know how to make it load new files without restarting the server? Is it a bug? (It seems like a bug). Thanks for any help, //Thomas Thomas K. Burkholder [EMAIL PROTECTED]
Re: Pnotes not working
Thank you very much Vivek. That was exactly what was happening. I did manage to figure it out eventually. Thanks for your help. Mike Vivek Khera wrote: > > "MC" == Mike Cameron <[EMAIL PROTECTED]> writes: > > MC> package My::Main; > MC> sub handler{ > MC> my $r = new Apache::Request(shift); > MC> my $var = $r->pnotes("MY_HANDLER"); > MC> $r->log_error("This is var $var->[0]"); > MC> } > > Try this: > > my $var = ($r->prev || $r)->pnotes("MY_HANDLER"); > > You might be getting called as a subrequest rather than the main > request. > > -- > =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= > Vivek Khera, Ph.D.Khera Communications, Inc. > Internet: [EMAIL PROTECTED] Rockville, MD +1-240-453-8497 > AIM: vivekkhera Y!: vivek_khera http://www.khera.org/~vivek/
Re: authorization and mod_perl
On Wed, May 16, 2001 at 12:07:28PM -0400, Vivek Khera wrote: > > I don't think location takes a glob pattern. A nit: it can. , and can all take shell-like globs using ?, *, and []/[!...]/[^...] operators, looks like. No equivalent to {a,b,c} alternation, AFAICS. - Barrie
Re: Pnotes not working
> "MC" == Mike Cameron <[EMAIL PROTECTED]> writes: MC> package My::Main; MC> sub handler{ MC> my $r = new Apache::Request(shift); MC> my $var = $r->pnotes("MY_HANDLER"); MC> $r->log_error("This is var $var->[0]"); MC> } Try this: my $var = ($r->prev || $r)->pnotes("MY_HANDLER"); You might be getting called as a subrequest rather than the main request. -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Vivek Khera, Ph.D.Khera Communications, Inc. Internet: [EMAIL PROTECTED] Rockville, MD +1-240-453-8497 AIM: vivekkhera Y!: vivek_khera http://www.khera.org/~vivek/
Re: authorization and mod_perl
> "JS" == John Saylor <[EMAIL PROTECTED]> writes: JS> consists of handlers and aliases. And the authentication handler isn't JS> working with directives. JS> JS> AuthName"foo control" JS> AuthTypeBasic JS> PerlAuthenHandlerApache::OK I don't think location takes a glob pattern. I use this just fine: AuthType MLM::AuthCookieManage AuthName MLMAuth PerlSetVar MLMAuthPath / PerlSetVar MLMAuthLoginScript /managelogin.mlm PerlAuthenHandler MLM::AuthCookieManage->authenticate PerlAuthzHandler MLM::AuthCookieManage->authorize require valid-user where anything inside the /manage directory is protected by the handler above. -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Vivek Khera, Ph.D.Khera Communications, Inc. Internet: [EMAIL PROTECTED] Rockville, MD +1-240-453-8497 AIM: vivekkhera Y!: vivek_khera http://www.khera.org/~vivek/
[Fwd: Network connection lost while uploading file (Multipart request)]
Hi, Server info : 1. IIS websever with sevexec engine or 2. Tomcat , apache combination The network connection was lost during uploading a file of size more than 64 kb and trying to redirect or forward without reading the data in the Http request (multipart form / post data). The fix i tried was skipping of the whole data in the request using request.getInputStream( ).skip(request.getContentLength( )); It worked fine. Solution 1 : The problem is if multiple users tried to upload files in say 5MB each , then the internal implementation of skip allocates that number of MB into multiple of 5 MB, so out of memory would occur, since the skip ( ) tries to read and dump data onto the byte array. which is a overhead. Solution 2. : I can read the request data onto a byte variable , so that at a time only one byte of memory is allocated but, server the will have to be busy reading each and every byte, which is not a fair thing, since instead of waisting time in reding byte by byte for some MBs of data, it would be nice to cut the network connection.. Is there any other alternative other than the above two solutions Thanks in advance Suresh.
Known bugs with so's and mod_perl 1.21??
I'm getting a rather odd situation on one of our boxes: spec Sun OS 5.6/solaris2.6 Apache 1.3.11 mod_perl 1.2.1 We've got a sitation where mod_perl intensive pages seem to severely knock our idle time - which in it self probably isn't bad, however is it also reflected by noticable latency on apache itself, together with a large number of libhttpd.ep processes. This isn't specific to any one chunk of perl either. I'd think this would be a shared library thing (although I wouldn't know what?) - however we have a simlarly set up box which runs fine ; the only exception being that it was set up with mod_perl 1.2401. The second server runs without ever displaying libhttpd.ep in its process list. So I'm kind of at a loss. Is this a version thing? Has anyone experienced anything of this nature? Thought I'd check before updating versions. Would appreciate any feedback. Thanks. Rafiq -- Rafiq Ismail Software Engineer and Systems Administrator http://www.codix.net "All the best people in life seem to like Linux." - Steve Wozniak
Re: Authorization question and subdirectories
sterling <[EMAIL PROTECTED]> writes: > On 16 May 2001, Chris Strom wrote: > > > Mike Cameron <[EMAIL PROTECTED]> writes: > > > > > Is it possible to have the same PerlAuthzHandler use different require's > > > > > > on a subdirectory once a user has been authorized for a parent > > > directory? Here is what i would like to be acle to do: > > > > > > > > > SetHandler perl-script > > > AuthType MyAuth > > > AuthName MyAuth > > > PerlAuthenHandler MyAuth->authenticate > > > PerlAuthzHandler MyAuth->authorize > > > require valid-user > > > > How about: > > > > require valid-user administrator > > > > > > no - he just wants valid-user for the root location The MyAuth::authorize handler can be modified to reject user administrator unless the URI matches ^/admin (or whatever it was, sorry I cut that off in my earlier reply). > > > > > > > > > > shouldn't this be ? > > > > > no. > I'm pretty sure that it should be. This closes the tag. > > > sterling
Re: Authorization question and subdirectories
I got it working alright with the directive as follows SetHandler perl-script AuthType Consignline AuthName NONE PerlAuthenHandler Consignline::Shop::User PerlAuthzHandler Consignline::Shop::User->authorize require valid-user PerlHandler Consignline::Shop PerlSetVar DEBUG 6 PerlSetVar Config /home/user/Consignline.pm AuthName Admin require user administrator AuthName affiliate require group affiliate will the above not work the same using the location directive? It didn't for me unless I missed something obvious. Thanks for your responses. Chris Strom wrote: > Mike Cameron <[EMAIL PROTECTED]> writes: > > > Is it possible to have the same PerlAuthzHandler use different require's > > > > on a subdirectory once a user has been authorized for a parent > > directory? Here is what i would like to be acle to do: > > > > > > SetHandler perl-script > > AuthType MyAuth > > AuthName MyAuth > > PerlAuthenHandler MyAuth->authenticate > > PerlAuthzHandler MyAuth->authorize > > require valid-user > > How about: > > require valid-user administrator > > > > > shouldn't this be ? > > > > > > > SetHandler perl-script > > AuthType MyAuth > > AuthName MyAuthSupertight > > PerlAuthenHandler MyAuth->authenticate > > PerlAuthzHandler MyAuth->authorize > > require user administrator > > > > > > authenticate is working fine and when I debug the $r->requires in > > authorize it only returns the 'valid user' requirement and not the "user > > > > administrator" requirement even when i access /restricted. Right now > > the code in authorize just prints the requirements via $r->log_error() > > then returns OK; What am I missing? Why doesn't authorize see the > > second requirement for the URI /restricted?
Re: Authorization question and subdirectories
On 16 May 2001, Chris Strom wrote: > Mike Cameron <[EMAIL PROTECTED]> writes: > > > Is it possible to have the same PerlAuthzHandler use different require's > > > > on a subdirectory once a user has been authorized for a parent > > directory? Here is what i would like to be acle to do: > > > > > > SetHandler perl-script > > AuthType MyAuth > > AuthName MyAuth > > PerlAuthenHandler MyAuth->authenticate > > PerlAuthzHandler MyAuth->authorize > > require valid-user > > How about: > > require valid-user administrator > no - he just wants valid-user for the root location > > > > shouldn't this be ? > no. sterling
Re: Authorization question and subdirectories
Mike Cameron <[EMAIL PROTECTED]> writes: > Is it possible to have the same PerlAuthzHandler use different require's > > on a subdirectory once a user has been authorized for a parent > directory? Here is what i would like to be acle to do: > > > SetHandler perl-script > AuthType MyAuth > AuthName MyAuth > PerlAuthenHandler MyAuth->authenticate > PerlAuthzHandler MyAuth->authorize > require valid-user How about: require valid-user administrator > shouldn't this be ? > > > SetHandler perl-script > AuthType MyAuth > AuthName MyAuthSupertight > PerlAuthenHandler MyAuth->authenticate > PerlAuthzHandler MyAuth->authorize > require user administrator > > > authenticate is working fine and when I debug the $r->requires in > authorize it only returns the 'valid user' requirement and not the "user > > administrator" requirement even when i access /restricted. Right now > the code in authorize just prints the requirements via $r->log_error() > then returns OK; What am I missing? Why doesn't authorize see the > second requirement for the URI /restricted?
Re: Address already in use: make_sock: could not bind to port [...]
On Wed, 16 May 2001, Niels van Tongeren wrote: > Hello, > > I have the same problem some other modperl-visitors have, namely the error > "(48)Address already in use: make_sock: could not bind to port 8093", when > having started a long running external program and stopping and starting the > webserver. I have read the "Performance Tuning"-article on > http://perl.apache.org/guide/performance.html. I copied the "Complete Fork > Example" and I thought to have found the solution in the line > "$r->cleanup_for_exec(); # untie the socket". However, when trying to run > the program I got the error: > > "[..] null: Can't locate object method "cleanup_for_exec" via package > "Apache" at [...]/test.pl line 19." > > I have installed "Apache-SubProcess-0.02" and checked the file > "SubProcess.pm". In there I cannot find the method "cleanup_for_exec". I > cannot find a newer version of Apache-SubProcess either. I do not know what > I am doing wrong. Does anyone have a clue? Doug still didn't release a new version of this module. May be you should nudge him :) The patch is available from here: [EMAIL PROTECTED]">http://forum.swarthmore.edu/epigone/modperl/fendfrerherd/[EMAIL PROTECTED] _ Stas Bekman JAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide http://perl.apache.org/guide mailto:[EMAIL PROTECTED] http://apachetoday.com http://eXtropia.com/ http://singlesheaven.com http://perl.apache.org http://perlmonth.com/
Address already in use: make_sock: could not bind to port [...]
Hello, I have the same problem some other modperl-visitors have, namely the error "(48)Address already in use: make_sock: could not bind to port 8093", when having started a long running external program and stopping and starting the webserver. I have read the "Performance Tuning"-article on http://perl.apache.org/guide/performance.html. I copied the "Complete Fork Example" and I thought to have found the solution in the line "$r->cleanup_for_exec(); # untie the socket". However, when trying to run the program I got the error: "[..] null: Can't locate object method "cleanup_for_exec" via package "Apache" at [...]/test.pl line 19." I have installed "Apache-SubProcess-0.02" and checked the file "SubProcess.pm". In there I cannot find the method "cleanup_for_exec". I cannot find a newer version of Apache-SubProcess either. I do not know what I am doing wrong. Does anyone have a clue? Thanks in advance, Niels van Tongeren
Re: Global variables
On Wed, May 16, 2001 at 07:13:22AM +0200, Bjoern wrote: > i want to define a global variable which is also present in subroutines > coded in > extra perl modules. > I tried this "our $test;" but amod_perl tells me following "Global > symbol "$test" requires explicit package name" I know, this is a > question which may be not right here ! > I don`t want to use the perlmodule CGI !! > > I hope some persons can help me, primarily, global variables are looked down upon. but like the error message says, you can explicitly name any global like this: $The::Meaning::Of::Life::The::Universe::And::Everything = 42; you might also try use vars($Something); $Something = &whatever(); but you should probably use closures and references instead. (i'll be re-coding my website to avoid globals in the next few weeks, now that i understand what i just said, there. :) see also http://thingy.kcilink.com/modperlguide/porting/Dynamically_updating_configurati.html -- What do I need manners for? I already got me a wife. -- Adam Pontipee, "Seven Brides for Seven Brothers" [EMAIL PROTECTED] http://sourceforge.net/projects/newbiedoc -- we need your brain! http://www.dontUthink.com/ -- your brain needs us!
Fw: How to get cookie from a mod_perl proxy
> Hi, I am writing a perl_mod script for apache that will act as a proxy to > intercept all requests that comes through my proxy. I want to set a cookie in > the client's browser (to store a session ID) and retrieve it each time the > user make a request to other URL (assuming he has set my proxy as his proxy in > his browser configuration). > > My question is: Am i able to get the cookie i have set, from the client? I can > set the cookie for the client, but I have not been able to retrieve it so > far:(. Any help here is much appreciated. > > Regards, > Firestar > >