Re: POST and multipart/data-form question
El Jue 14 Mar 2002 12:12, Vuillemot, Ward W escribió: I have searched off and on for the past 3 weeks for a solution to my problem. I am at wits end. . .and thought I would finally ask the mailinglist. I had a set of CGI scripts that worked without problem. I began the process about 4 weeks ago of moving them to mod_perl. The suite of scripts are handled as their own perlHandler collection. One of the scripts has a form where a user can either enter data directly, or indicate a file of equivalent data. When I use the form to POST without any enctype and if you enter directly into the form things work correctly. That is, the data is massaged and sent back to you as downloadable file. Of course, this form does not handle file uploads. Now, I change nothing more than the form enctype to multipart/data-form. Now, regardless of how the data is presented in the form (e.g. directly or via file upload) the browser tries to refresh the screen with the web-page (which it should not since its only response is to send to the client a file to download). However, the web page does not get completely sent, and consistently stops in the middle of the send. I have been using the POST2GET snippet to help make the post more persistent. In short, my httpd.conf file looks like: # # ** # ** MOD PERL CHANGES ** # ** # limit POSTS so that they get processed properly Limit POST PerlInitHandler POST2GET /Limit # force reloading of modules on restart PerlFreshRestart on # Perl module primitive mother load on start/restart #PerlRequire lib/perl/startup.pl # FLOE application (mod_perl) PerlModule Apache::DBI PerlModule floeApp Location /floeApp SetHandler perl-script PerlHandler floeApp PerlSendHeader On /Location And the relevant two snippets of code from the script are: ## process incoming # if submitted my %hash = undef; my $initialList = $q-param('initialList') || ''; my $upload = $q-upload || undef; my $fh = $upload-fh if defined($upload); if (defined($upload) $upload) { $initialList = ''; while ($fh) { $initialList .= $_; } } ## some processing is done to the POST'ed data ## and eventually. . . ## send file to client print Content-type: text/plain\n; print Content-Disposition: attachment; filename=list.txt\n\n; foreach my $value (sort keys %$hash) { chomp($value); next unless ($value); print $hash-{$value}$CRLF$value$CRLF; } exit; Any ideas? I would love to get this solved so I can get back to developing useful scripts. :) Thanks! Ward Ward W. Vuillemot Boeing Flight Operations Engineering Performance Software tel +01 206-662-8667 * fax +01 206-662-7612 [EMAIL PROTECTED] just to test, if you trie: perl -MCGI -e 'print CGI::start_multipart_form()' you get form method=post action=/-e enctype=multipart/form-data and not: multipart/data-form as you write May be you spelled it wrong on he message, but this may be your problem. Hans
Problem Removing Handlers
Please Help One of my handlers do an: $r-set_handlers( PerlInitHandler = undef); Later in the same virtual host configuration there is another Directory covering the URL / with this handler. PerlInitHandler sub { my $r = shift; warn 'callback', $r-current_callback; warn 'this should not be called'; } It happens that the callback printed in the above warn is: PerlInitHandler Exacty what i though was removed with: $r-set_handlers( PerlInitHandler = undef); Hans
Re: Cookies and redirects
El Mar 12 Mar 2002 11:23, Axel Andersson escribió: Hello, I'm having trouble with both setting a cookie and redirecting the user to another page at the same time. It would appear the cookie is only sent when a normal header is sent by server. If I do the following (having baked the cookie first), where $r is the Apache-request() object: $r-content_type(text/html; charset=iso-8859-1); $r-send_http_header(); I get this header: Connection: close Date: Tue, 12 Mar 2002 10:39:05 GMT Server: Apache/1.3.23 (Unix) mod_perl/1.26 Content-Type: text/html; charset=iso-8859-1 Client-Date: Tue, 12 Mar 2002 10:39:05 GMT Client-Response-Num: 1 Client-Transfer-Encoding: chunked Set-Cookie: user=12::7c786c222596437b; domain=animanga.nu; path=/; expires=Wed, 12-Mar-2003 10:39:05 GMT Very nice and all, with cookie set. However, doing: $r-method_number(M_GET); $r-method(GET); $r-headers_in-unset(Content-length); $r-headers_out-add(Location = /users.pl); $r-status(REDIRECT); $r-send_http_header(); Which I gather is the normal way to redirect a user, I get this header: Connection: close Date: Tue, 12 Mar 2002 10:38:36 GMT Server: Apache/1.3.23 (Unix) mod_perl/1.26 Content-Type: text/html; charset=iso-8859-1 Client-Date: Tue, 12 Mar 2002 10:38:36 GMT Client-Response-Num: 1 Client-Transfer-Encoding: chunked Right, no Set-cookie there. So what's up? How do I redirect a browser, and set a cookie at the same time? Thanks in advance, Axel Andersson Have you tried printing the headers_out hashref after sending the http header to see if the cookie is there ?. my $headers_out = $r-headers_out; foreach (keys %$headers_out) { warn $_=$headers_out-{$_}; } Hans
Deleting a cookie manually
Hi I need to delete directly a session cookie before begining some processing. I need to clean directly the cookie from the cookie table for after processing hans
Re: [OT] Perl compillation
El Vie 22 Feb 2002 13:47, Mithun Bhattacharya escribió: Could someone tell me the right place to ask questions regarding problems faced during compillation of perl 5.6.1 on i686 using gcc 3.0 on a RedHat 7.2 installation. For the curious folks these are the steps I followed -- tar xzf stable.tar.gz cd perl-5.6.1/ rm -f config.sh Policy.sh sh Configure -de make -- everything works fine till now - it even says go ahead and run make test. but thats where the fun stuff happens. Make test fails 52 of the 205 tests and a sample of the error message is as follows. -- lib/syslfs...Can't load '../lib/auto/Fcntl/Fcntl.o' for module Fcntl: ../lib/auto/Fcntl/Fcntl.o: ELF file's phentsize not the expected size at ../lib/XSLoader.pm line 75. at ../lib/Fcntl.pm line 220 Compilation failed in require at lib/syslfs.t line 14. BEGIN failed--compilation aborted at lib/syslfs.t line 15. FAILED at test 0 lib/syslog...Can't load '../lib/auto/Socket/Socket.o' for module Socket: ../lib/auto/Socket/Socket.o: ELF file's phentsize not the expected size at ../lib/XSLoader.pm line 75. -- A google search tells me something very fundamental has gone wrong in the installation as in the system is trying to load a file as a shared library when it isnt - although that doesnt really help me isolate or debug the problem. Ofcourse a search of the perl-beginner list archive didnt help. Regards Mithun I am running RedHat 7.2 and i'am without problems installing perl 5.6.1. I checked ther version and is 2.96. [root@hans images]# gcc --version 2.96 [root@hans images]# ¿Du you upgrade manually gcc ? May be can downgrade to 2.96 to test. Hans Poo
Apologyze, Please delete my last message
Please delete my last message I apologyze because i make a mistake in my last message. I was sending an internal mail and the To field was with mod_perl and i put the real destinations in the CC section. Sorry Again. Hans Poo
Re: Apache and Perl togheter
El Mié 09 Ene 2002 10:00, Alan Civita escribió: Hello can some help me pelase? i've recently installed Apace 1.3.22...i've configured the CGI directive to work as well but when i try to execute a CGI script written in perl that message appears: Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, [EMAIL PROTECTED] and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log The CGI script is a stupid test hello world CGI script ... Script written in sh script work. Can someone solve my problem please... Thx to all Alan As i understand what you are doing is nothing perl related, what you are using is apache module mod_cgi compiled in by default in apache. You must check if your script compiles and run from the shell: #cd youtscritpsdir #perl -wc myscript.pl #perl myscript.pl #chmod 755 myscript.pl #./myscript .pl If all this works you defionitely must check your error_log Hans Poo
Re: Configuration loading twice - how to cope?
El Mié 09 Ene 2002 18:16, William R Ward escribió: The Apache server processes its config file twice when starting up, and our code doesn't react well to that. On the first pass, everything initializes hunky-dorily (if that's a word), but on the second pass lots of stuff that is assumed to be loaded in memory doesn't work. This has been working just fine under our old setup, using Apache httpd version 1.3.14, mod_perl 1.24_01, and Perl 5.00503. But we're trying to upgrade to 1.3.22, 1.26, and 5.6.2 respectively, and now we have lots of problems. What I think I need to do is add some logic to test which pass we are currently running, and act according to that. Or are there any known bugs in Apache, mod_perl, or Perl that might be causing the trouble? --Bill. I am not sure if i saw it in the eagle book, but as i remember apache make a fake checking start first after the real start of the server. This may be what you are seeing. Hans Poo
Re: Apache and Perl togheter
El Mié 09 Ene 2002 10:00, Alan Civita escribió: Hello can some help me pelase? i've recently installed Apace 1.3.22...i've configured the CGI directive to work as well but when i try to execute a CGI script written in perl that message appears: Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, [EMAIL PROTECTED] and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log The CGI script is a stupid test hello world CGI script ... Script written in sh script work. Can someone solve my problem please... Thx to all Alan Alan As i understand what you are doing is nothing perl related, what you are using is apache module mod_cgi compiled in by default in apache. You must check if your script compiles and run from the shell: #cd youtscritpsdir #perl -wc myscript.pl #perl myscript.pl #chmod 755 myscript.pl #./myscript .pl If all this works you defionitely must check your error_log Hans Poo
Lost form values with direct calls to param in CGI.pm
I'am migrating some scripts to run under Apache::Registry. The scripts are programmed with the typical: use CGI qw/:standard/ ... and then recover the parameter values wityh direct call to the function param(somefield). This is happening with the last versions: apache:1.3.22 and mod_perl 1.26 Detail: if i do: use CGI qw/:standard/; and call the form values with: print param(somefield); The form fields don't appear to exist. Instead if i use the object oriented syntax: my $q = new CGI; and then print $q-param(somefield); everything works fine... I have been the whole day chasing this ... The same thing happen with Apache::PerlRun To finish, the httpd.conf file is: VirtualHost 64.76.145.88 ServerName www.polla.cl DocumentRoot /home/www/html Alias /cgi-bin /home/www/cgi-bin PerlModule Apache::Registry Location /cgi-bin SetHandler perl-script PerlHandler Apache::Registry Options ExecCGI /Location /VirtualHost Hans Poo
Re: Feeling stupid
El Vie 04 Ene 2002 18:26, [EMAIL PROTECTED] escribió: Hello! I'm trying to set up (again; I've done it a couple of times) mod_perl'ed Apache. With THAT simple addition to base config Location / SetHandler PerlScript PerlHandler Apache::PerlRun Options +ExecCGI /Location I'm getting script source instead of result. I've even attepmted to add Files *.pl SetHandler PerlScript PerlHandler Apache::Registry Options ExecCgi /Files below the Location, but result is the same. That script worked and works under non-modperl'ed Apache. I've read all documentation as carefully as possible, and I'm feeling immesurably stupid :-((( Mod_perl IS active, at least, other virtual site with HTML::Mason runs neatly! What could I do wrong? Alex. the line must be: SetHandler perl-script with a dash between perl an script. Hans Poo
Lost form values with direct calls to param in CGI.pm
I'am migrating some scripts to run under Apache::Registry. The scripts are programmed with the typical: use CGI qw/:standard/ ... and then recover the parameter values wityh direct call to the function param(somefield). This is happening with the last versions: apache:1.3.22 and mod_perl 1.26 Detail: if i do: use CGI qw/:standard/; and call the form values with: print param(somefield); The form fields don't appear to exist. Instead if i use the object oriented syntax: my $q = new CGI; and then print $q-param(somefield); everything works fine... I have been the whole day chasing this ... The same thing happen with Apache::PerlRun To finish, the httpd.conf file is: VirtualHost 64.76.145.88 ServerName www.polla.cl DocumentRoot /home/www/html Alias /cgi-bin /home/www/cgi-bin PerlModule Apache::Registry Location /cgi-bin SetHandler perl-script PerlHandler Apache::Registry Options ExecCGI /Location /VirtualHost Note: I've just changing my email, may be this email is going to be duplicated. Sorry if this happen. Hans Poo
Re: mixing cgi-bin mod_perl
El Jue 20 Dic 2001 20:46, Luciano Miguel Ferreira Rocha escribió: On Thu, Dec 20, 2001 at 03:16:48PM -0800, Randal L. Schwartz wrote: Luciano find . -type f -print0 | xargs -0 perl -spi -e 's/cgi-bin\/some_scr.pl/mod-perl\/some_scr.pl/g;' Ewww. Why two processes? Because I would rather type only a single line to do what a 8 line program will do. What's the point of using perl if you aren't lazy? And then, what's the point of using perl if you can be even lazier? Perl extends the normal Unix Tools, but I won't drop them for perl just because it's the cool language of the moment... (Not that I don't like perl, mind you...) Regards, Luciano Rocha I think Randall is just trying to show a cool application of File::Find, and int the menatime save some CPU and memory cycles. I like it. Hans Poo
Re: ASP.NET Linux equivalent?
El Mié 05 Dic 2001 11:28, Brett W. McCoy escribió: On Mon, 3 Dec 2001, Vsevolod Ilyushchenko wrote: Is anyone aware of a Linux product equivalent to ASP.NET from MS? Its most attractive feature is the GUI construction of Web forms and the automatic connection of their fields to a database. Since I am getting sick and tired of writing over and over the code to process user input and store it in the database, a similar product would be a huge help. (PHPLens does something similar, but it only presents data in the table format.) If you are writing the same code over and over again, that's a good sign you need to start creating modules and using those. One thing you may want to look at is Mason, which is a component based architecture for building web sites. See http://masonhq.com. But it's not point and click GUI stuff -- you still need to do some coding. -- Brett http://www.chapelperilous.net/ Poverty must have its satisfactions, else there would not be so many poor people. -- Don Herold I believe that sometimes people want to stop thinking and let the GUI do that Job, obviously, it's not possible. Over Expectations over GUI often leads to troubles in planification It's a fact that with the GUI's you stop understanding what you are really doing. Hans Poo
Re: [modperl site design challenge] please vote
El Mar 04 Dic 2001 05:39, Stas Bekman escribió: Thomas Klausner, Allan Juul and Carlos Ramirez have answered the challenge and submitted their modperl site designs. Thank you folks! Now it's a time for you to chose the design that you like the most by voting at http://www.tohubohu.net/cgi/mpchallenge In order to let everybody enough time to vote, the votes will be collected in 12 days from this announce, i.e. Monday December 17. Notice that in order to avoid cheating please submit your email address along with your vote. At the end of the voting process, only votes with email addresses matching the modperl list's subscribers list will be considered as valid. That's why you cannot see the current votes' spread. If you want to add some notes (how to improve things, etc), please add these when you vote in the 'comments' field. If you have any problems with voting email me directly, and not the list. Thanks to Eric Cholet for providing this voting script and hosting it. Thanks to Nathan Torkington for pushing for the site's change :) _ Stas Bekman JAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide http://perl.apache.org/guide mailto:[EMAIL PROTECTED] http://ticketmaster.com http://apacheweek.com http://singlesheaven.com http://perl.apache.org http://perlmonth.com/ Please, can you send the address of the three designs?
Re: [modperl site design challenge] please vote
El Mar 04 Dic 2001 11:27, Einar Roheim escribió: You just click on the names ... Didn't you see the links? Einar At 09:52 04/12/2001 -0300, you wrote: El Mar 04 Dic 2001 05:39, Stas Bekman escribió: Thomas Klausner, Allan Juul and Carlos Ramirez have answered the challenge and submitted their modperl site designs. Thank you folks! Now it's a time for you to chose the design that you like the most by voting at http://www.tohubohu.net/cgi/mpchallenge In order to let everybody enough time to vote, the votes will be collected in 12 days from this announce, i.e. Monday December 17. Notice that in order to avoid cheating please submit your email address along with your vote. At the end of the voting process, only votes with email addresses matching the modperl list's subscribers list will be considered as valid. That's why you cannot see the current votes' spread. If you want to add some notes (how to improve things, etc), please add these when you vote in the 'comments' field. If you have any problems with voting email me directly, and not the list. Thanks to Eric Cholet for providing this voting script and hosting it. Thanks to Nathan Torkington for pushing for the site's change :) _ Stas Bekman JAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide http://perl.apache.org/guide mailto:[EMAIL PROTECTED] http://ticketmaster.com http://apacheweek.com http://singlesheaven.com http://perl.apache.org http://perlmonth.com/ Please, can you send the address of the three designs? Ok, please don't kill me, sorry, it's OK now, Hans
Re: Perl and Microsoft Excel?
El Jue 29 Nov 2001 19:31, Ian escribió: Mensaje firmado por ID de clave desconocido 962F87CA In the wide and wonderful world of Microsoft and Linux, I'm in the need of an interesting soloution. I'm presenting this to the list because I've ran out of good ideas. I recommend making a mod_perl application for the list and store the information in mysql (and forget about excel if you can), and then, just take that information and publish on the web. Hans
Re: Files problem, pulling my dam hair out
El Jue 29 Nov 2001 19:37, Chuck Carson escribió: I have the following config: apache 1.3.22 with perl 1.26 built statically I want to use perl to dynamically generate html pages, so I have .pl files under DOCUMENT_ROOT. I have this config: Alias /perl /usr/local/apache/cgi-bin Directory /usr/local/apache/cgi-bin SetHandler perl-script PerlHandler Apache::Registry Options +ExecCGI /Directory Files *.pl SetHandler perl-script PerlHandler Apache::Registry Options ExecCGI /Files Whenever I try and get a perl script from a web browser, it pops up a dialog asking to save the damn file. I have tried Netscape 4.79 on NT and Unix as well as IE 5.5. I have configured a server in this manner probably 100 times, I cannot find what I a missing this particuliar time. Anyone have any ideas? Thanks, Chuck Chuck Carson Systems Administrator [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] 858.202.4188 Office 858.442.0827 Mobile 858.623.0460 Fax The content type is not getting rigth to the browser ! If you are using a funny extension for your files you need the apache AddType directive. AddType text/html .myextension Maybe you are just forgeting to send the http Content-Type: text/html as your first instruction. There are many ways to do it: print Content-Type:text/html\n\n; or use CGI qw/:standard/; print header; or the mod_perl way In any case, you miss to Put a mod_perl directive PerlSendHeader on (to fix malformer headers) in your directory configuration. Hans Poo
Upgrade Perl to 5.6.1and mod_perl still see 5.6.0
I've just installed a redhat 7.2 machine. I the installed Apache::ASP using CPAN, and ended upgrading to perl 5.6.1. After restarting httpd. i noticed that mod_perl is still int he old libraries. The test are: 1.- @INC seems fine in the system: # perl -e 'print join \n, @INC' /usr/local/lib/perl5/5.6.1/i686-linux /usr/local/lib/perl5/5.6.1 /usr/local/lib/perl5/site_perl/5.6.1/i686-linux /usr/local/lib/perl5/site_perl/5.6.1 /usr/local/lib/perl5/site_perl 2.- But mod_perl is still on the old @INC # /etc/rc.d/init.d/httpd start Iniciando httpd: Syntax error on line 1448 of /etc/httpd/conf/httpd.conf: Can't locate Apache/ASP.pm in @INC (@INC contains: /usr/lib/perl5/5.6.0/i386-linux /usr/lib/perl5/5.6.0 /usr/lib/perl5/site_perl/5.6.0/i386-linux /usr/lib/perl5/site_perl/5.6.0 /usr/lib/perl5/site_perl . /etc/httpd/ /etc/httpd/lib/perl) at (eval 3) line 3. [FALLÓ] # Hans Poo
Re: Deleting a cookie
El Mar 27 Nov 2001 10:21, Jon Robison escribió: I have created a login system using the wonderful Ticket system from the Eagle book. I have modified TicketAccess so that after authentication, it reviews the arguments in the query string and does push_handler, the handler being chosen based on the args. My only problem is that I want to provide the users with a logout button which will delete the cookie from thier browser, yet I cannot find how!. I have reviewed every module on my system with 'Cookie' in the name (Apache::Cookie, CGI::Cookie, etc.) and nowhere does it tell how to do this. There is a small mention of changing the expiration to 0, but apparently I am doing it wrong (possible confusing point is the use of an 'expires' value in the cookie itself, seperate, I think, from the 'expires' attribute on the cookie?) I know it is a lot to ask, but I am relatively new to this part of mod_perl (pushing handlers, etc.), so if anyone can look at this and replace my BLOCKED comments with a couple of helpfull lines, I would greatly appreciate it! Thanks in advance - Jonathon Robison Below is my modified TicketAccess, as well as the Logout module I am re-directing to for logout action: = package FES::Apache::TicketAccess; use strict; use Apache::Constants qw(:common); use FES::Apache::TicketTool (); sub handler { my $r = shift; my %input = $r-args; # for checking input items my $ticketTool = FES::Apache::TicketTool-new($r); my($result, $msg) = $ticketTool-verify_ticket($r); unless ($result) { $r-log_reason($msg, $r-filename); my $cookie = $ticketTool-make_return_address($r); $r-err_headers_out-add('Set-Cookie' = $cookie); return FORBIDDEN; } ## Here is where we need to insert a push_handler insert. I won't need ## the requested uri from the $r, since the $r goes along for the ride in## push_handler my $action = defined $input{'act'} ? $input{'act'} : 'view'; print STDERR action is defined as $action\n; ## DEBUGGING if ($action eq 'logout') { $r-push_handlers('PerlHandler' = 'FES::Control::Logout'); return OK; } elsif ($action eq 'view') { $r-push_handlers('PerlHandler' = 'FES::Control::View'); return OK; } else { $r-push_handlers('PerlHandler' = 'FES::Control::View'); return OK; } ## ARE THOSE THE CORRECT THINGS TO 'RETURN' FOR THESE CASES? } 1; == And the Logout.pm: = package FES::Control::Logout; use strict; use Apache; use Apache::Constants qw(:common); use FES::Common::Common qw( header footer); use CGI qw/:standard/; use CGI::Cookie; sub handler { my $r = shift; my $q = new CGI; my $ticket = _get_ticket('r' = $r); ## HERE IS WHERE I NEED TO 1.) DELETE USER'S TICKET COOKIE AND ## 2.) REDIRECT THEM TO /FES (w/o bringing old $r),(WHERE THEY SHOULD GET ## A NEW LOGIN SCREEN BECAUSE COOKIE IS GONE.) } sub _get_ticket { my $args = { 'r' = undef, @_ }; my $r = $args-{'r'}; my %cookies = CGI::Cookie-parse($r-header_in('Cookie')); # TESTING my %ticket = $cookies{'Ticket'}-value; # TESTING return \%ticket; } 1; = Set it again with an expiration time of 'now', i actually use it with CGI.pm You can send it with a custom invalid value, like 'invalidated', and take apropriate actions. Hans Poo
Re: Redirections after printing content
Andrew Ho wrote: Hans, HPI'am new to the list, and i've been looking for a solution for HPbuffering, in order to decide to make a redirect after the printing of HPHTML content. It seems that $| don't work fot this. Whether or not you have $| on, you will want to explicitly control whether output is sent if you may want to do a redirect at some point in your code. There are two simple ways to rearrange your code to do this from a mod_perl handler or Apache::Registry scripts. The first is to determine what all the cases are where you would do a redirect. Then put this code up front, before you output anything. The second method would be to organize your code so that instead of using print or calling $r-print(), you accumulate your output into a variable. At the end of your handler() or Apache::Registry script, you can either redirect, or print the accumulated output. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 -- Thank you Andrew I was already aware of the solutions you gave me, and it's comfortable to listen another programmer who seems exactly the same. I was expecting to find something new inside mod_perl to do the job. Actually i keep the redirection code in top of the application and it's not a clean solution. Put a wraper around the print statement seems the cleaner solution after all. I don't want to reinvent the wheel and finally decided to use Apache::ASP with it's buffering capabilities. Hans Poo begin:vcard n:Poo;Hans tel;cell:09-3318955 tel;work:2327992 x-mozilla-html:FALSE url:www.namb.cl org:New Art Media Business;System Administration adr:;;El Bosque Sur 77 Of.1 ;Santiago;RM;na;Chile version:2.1 email;internet:[EMAIL PROTECTED] x-mozilla-cpt:;0 fn:Hans Poo end:vcard
Re: proxy block list module?
Mark Tiramani wrote: I was looking for an Apache module to handle access control via URL/regex that reads a list of rules from file. I find it hard to believe no-one has done this yet so appologies in advance if I just didn't search properly. I tried searching all the usual sources but came up blank so I adapted the Apache::BlockAgent handler from the Eagle book (excellent). If anyone has more info on an existing module/handler I'd be grateful. The original requirement was to control a clients proxy access so that only a list of about 30 URLs were accessible from their LAN. I needed an Apache config directive and handler that reads its list of names/IPs/regexes from a text file, caches the list at startup/restart and stats the text file so that additions/alterations take immediate effect. The list has to be an 'allow' list as well as a 'deny' list so that the overhead is minimised and admin tools have an easier job of controlling access by editing/validating only one file. Just in case there really are no such modules out there: Apache::URLControl.pm is still pretty basic but it does the following: Adds an Apache config directive that specifies a ServerRoot relative text file: PerlSetVar URLControlFile access_filters/url_control PerlPostReadRequestHandler Apache::URLControl URLControl.pm currently handles the request as a: PerlPostReadRequestHandler in two test setups. Used in this way it is obviously not proxy-specific and blocks/allows requests at the earliest opportunity. The control file can contain: DEFAULT DENY www.adomain.com ALLOW anotherdomain.com DENY http://somewhere.com/.*.asp DENY https://domain.com/ 194.164.46.4/blah/blah /apath/asubdir/afile.htm .*microsoft.* DENY # a comment etc. If DEFAULT DENY is used then only access to locations matching an ALLOW line are allowed. Otherwise the list can contain specific DENY rules and if DENY is omitted the rule defaults to DENY. If the rule begins with https:// then a CONNECT adomain.com:443 is denied or allowed. The rule could also be written as: adomain.com:443 DENY The '.' in domain.com and index.htm are escaped in the module, as are %,/,+ This just simplifies writing the file somewhat. Otherwise the Perl regex in a rule is handled as-is. A 403 is returned if the request is blocked but the URL from $r-the_request is substituted for $r-uri so that proxy requests are denied with the full URL as the reason and not '/'. If anyone is interested I will stress-test it and then enter the module to CPAN. If there is nothing similar I will develop it to allow for cached IP lookups (to convert the IP-domain name and match on that in the list) and add other refinements. Mark Mark Tiramani FREDO Internet Services [EMAIL PROTECTED] Hi What you need is mod_rewrite module from Ralf Engelshall. Hans Poo
Redirections after printing content
Hi I'am new to the list, and i've been looking for a solution for buffering, in order to decide to make a redirect after the printing of HTML content. It seems that $| don't work fot this. I take a look around and this capacity seem to appear in Apache:ASP at this time i can't use this module, and i just have mod_perl. Hans Poo