internet redirection
Greeting I have a programing doing interent redirect after reading a cookie and doing some authentication. I return the OK constant after the redirection, but it seems that a bunch of other calls are being made to the server. Specifically, if you use your browser to call http://www.mysite.com/home/ it calles a module and the module redirects to http://www.mysite.com/home/restricted/index.html then I return OK. However http://www.mysite.com/home/restricted/ is controlled by a perl module which authenticates. After this module finished, I expected to be done for everything that's a text/html type file. It does some form parsing and returns ok like this: print STDERR CHOOSE3: FileHandle $fh : Line 48\n; print STDERR CHOOSE3: FileHandle $fh : Line 48\n; $r-send_http_header; my $data; while($data = $fh){ if($data =~ /!--\s*#(\w+?)\svirtual=\(.*?)\\s*--/){ $data =~ s/!--\s*#(\w+?)\svirtual=\(.*?)\\s*--/include_file($r,$2)/ges; print STDERR GOT $1 $2\n; } $r-print($data); } print STDERR MUST STOP HERE Line 59\n; return OK; } print STDERR MUST NOT BE HERE Line 62\n; return OK; } It seems to end, and then I get a bunch of calls from the original URL which was called for more files, even index.html again. Ideally, after return OK, it is finished retreiving files. I'm thinking of using Apache exit. I can't seem to get it to stop cold at this line (Line 59). It's like the module stops, and then the redirecting lines in the previous module just keeps calling things and ignorns it's return stop command. print STDERR LINE 72\n; if($status[0] eq 'AUTH' and $obj-site eq 'restricted'){ $r-internal_redirect(http://$server/restricted/index.html;); print STDERR THIS SHOULD NOT BE REACHED LINE 77\n; return OK; print STDERR THIS SHOULD NOT BE REACHED LINE 79\n; } print STDERR LINE 80\n; 79 is not called, but a bunch of calls are made in the logs with the referer from http:/www.mysite.com/ into the restricted directory. I've done a hack to decline the processing of these calls, but it seems they shouldn't be being created in the first place. Ruben
send_httpd_headers
Is there a way to know that headers have already been sent before send headers out? Ruben
Re: internet redirection
BTW No only is that internet redirectionb, but it is also INTERNAL redirection it's been a long day. Ruben Greeting I have a programing doing interent redirect after reading a cookie and doing some authentication. I return the OK constant after the redirection, but it seems that a bunch of other calls are being made to the server. Specifically, if you use your browser to call http://www.mysite.com/home/ it calles a module and the module redirects to http://www.mysite.com/home/restricted/index.html then I return OK. However http://www.mysite.com/home/restricted/ is controlled by a perl module which authenticates. After this module finished, I expected to be done for everything that's a text/html type file. It does some form parsing and returns ok like this: print STDERR CHOOSE3: FileHandle $fh : Line 48\n; print STDERR CHOOSE3: FileHandle $fh : Line 48\n; $r-send_http_header; my $data; while($data = $fh){ if($data =~ /!--\s*#(\w+?)\svirtual=\(.*?)\\s*--/){ $data =~ s/!--\s*#(\w+?)\svirtual=\(.*?)\\s*--/include_file($r,$2)/ges; print STDERR GOT $1 $2\n; } $r-print($data); } print STDERR MUST STOP HERE Line 59\n; return OK; } print STDERR MUST NOT BE HERE Line 62\n; return OK; } It seems to end, and then I get a bunch of calls from the original URL which was called for more files, even index.html again. Ideally, after return OK, it is finished retreiving files. I'm thinking of using Apache exit. I can't seem to get it to stop cold at this line (Line 59). It's like the module stops, and then the redirecting lines in the previous module just keeps calling things and ignorns it's return stop command. print STDERR LINE 72\n; if($status[0] eq 'AUTH' and $obj-site eq 'restricted'){ $r-internal_redirect(http://$server/restricted/index.html;); print STDERR THIS SHOULD NOT BE REACHED LINE 77\n; return OK; print STDERR THIS SHOULD NOT BE REACHED LINE 79\n; } print STDERR LINE 80\n; 79 is not called, but a bunch of calls are made in the logs with the referer from http:/www.mysite.com/ into the restricted directory. I've done a hack to decline the processing of these calls, but it seems they shouldn't be being created in the first place. Ruben
Limiting Input size
Is there a way error out of an entry which might be too large in a form or a get string with $r-content or $r-args I want to prevent an attempt to overflow the memory by sending an arguement with 10 billion bytes. I can do it after. But without doing a read(), I'm wondering if these shortcuts provide security protection in this regargd, or if there is a better solution? Ruben
Re: Limiting Input size
Thank You!! Can I mix and match, by doing Anything I can do about the get string? Ruben On 06 Jul 2001 02:41:30 -0400, Brooklyn Linux Solutions CEO wrote: Is there a way error out of an entry which might be too large in a form or a get string with $r-content or $r-args I want to prevent an attempt to overflow the memory by sending an arguement with 10 billion bytes. I can do it after. But without doing a read(), I'm wondering if these shortcuts provide security protection in this regargd, or if there is a better solution? perldoc Apache::Request Also see the Apache docs. Matt.
Re: Directory Restrictions
I found it, quite be accident in the Eagle Book Lost the page number, but it was in Chapter 4. ruben anybody got a handy link to point us in the right direction here? how can you have mod_perl intercept the directory listing?
Re: SSI Lost with Mod Perl?
Hi Perrin I've given Filter and SSI a shot according to the perldocs. It didn't work. I stated to hhack on some of the problems, which first involved in the make install depositing them in the wrong diretory, and then they SSI needed use Apache::Filter statements added. Finally, Filter cam back with an error that something or other $r wasn't a hash reference, which would not be a quick fix. So I've sort of hacked up my own little SSI for the time being and deposited it in the modules. I'm missing something in my understanding at this pointbut this project has me climbing a wall, and I'm pushing a head for the time being. I had a similar problem at one time with embperl and we had to also hack that together. I'm definetely bathing in a Brooklyn Larger Bath when this is done. Ruben IS there a way of pre-processing and post processing a handler? Only by using something like Apache::Filter. Apache itself does not support chaining handlers. - Perrin
Re: Directory Restrictions
One thing that is not clear in my mind is the type of page which is sent back with a directory index. A directory index is of what mime type? Ruben On Sat, Jun 23, 2001 at 11:10:07PM -0400, Brooklyn Linux Solutions CEO wrote: I've been working on a mod_perl implimentation which does the following. ... I have something like this running on the top directory: sub handler{ my $r = shift; return DECLINED if ($r-uri() =~ /top/home.html); return DECLINED if ($r-uri() =~ /top/login.html); return DECLINED if ($r-uri() =~ /top/lower_dir1); return DECLINED if ($r-uri() =~ /top/lower_dir2); return DECLINED if (!$r-content_type('text/html)); return DECLINED if ($r-content_type('images/gif)); i bet you mistyped some of that... val =~ /pattern/flags maybe something more like: return DECLINED if ($r-uri() =~ m{/top/((home|login).html|lower_dir[12])}); It's doing an internal redirect when they are autorized for on of the lower directories, but the graphics are still now getting through to the top if I remove the DECLINED content_type 'text/html'. But when I leave it in, they seem to have access to the directory access. hmm -- ! text/html should make images/gif redundant, i'd think. anybody got a pointer, here? -- I figure: if a man's gonna gamble, may as well do it without plowing. -- Bama Dillert, Some Came Running [EMAIL PROTECTED] http://sourceforge.net/projects/newbiedoc -- we need your brain! http://www.dontUthink.com/ -- your brain needs us!
Re: SSI Lost with Mod Perl?
IS there a way of pre-processing and post processing a handler? Ruben Brooklyn Linux Solutions CEO wrote: I have modules controlling all the files and their access and content in the directy. I have no idea really why SSI is shut down. I never used it before. It looks like you're trying to post-process the output of a PerlHandler with SSI. The only way to do that is by using Apache::SSI and Apache::Filter, as described here: http://search.cpan.org/doc/KWILLIAMS/Apache-SSI-2.16/SSI.pm - Perrin
Re: which perl?
I recommend whatever stas is saying. Ruben actually yes, they appear to be in the right order: $ perl -V Characteristics of this binary (from libperl): Compile-time options: USE_LARGE_FILES Built under linux Compiled at May 23 2001 08:18:14 @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 and yet, mod perl is still showing that it's using 5.6.0... note- the results i get from a script running under mod_perl is slightly different, but 5.6.1 is indeed first. (this is the output of @INC) /usr/local/lib/perl5/5.6.1 /usr/local/lib/perl5/site_perl/5.6.1 /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 i may have misunderstood- were you recommending that i actually delete these 5.6.0 directories, and symlink them over to the 5.6.1 equivs?
Re: Directory Restrictions
When you get a directory index, what Mime type is that? Ruben
Re: Directory Restrictions
thanks I didn't see that in the mine.types Ruben On Sunday 24 June 2001 20:23, Brooklyn Linux Solutions CEO wrote: When you get a directory index, what Mime type is that? httpd/unix-directory Maybe it's different in windows, I don't know. -- ___ Robin Berjon [EMAIL PROTECTED] -- CTO k n o w s c a p e : // venture knowledge agency www.knowscape.com --- Sex is not the answer. Sex is the question. Yes is the answer.
Directory Restrictions
Hello I've been working on a mod_perl implimentation which does the following. New users gain access to a directory, but can not get access to two directories underneath it. After logging in and receiving a cookie, they are automatically shunted to one of the two low directories. I've had some unexpected difficulty with the images of the html files. I have something like this running on the top directory: sub handler{ my $r = shift; return DECLINED if ($r-uri() =~ /top/home.html); return DECLINED if ($r-uri() =~ /top/login.html); return DECLINED if ($r-uri() =~ /top/lower_dir1); return DECLINED if ($r-uri() =~ /top/lower_dir2); return DECLINED if (!$r-content_type('text/html)); return DECLINED if ($r-content_type('images/gif)); My problem is that they can still see the directory index. I need It's doing an internal redirect when they are autorized for on of the lower directories, but the graphics are still now getting through to the top if I remove the DECLINED content_type 'text/html'. But when I leave it in, they seem to have access to the directory access. Ruben
SSI Lost with Mod Perl?
I've seemed to have lost my ability to use SSI whenI use the content handlers with Mod_perl. Is there anyway I can fix this? Ruben
Re: which perl?
It's got to be built in. My mod_perl conf keeps looking in 5.6.0 in the @INC array even after the 5.6.1 upgrade which was more or less forced on me by cpan. It kind of ticks me off those guys who install modules on CPAN which upgrade by damn perl. NET::FTP of libnet is a big culprit of this. Ruben gotcha. so it's 5.6.0... however i'm still really curious about whether mod_perl 'builds in' the interpreter when you build apache, or is it when you run apache? what i'm actually trying to do is get mod_perl to use a different version of perl also installed on my system, 5.6.1, so as to settle some problems within mason causing the httpd child processes to segfault.
Re: which perl?
It's got to be built in. My mod_perl conf keeps looking in 5.6.0 in the @INC array even after the 5.6.1 upgrade I got sick of the problem and linked 5.6.1 into 5.6.0 Ruben
Re: SSI Lost with Mod Perl?
Will it work by default or do I need to chain it somehow? Ruben I've seemed to have lost my ability to use SSI whenI use the content handlers with Mod_perl. Is there anyway I can fix this? Can you be more specific about what you're trying to do? You can still use mod_include with mod_perl installed, and you can use Apache::SSI either alone or as a filter with Apache::Filter. Does that help? - Perrin (P.S. I'm in Brooklyn too!)
Re: which perl?
use lib qw(/usr/lib/perl5/5.6.1 /usr/lib/perl5/site_perl/5.6.1); note that lib.pm takes care of adding the arch lib paths (i686-linux on my machine) and removing dups. Really I asked this question and didn't get much of an answer from folks other than they THOUGHT it was built in the perl binary.