cvs commit: modperl-2.0/t/response/TestCompat request_body.pm

2002-12-15 Thread stas
stas2002/12/15 00:30:40

  Modified:.Changes
   lib/Apache compat.pm
   t/conf   modperl_extra.pl
   t/compat request_body.t
   t/response/TestCompat request_body.pm
  Log:
  fix the method content() in Apache::compat to read a whole request
  body. same for ModPerl::Test::read_post. add tests.
  
  Revision  ChangesPath
  1.84  +3 -0  modperl-2.0/Changes
  
  Index: Changes
  ===
  RCS file: /home/cvs/modperl-2.0/Changes,v
  retrieving revision 1.83
  retrieving revision 1.84
  diff -u -r1.83 -r1.84
  --- Changes   15 Dec 2002 07:43:40 -  1.83
  +++ Changes   15 Dec 2002 08:30:39 -  1.84
  @@ -10,6 +10,9 @@
   
   =item 1.99_08-dev
   
  +fix the method content() in Apache::compat to read a whole request
  +body. same for ModPerl::Test::read_post. add tests.  [Stas]
  +
   Adjust the reverse filter test to work on win32 (remove trailing \r)
   [Randy Kobes [EMAIL PROTECTED]]
   
  
  
  
  1.75  +11 -7 modperl-2.0/lib/Apache/compat.pm
  
  Index: compat.pm
  ===
  RCS file: /home/cvs/modperl-2.0/lib/Apache/compat.pm,v
  retrieving revision 1.74
  retrieving revision 1.75
  diff -u -r1.74 -r1.75
  --- compat.pm 6 Dec 2002 13:09:15 -   1.74
  +++ compat.pm 15 Dec 2002 08:30:40 -  1.75
  @@ -241,6 +241,8 @@
   return $r-parse_args($args);
   }
   
  +use constant IOBUFSIZE = 8192;
  +
   sub content {
   my $r = shift;
   
  @@ -248,13 +250,17 @@
   
   return undef unless $r-should_client_block;
   
  -my $len = $r-headers_in-get('content-length');
  -
  +my $data = '';
   my $buf;
  -$r-get_client_block($buf, $len);
  +while (my $read_len = $r-get_client_block($buf, IOBUFSIZE)) {
  +if ($read_len == -1) {
  +die some error while reading with get_client_block;
  +}
  +$data .= $buf;
  +}
   
  -return $buf unless wantarray;
  -return $r-parse_args($buf)
  +return $data unless wantarray;
  +return $r-parse_args($data);
   }
   
   sub clear_rgy_endav {
  @@ -316,8 +322,6 @@
   $r-read($line, $r-headers_in-get('Content-length'));
   $line ? $line : undef;
   }
  -
  -use constant IOBUFSIZE = 8192;
   
   #XXX: howto convert PerlIO to apr_file_t
   #so we can use the real ap_send_fd function
  
  
  
  1.21  +10 -4 modperl-2.0/t/conf/modperl_extra.pl
  
  Index: modperl_extra.pl
  ===
  RCS file: /home/cvs/modperl-2.0/t/conf/modperl_extra.pl,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- modperl_extra.pl  7 Oct 2002 02:35:18 -   1.20
  +++ modperl_extra.pl  15 Dec 2002 08:30:40 -  1.21
  @@ -47,6 +47,8 @@
   $server-log-info(base server + $vhosts vhosts ready to run tests);
   }
   
  +use constant IOBUFSIZE = 8192;
  +
   sub ModPerl::Test::read_post {
   my $r = shift;
   
  @@ -54,12 +56,16 @@
   
   return undef unless $r-should_client_block;
   
  -my $len = $r-headers_in-get('content-length');
  -
  +my $data = '';
   my $buf;
  -$r-get_client_block($buf, $len);
  +while (my $read_len = $r-get_client_block($buf, IOBUFSIZE)) {
  +if ($read_len == -1) {
  +die some error while reading with get_client_block;
  +}
  +$data .= $buf;
  +}
   
  -return $buf;
  +return $data;
   }
   
   sub ModPerl::Test::add_config {
  
  
  
  1.2   +30 -16modperl-2.0/t/compat/request_body.t
  
  Index: request_body.t
  ===
  RCS file: /home/cvs/modperl-2.0/t/compat/request_body.t,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- request_body.t15 Aug 2002 09:35:11 -  1.1
  +++ request_body.t15 Dec 2002 08:30:40 -  1.2
  @@ -6,7 +6,7 @@
   use Apache::TestUtil;
   use Apache::TestRequest;
   
  -plan tests = 3;
  +plan tests = 5;
   
   my $location = /TestCompat::request_body;
   
  @@ -41,6 +41,35 @@
   );
   }
   
  +# encoding/decoding
  +{
  +my %data = (
  +test = 'decoding',
  +body = '%DC%DC+%EC%2E+%D6%D6+%D6%2F',
  +);
  +ok t_cmp(
  +$data{body},
  +GET_BODY(query(%data)),
  +q{decoding}
  +   );
  +}
  +
  +
  +# big POST
  +{
  +my %data = (
  +test = 'big_input',
  +body = ('x' x 819_235),
  +   );
  +my $content = join '=', %data;
  +ok t_cmp(
  +length($data{body}),
  +POST_BODY($location, content = $content),
  +q{big POST}
  +   );
  +}
  +
  +
   
   ### helper subs ###
   sub query {
  @@ -48,18 +77,3 @@
   $location? . join '', map { $_=$args{$_} } keys %args;
   }
   
  -# accepts multiline var where, the lines 

cvs commit: modperl-2.0/xs/APR/APR Makefile.PL

2002-12-15 Thread stas
stas2002/12/15 00:49:24

  Modified:xs/APR/APR Makefile.PL
  Log:
  s/qx/qq/; need to build the string not to run it
  
  Revision  ChangesPath
  1.7   +2 -1  modperl-2.0/xs/APR/APR/Makefile.PL
  
  Index: Makefile.PL
  ===
  RCS file: /home/cvs/modperl-2.0/xs/APR/APR/Makefile.PL,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Makefile.PL   28 Nov 2002 08:43:33 -  1.6
  +++ Makefile.PL   15 Dec 2002 08:49:24 -  1.7
  @@ -6,8 +6,9 @@
   
   # XXX: this works only with libapr 0.9.2+ (not on win32)
   my @libs = grep $_, map { -x $_  qx{$_ --link-ld} }
  -map { qx{$prefix/bin/$_-config} } qw(apr apu);
  +map { qq{$prefix/bin/$_-config} } qw(apr apu);
   chomp @libs;
  +
   my $define = @libs ? '-DMP_HAVE_APR_LIBS' : '';
   
   ModPerl::MM::WriteMakefile(
  
  
  



Re: mod_perl 2.0 trouble compiling = cannont find -lapr -laprutil

2002-12-15 Thread Stas Bekman
So, I have updated my src of apache, arp and mod_perl2 from cvs.  Still the exact same result.


I've messed up while adjusting for the new libapr's naming. it's fixed now in 
cvs. Though you shouldn't have had a problem in first place. it'd have just 
skipped linking to the apr libs and shouldn't have caused a problem.

In any case. Please update your cvs version and try again. If you fail, please 
check that you build against the new versions that you have installed. that's 
make sure that you've deleted all the old installs, if they are no longer needed.

If you still fail, post a complete report as explained here:
http://perl.apache.org/docs/2.0/user/help/help.html#Reporting_Problems

__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com



Re: Problems with Apache::compat and german special chars

2002-12-15 Thread Stas Bekman
[perl.apache.org keeps on timing out once in a while :( reposting]

Tom Schindl wrote:
 Problems with Apache::compat

 CGI-PARAM-STRING: header=%DC%DC%DC%DCbody=%D6%D6%D6%D6type=save_thread

 cut--
 [Sun Dec 08 21:39:09 2002] [error] [client 127.0.0.1] Character in c
 format wrapped at
 
/usr/bestsolution/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/Apache2/Apache/compat.pm 
line 217.
 , referer: http://localhost/discussion-board
 cut--

 When I copy the lines of interest into a small perl program and execute
 it, everything works perfectly. What's going wrong there?

 cut--
 map { s/%([0-9a-fA-F]{2})/pack(c,hex($1))/ge; $_; } split /[=;]/,
 $string, -1
 cut--

Doug has fixed this already in the cvs version of mod_perl. Ditto for the
s/+/ / transform:

revision 1.71
date: 2002/11/23 22:35:06;  author: dougm;  state: Exp;  lines: +2 -0
PR:
Obtained from:
Submitted by: Walery Studennikov [EMAIL PROTECTED]
Reviewed by:  dougm
tr/+/ /; in parse_args compat method

revision 1.70
date: 2002/10/21 20:21:34;  author: dougm;  state: Exp;  lines: +1 -1
PR:
Obtained from:
Submitted by:   Walery Studennikov [EMAIL PROTECTED]
Reviewed by:dougm
fix parse_args compat method to support non-ascii characters

The problem was that the buggy code was doing pack(c, $num) which 
expects a
number in range -128..127, whereas a fixed version does pack(C, $num), 
which works with 0..255.




_
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/




Re: [mp2] Byterange requests

2002-12-15 Thread Stas Bekman
Nathan Byrd wrote:

Hi all,

I'm currently attempting to upgrade Apache::PAR to work with mod_perl 2,
and one of the issues I am running into is with byterange requests:

With mod_perl 1.x, it was possible (using Apache::File) to use
byteranges with requests using $r-each_byterange and $r-set_byterange
(a good example is in the mod_perl Developer's Cookbook, section 6.7,
Byteserving and Range Requests.)

It appears that with Apache2/mod_perl2 ap_each_byterange and
ap_set_byterange are no longer available, replaced instead by a protocol
filter in Apache.  The only documentation for Apache I could find
regarding this is at
http://httpd.apache.org/docs-2.0/developer/filters.html - in that
document, it explains that Byterange:  We have coded it to be inserted
for all requests, and it is removed if not used.

Does anyone know if the above statement includes mod_perl requests, or
is there another workaround to send byterange responses with mod_perl
modules?  I suppose it could be implemented in the module itself (or as
a patch to mod_perl, maybe in Apache::Response), but I don't want to
attempt that if the byterange filter could be run anyway for a request.


I've read the ap_byterange_filter() code (modules/http/http_protocol.c) and it 
has all the bytecode functionality in that function, plus a helper 
ap_set_byterange, which is private to that filter, so it can't be used by 
mod_perl.

If I understand correctly the benefits of slicing the response in the response 
handler is good if it somehow saves memory/CPU cycles. Otherwise 
byterange_filter will do that work for you.

It looks like implementing this functionality as a third party module is a 
good idea. Mostly likely you can simply rip off the code from 
ap_byterange_filter, making it more modular and then adding the XS to have the 
perl api. Or you can write the whole thing in perl. I think all the 
ingredients are readily available.

__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com



in window, mod perl 1, how to get time?

2002-12-15 Thread eric
since I untar mod perl 2 of apache, I did not have anything in perl's
directory in my C:/Apache2

I have 2 line in my conf/httpd.conf
 
LoadFile C:/Perl/bin/perl56.dll
LoadModule perl_module modules/mod_perl.so
 
so my /perl is created my download from perl 1.exe file

so how can I get the time display?

in my .pl file, two lines as
-

 my @time = time;
print Right now, the elements of the time are: @time;
-
Please help on this
sincere Eric
www.linuxspice.com
linux pc for sale