Re: submit-data and chained handlers
Perrin Harkins wrote: Apache::RequestNotes don't work because Apache::Registry expect to read the POST/PUT-data from STDIN. It's important that the cgi-scripts run unmodified and without any notice of their unnaturally environment. I don't think there's any way around the fact that you can only read the content once. That means you need to read and store it for other handlers to use, which is what Apache::RequestNotes does. Alternatively, you could add something to your Registry script that stuffs the parsed values into pnotes yourself after using them. If you put that inside a block that checks for $ENV{'MOD_PERL'}, you'll still be able to run the script safely under standard CGI. It also looks like you're re-inventing Apache::Filter or Apache::OutputChain. Have you tried them? I agree - Apache::Filter is really the defacto standard here. no reason to reinvent the wheel... anyway, I'm really loving Apache::RegistryNG and ties these days... go figure, I had to search for weeks for a decent Apache::RegistryNG subclassing example for the book, but in two weeks the list provides two examples that are probably better (though not as illustrative and harder to explain). anyway, I'm sure this is incomplete, but someone else around here can hack it up more - the READ interface is pretty much stolen from Apache::Filter, so I assume it works... package My::CachePOSTRegistry; use Apache::Constants qw(DONE); use Apache::RegistryNG; use Apache::Request; use strict; @My::CachePOSTRegistry::ISA = qw(Apache::RegistryNG); sub new { my ($class, $r) = @_; $r = Apache::Request-instance($r || Apache-request); tie *STDIN, $class, $r; return tied *STDIN; } sub READ { my $self = shift; my $buf = \($_[0]); shift; my $len = shift; my $offset = shift || 0; my @args = (); $self-{r}-param-do(sub { push @args, join '=', @_; 1; }); my $input = join '', @args; substr($$buf, $offset) = substr($input, 0, $len); substr($input, 0, $len) = ''; return length substr($$buf, $offset); } sub TIEHANDLE { my ($class, $r) = @_; return bless { r = $r }, $class; } 1; I did a quick test with #!/usr/bin/perl my $posted; read(STDIN, $posted, $ENV{'CONTENT_LENGTH'}); my $again; read(STDIN, $again, $ENV{'CONTENT_LENGTH'}); print Content-type: text/plain\n\n; print posted: $posted\nagain: $again\n; --Geoff
Re: submit-data and chained handlers
e.g. $r-read($in,$r-header_in('Content-length')); or $in=$r-content(); give's my handler the data, but unfotunately exclusive - so the data don't reaches Apache::Registry and the cgi-script. Any suggests? Apache::RequestNotes. - Perrin No, Apache::RequestNotes doesn't solve my problem. Please look at this: Files *.pl SetHandler perl-script PerlHandler Apache::qwerty Apache::ChainBuffer Apache::Registry Options +ExecCGI PerlSendHeader On /Files Apache::Registry processes ordinary cgi-scripts, Apache::ChainBuffer buffers the generated content and Apache::qwerty have to parse and/or modify the whole content. All this works fine. But Apache::qwerty also have to get at the data submitted by the browser in POST/PUT requests. The Eagle Book discribes how to use the $r-read() or $r-content() function to read the data from STDIN, but using one of this functions befor the Apache::Registry handler is involved clears the data buffer and the cgi-scripts don't run correctly. If I use one of this functions after Apache::Registry is called, the data buffer is allready cleared and so Apache::qwerty can't get at the data. Apache::RequestNotes don't work because Apache::Registry expect to read the POST/PUT-data from STDIN. It's important that the cgi-scripts run unmodified and without any notice of their unnaturally environment. bb, Gerald Menzel.
Re: submit-data and chained handlers
Apache::RequestNotes don't work because Apache::Registry expect to read the POST/PUT-data from STDIN. It's important that the cgi-scripts run unmodified and without any notice of their unnaturally environment. I don't think there's any way around the fact that you can only read the content once. That means you need to read and store it for other handlers to use, which is what Apache::RequestNotes does. Alternatively, you could add something to your Registry script that stuffs the parsed values into pnotes yourself after using them. If you put that inside a block that checks for $ENV{'MOD_PERL'}, you'll still be able to run the script safely under standard CGI. It also looks like you're re-inventing Apache::Filter or Apache::OutputChain. Have you tried them? - Perrin
Re: submit-data and chained handlers
e.g. $r-read($in,$r-header_in('Content-length')); or $in=$r-content(); give's my handler the data, but unfotunately exclusive - so the data don't reaches Apache::Registry and the cgi-script. Any suggests? Apache::RequestNotes. - PerrinI use Win2k and it seems there is no Win32 port of libapreq!? Exists anyother way?
Re: submit-data and chained handlers
I use Win2k and it seems there is no Win32 port of libapreq!? Exists any other way? Check out http://theoryx5.uwinnipeg.ca/ppmpackages/ , there are a number of PPD packages (to use with ActiveState ppm) there, by Randy Kobes. Use ppm install http://theoryx5.uwinnipeg.ca/ppmpackages/libapreq.ppd; to get it. -- Per Einar Ellefsen [EMAIL PROTECTED]
submit-data and chained handlers
Hi, I have two stacked content handlers in a pipeline. At first Apache::Registry and as the second my own handler for parsing Apache::Registry's output of ordinary Perl scripts. Works fine. But I want to catch everything that passes in or out Apache::Registry - also the data of submit-forms sent to the cgi-scripts by the client. I have tried different ways but I can't figure out how (or whether) that's possible. e.g. $r-read($in,$r-header_in('Content-length')); or $in=$r-content(); give's my handler the data, but unfotunately exclusive - so the data don't reaches Apache::Registry and the cgi-script. Any suggests? Thanks. Gerald Menzel.
Re: submit-data and chained handlers
e.g. $r-read($in,$r-header_in('Content-length')); or $in=$r-content(); give's my handler the data, but unfotunately exclusive - so the data don't reaches Apache::Registry and the cgi-script. Any suggests? Apache::RequestNotes. - Perrin