You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apreq-cvs@httpd.apache.org by pg...@apache.org on 2006/10/29 03:42:27 UTC
svn commit: r468822 - in /httpd/apreq/branches/v2_09: ./ build/
glue/perl/lib/Apache2/ glue/perl/t/apreq/ glue/perl/t/response/TestApReq/
module/t/ module/t/c-modules/apreq_upload_test/
Author: pgollucci
Date: Sat Oct 28 19:42:26 2006
New Revision: 468822
URL: http://svn.apache.org/viewvc?view=rev&rev=468822
Log:
sync with changes on trunk since branch
Added:
httpd/apreq/branches/v2_09/glue/perl/t/apreq/cookie2.t
httpd/apreq/branches/v2_09/glue/perl/t/response/TestApReq/cookie2.pm
httpd/apreq/branches/v2_09/module/t/c-modules/apreq_upload_test/
httpd/apreq/branches/v2_09/module/t/c-modules/apreq_upload_test/10k (with props)
httpd/apreq/branches/v2_09/module/t/c-modules/apreq_upload_test/128k (with props)
httpd/apreq/branches/v2_09/module/t/c-modules/apreq_upload_test/1b (with props)
httpd/apreq/branches/v2_09/module/t/c-modules/apreq_upload_test/1k (with props)
httpd/apreq/branches/v2_09/module/t/c-modules/apreq_upload_test/63k (with props)
httpd/apreq/branches/v2_09/module/t/c-modules/apreq_upload_test/64k (with props)
httpd/apreq/branches/v2_09/module/t/c-modules/apreq_upload_test/65k (with props)
httpd/apreq/branches/v2_09/module/t/c-modules/apreq_upload_test/mod_apreq_upload_test.c
httpd/apreq/branches/v2_09/module/t/upload.t
Modified:
httpd/apreq/branches/v2_09/FAQ.pod
httpd/apreq/branches/v2_09/build/WEBSITE
httpd/apreq/branches/v2_09/glue/perl/lib/Apache2/Cookie.pm
httpd/apreq/branches/v2_09/glue/perl/t/response/TestApReq/big_input.pm
httpd/apreq/branches/v2_09/glue/perl/t/response/TestApReq/cookie.pm
httpd/apreq/branches/v2_09/glue/perl/t/response/TestApReq/inherit.pm
httpd/apreq/branches/v2_09/glue/perl/t/response/TestApReq/request.pm
httpd/apreq/branches/v2_09/glue/perl/t/response/TestApReq/upload.pm
Modified: httpd/apreq/branches/v2_09/FAQ.pod
URL: http://svn.apache.org/viewvc/httpd/apreq/branches/v2_09/FAQ.pod?view=diff&rev=468822&r1=468821&r2=468822
==============================================================================
--- httpd/apreq/branches/v2_09/FAQ.pod (original)
+++ httpd/apreq/branches/v2_09/FAQ.pod Sat Oct 28 19:42:26 2006
@@ -50,6 +50,9 @@
I<Apache2::Upload> is now a separate module in apreq2, so you need to
C<use Apache2::Upload> to load the C<Apache2::Request::upload> function.
+This also applies to "Can't locate auto/APR/Request/Param/slurp.al in @INC".
+This is because I<Apache2::Upload> is implement by wrapping the I<APR::Request::*>
+packages.
Modified: httpd/apreq/branches/v2_09/build/WEBSITE
URL: http://svn.apache.org/viewvc/httpd/apreq/branches/v2_09/build/WEBSITE?view=diff&rev=468822&r1=468821&r2=468822
==============================================================================
--- httpd/apreq/branches/v2_09/build/WEBSITE (original)
+++ httpd/apreq/branches/v2_09/build/WEBSITE Sat Oct 28 19:42:26 2006
@@ -64,6 +64,13 @@
7) Login (via ssh) to people.apache.org and do
+ MAKE SURE your umask is 2
+ $ umask
+ 22
+ $ umask 2
+ $ umask
+ 2
+
$ cd /www/httpd.apache.org
$ svn update index.html apreq/
Modified: httpd/apreq/branches/v2_09/glue/perl/lib/Apache2/Cookie.pm
URL: http://svn.apache.org/viewvc/httpd/apreq/branches/v2_09/glue/perl/lib/Apache2/Cookie.pm?view=diff&rev=468822&r1=468821&r2=468822
==============================================================================
--- httpd/apreq/branches/v2_09/glue/perl/lib/Apache2/Cookie.pm (original)
+++ httpd/apreq/branches/v2_09/glue/perl/lib/Apache2/Cookie.pm Sat Oct 28 19:42:26 2006
@@ -483,7 +483,7 @@
Changes to the 1.X API:
-=over 4
+=over 5
=item * C<Apache2::Cookie::fetch> now expects an C<$r> object as (second)
argument, although this isn't necessary in mod_perl 2 if
@@ -493,6 +493,9 @@
=item * C<Apache2::Cookie::parse> is gone.
=item * C<Apache2::Cookie::new> no longer encodes the supplied cookie name.
+
+=item * C<Apache2::Cookie::new()> returns undef if -value is not specified
+ or -value => undef.
=item * C<name()> and C<value()> no longer accept a "set" argument. In other words,
neither a cookie's name, nor its value, may be modified. A new cookie
Added: httpd/apreq/branches/v2_09/glue/perl/t/apreq/cookie2.t
URL: http://svn.apache.org/viewvc/httpd/apreq/branches/v2_09/glue/perl/t/apreq/cookie2.t?view=auto&rev=468822
==============================================================================
--- httpd/apreq/branches/v2_09/glue/perl/t/apreq/cookie2.t (added)
+++ httpd/apreq/branches/v2_09/glue/perl/t/apreq/cookie2.t Sat Oct 28 19:42:26 2006
@@ -0,0 +1,12 @@
+use strict;
+use warnings FATAL => 'all';
+
+use Apache::Test;
+use Apache::TestUtil;
+use Apache::TestRequest;
+
+my $module = 'TestApReq::cookie2';
+my $url = Apache::TestRequest::module2url($module);
+
+t_debug "connecting to $url";
+print GET_BODY_ASSERT $url;
Modified: httpd/apreq/branches/v2_09/glue/perl/t/response/TestApReq/big_input.pm
URL: http://svn.apache.org/viewvc/httpd/apreq/branches/v2_09/glue/perl/t/response/TestApReq/big_input.pm?view=diff&rev=468822&r1=468821&r2=468822
==============================================================================
--- httpd/apreq/branches/v2_09/glue/perl/t/response/TestApReq/big_input.pm (original)
+++ httpd/apreq/branches/v2_09/glue/perl/t/response/TestApReq/big_input.pm Sat Oct 28 19:42:26 2006
@@ -6,6 +6,8 @@
use Apache2::RequestIO;
use Apache2::RequestRec;
+use Apache2::Const -compile => qw(OK);
+
sub handler {
my $r = shift;
my $req = Apache2::Request->new($r);
@@ -20,7 +22,7 @@
$req->content_type('text/plain');
$req->print($len);
- return 0;
+ return Apache2::Const::OK;
}
1;
Modified: httpd/apreq/branches/v2_09/glue/perl/t/response/TestApReq/cookie.pm
URL: http://svn.apache.org/viewvc/httpd/apreq/branches/v2_09/glue/perl/t/response/TestApReq/cookie.pm?view=diff&rev=468822&r1=468821&r2=468822
==============================================================================
--- httpd/apreq/branches/v2_09/glue/perl/t/response/TestApReq/cookie.pm (original)
+++ httpd/apreq/branches/v2_09/glue/perl/t/response/TestApReq/cookie.pm Sat Oct 28 19:42:26 2006
@@ -6,6 +6,8 @@
use Apache2::RequestIO ();
use Apache2::RequestRec ();
+use Apache2::Const -compile => qw(OK);
+
use Apache2::Cookie ();
use Apache2::Request ();
@@ -67,7 +69,7 @@
}
- return 0;
+ return Apache2::Const::OK;
}
1;
Added: httpd/apreq/branches/v2_09/glue/perl/t/response/TestApReq/cookie2.pm
URL: http://svn.apache.org/viewvc/httpd/apreq/branches/v2_09/glue/perl/t/response/TestApReq/cookie2.pm?view=auto&rev=468822
==============================================================================
--- httpd/apreq/branches/v2_09/glue/perl/t/response/TestApReq/cookie2.pm (added)
+++ httpd/apreq/branches/v2_09/glue/perl/t/response/TestApReq/cookie2.pm Sat Oct 28 19:42:26 2006
@@ -0,0 +1,71 @@
+package TestApReq::cookie2;
+
+use strict;
+use warnings FATAL => 'all';
+
+use Apache::Test;
+use Apache::TestUtil;
+
+use Apache2::RequestRec ();
+use Apache2::Const -compile => qw(OK);
+
+use Apache2::Cookie ();
+
+sub handler {
+ my $r = shift;
+
+ plan $r, tests => 5;
+
+ {
+ my $cookie = Apache2::Cookie->new($r, name => 'n', value => undef);
+ ok t_cmp(
+ $cookie,
+ undef,
+ "value => undef return undef not a cookie"
+ );
+ }
+
+ {
+ my $cookie = Apache2::Cookie->new($r, name => 'n');
+ ok t_cmp(
+ $cookie,
+ undef,
+ "no value attribute specified"
+ );
+ }
+
+ {
+ my $cookie = Apache2::Cookie->new($r, name => 'n', value => '');
+ ok t_cmp(
+ $cookie,
+ "n=",
+ "'' returns a valid cookie object"
+ );
+ }
+
+ {
+ my $cookie = Apache2::Cookie->new($r, name => 'n', value => []);
+ ok t_cmp(
+ $cookie,
+ "n=",
+ "value => [] returns a valid cookie object"
+ );
+ }
+
+ {
+ my $cookie = Apache2::Cookie->new($r, name => 'n', value => {});
+ ok t_cmp(
+ $cookie,
+ "n=",
+ "value => {} returns a valid cookie object"
+ );
+ }
+
+
+
+ return Apache2::Const::OK;
+}
+
+1;
+
+__END__
Modified: httpd/apreq/branches/v2_09/glue/perl/t/response/TestApReq/inherit.pm
URL: http://svn.apache.org/viewvc/httpd/apreq/branches/v2_09/glue/perl/t/response/TestApReq/inherit.pm?view=diff&rev=468822&r1=468821&r2=468822
==============================================================================
--- httpd/apreq/branches/v2_09/glue/perl/t/response/TestApReq/inherit.pm (original)
+++ httpd/apreq/branches/v2_09/glue/perl/t/response/TestApReq/inherit.pm Sat Oct 28 19:42:26 2006
@@ -3,9 +3,11 @@
use base qw/Apache2::Request Apache2::Cookie::Jar/;
use strict;
use warnings FATAL => 'all';
+
use APR;
use Apache2::RequestRec;
use Apache2::RequestIO;
+use Apache2::Const -compile => qw(OK);
sub handler {
my $r = shift;
@@ -17,7 +19,7 @@
my $req = bless { r => $r };
$req->printf("method => %s\n", $req->method);
$req->printf("cookie => %s\n", $req->cookies->{"apache"}->as_string);
- return 0;
+ return Apache2::Const::OK;
}
sub DESTROY { $_[0]->print("DESTROYING ", __PACKAGE__, " object\n") }
Modified: httpd/apreq/branches/v2_09/glue/perl/t/response/TestApReq/request.pm
URL: http://svn.apache.org/viewvc/httpd/apreq/branches/v2_09/glue/perl/t/response/TestApReq/request.pm?view=diff&rev=468822&r1=468821&r2=468822
==============================================================================
--- httpd/apreq/branches/v2_09/glue/perl/t/response/TestApReq/request.pm (original)
+++ httpd/apreq/branches/v2_09/glue/perl/t/response/TestApReq/request.pm Sat Oct 28 19:42:26 2006
@@ -13,6 +13,7 @@
use APR::PerlIO;
use Apache2::ServerUtil;
use File::Spec;
+use Apache2::Const -compile => qw(OK);
my $data;
@@ -170,7 +171,7 @@
}
}
- return 0;
+ return Apache2::Const::OK;
}
1;
__END__
Modified: httpd/apreq/branches/v2_09/glue/perl/t/response/TestApReq/upload.pm
URL: http://svn.apache.org/viewvc/httpd/apreq/branches/v2_09/glue/perl/t/response/TestApReq/upload.pm?view=diff&rev=468822&r1=468821&r2=468822
==============================================================================
--- httpd/apreq/branches/v2_09/glue/perl/t/response/TestApReq/upload.pm (original)
+++ httpd/apreq/branches/v2_09/glue/perl/t/response/TestApReq/upload.pm Sat Oct 28 19:42:26 2006
@@ -7,6 +7,7 @@
use Apache2::RequestIO;
use Apache2::Request ();
use Apache2::Upload;
+use Apache2::Const -compile => qw(OK);
use File::Spec;
require File::Basename;
@@ -71,7 +72,7 @@
md5: $cs
END
unlink $temp_file if -f $temp_file;
- return 0;
+ return Apache2::Const::OK;
}
sub cs {
Added: httpd/apreq/branches/v2_09/module/t/c-modules/apreq_upload_test/10k
URL: http://svn.apache.org/viewvc/httpd/apreq/branches/v2_09/module/t/c-modules/apreq_upload_test/10k?view=auto&rev=468822
==============================================================================
Binary file - no diff available.
Propchange: httpd/apreq/branches/v2_09/module/t/c-modules/apreq_upload_test/10k
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: httpd/apreq/branches/v2_09/module/t/c-modules/apreq_upload_test/128k
URL: http://svn.apache.org/viewvc/httpd/apreq/branches/v2_09/module/t/c-modules/apreq_upload_test/128k?view=auto&rev=468822
==============================================================================
Binary file - no diff available.
Propchange: httpd/apreq/branches/v2_09/module/t/c-modules/apreq_upload_test/128k
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: httpd/apreq/branches/v2_09/module/t/c-modules/apreq_upload_test/1b
URL: http://svn.apache.org/viewvc/httpd/apreq/branches/v2_09/module/t/c-modules/apreq_upload_test/1b?view=auto&rev=468822
==============================================================================
Binary file - no diff available.
Propchange: httpd/apreq/branches/v2_09/module/t/c-modules/apreq_upload_test/1b
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: httpd/apreq/branches/v2_09/module/t/c-modules/apreq_upload_test/1k
URL: http://svn.apache.org/viewvc/httpd/apreq/branches/v2_09/module/t/c-modules/apreq_upload_test/1k?view=auto&rev=468822
==============================================================================
Binary file - no diff available.
Propchange: httpd/apreq/branches/v2_09/module/t/c-modules/apreq_upload_test/1k
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: httpd/apreq/branches/v2_09/module/t/c-modules/apreq_upload_test/63k
URL: http://svn.apache.org/viewvc/httpd/apreq/branches/v2_09/module/t/c-modules/apreq_upload_test/63k?view=auto&rev=468822
==============================================================================
Binary file - no diff available.
Propchange: httpd/apreq/branches/v2_09/module/t/c-modules/apreq_upload_test/63k
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: httpd/apreq/branches/v2_09/module/t/c-modules/apreq_upload_test/64k
URL: http://svn.apache.org/viewvc/httpd/apreq/branches/v2_09/module/t/c-modules/apreq_upload_test/64k?view=auto&rev=468822
==============================================================================
Binary file - no diff available.
Propchange: httpd/apreq/branches/v2_09/module/t/c-modules/apreq_upload_test/64k
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: httpd/apreq/branches/v2_09/module/t/c-modules/apreq_upload_test/65k
URL: http://svn.apache.org/viewvc/httpd/apreq/branches/v2_09/module/t/c-modules/apreq_upload_test/65k?view=auto&rev=468822
==============================================================================
Binary file - no diff available.
Propchange: httpd/apreq/branches/v2_09/module/t/c-modules/apreq_upload_test/65k
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: httpd/apreq/branches/v2_09/module/t/c-modules/apreq_upload_test/mod_apreq_upload_test.c
URL: http://svn.apache.org/viewvc/httpd/apreq/branches/v2_09/module/t/c-modules/apreq_upload_test/mod_apreq_upload_test.c?view=auto&rev=468822
==============================================================================
--- httpd/apreq/branches/v2_09/module/t/c-modules/apreq_upload_test/mod_apreq_upload_test.c (added)
+++ httpd/apreq/branches/v2_09/module/t/c-modules/apreq_upload_test/mod_apreq_upload_test.c Sat Oct 28 19:42:26 2006
@@ -0,0 +1,100 @@
+/*
+** Copyright 2006 The Apache Software Foundation
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+
+#ifdef CONFIG_FOR_HTTPD_TEST
+#if CONFIG_FOR_HTTPD_TEST
+
+<Location /apreq_upload_test>
+ SetHandler apreq_upload_test
+</Location>
+
+#endif
+#endif
+
+#define APACHE_HTTPD_TEST_HANDLER apreq_upload_test_handler
+
+#include "apache_httpd_test.h"
+
+#include "apreq_module.h"
+#include "apreq_param.h"
+#include "apreq_module_apache2.h"
+#include "apreq_util.h"
+
+#include "httpd.h"
+
+
+static int apreq_upload_test_handler(request_rec *r)
+{
+ apreq_handle_t *req;
+ const apreq_param_t *param;
+
+ if (strcmp(r->handler, "apreq_upload_test") != 0) {
+ return DECLINED;
+ }
+
+ req = apreq_handle_apache2(r) ;
+
+ ap_log_rerror(APLOG_MARK, APLOG_DEBUG, APR_SUCCESS,
+ r, "starting apreq_upload_test");
+
+ ap_set_content_type(r, "text/plain");
+
+ param = apreq_body_get(req, "filename");
+
+ if (param == NULL) {
+ ap_rputs("missing upload field", r);
+ }
+ else if (param->upload == NULL) {
+ ap_rputs("not an upload field", r);
+ }
+ else {
+ apr_table_t *info; /* upload headers */
+ apr_bucket_brigade *bb; /* upload contents */
+ apr_bucket *e;
+ apr_size_t total = 0;
+
+ info = param->info;
+ bb = apr_brigade_create(r->pool, r->connection->bucket_alloc);
+ apreq_brigade_copy(bb, param->upload);
+
+ while ((e = APR_BRIGADE_FIRST(bb)) != APR_BRIGADE_SENTINEL(bb)) {
+ apr_size_t dlen;
+ const char *data;
+
+ /* apr_bucket_read() has side effects on spool buckets, which
+ * is why we read from a copy of the brigade - to conserve memory
+ */
+ if (apr_bucket_read(e, &data, &dlen, APR_BLOCK_READ)) {
+ ap_rprintf(r, "bad bucket read");
+ break;
+ }
+ else {
+ total += dlen;
+ }
+
+ apr_bucket_delete(e);
+ }
+
+ ap_rprintf(r, "%d", total);
+ }
+
+ ap_log_rerror(APLOG_MARK, APLOG_DEBUG, APR_SUCCESS,
+ r, "finished apreq_upload_test");
+
+ return OK;
+}
+
+APACHE_HTTPD_TEST_MODULE(apreq_upload_test);
Added: httpd/apreq/branches/v2_09/module/t/upload.t
URL: http://svn.apache.org/viewvc/httpd/apreq/branches/v2_09/module/t/upload.t?view=auto&rev=468822
==============================================================================
--- httpd/apreq/branches/v2_09/module/t/upload.t (added)
+++ httpd/apreq/branches/v2_09/module/t/upload.t Sat Oct 28 19:42:26 2006
@@ -0,0 +1,35 @@
+use strict;
+use warnings FATAL => 'all';
+
+use Apache::Test;
+use Apache::TestUtil;
+use Apache::TestConfig;
+use Apache::TestRequest qw(UPLOAD_BODY);
+
+plan tests => 7, need_lwp;
+
+my $location = "/apreq_upload_test";
+
+my %files = (
+ '1b' => 1,
+ '1k' => 1024,
+ '10k' => 10240,
+ '63k' => 64512,
+ '64k' => 65536,
+ '65k' => 66560,
+ '128k' => 131072,
+ );
+
+my $server_root = Apache::Test::config()->{vars}->{serverroot};
+my $dir = "$server_root/c-modules/apreq_upload_test";
+
+foreach my $file (sort { $files{$a} <=> $files{$b} } keys %files) {
+ my $size = $files{$file};
+
+ my $result = UPLOAD_BODY($location, filename => "$dir/$file");
+ ok t_cmp(
+ $result,
+ $size,
+ "UPLOAD a file size $size btyes"
+ );
+}