joes 2004/06/19 08:38:19
Modified: glue/perl/t/apreq cgi.t
glue/perl/xsbuilder/Apache/Cookie Cookie_pm
glue/perl/xsbuilder/Apache/Request Request_pod
glue/perl/xsbuilder/Apache/Upload Apache__Upload.h Upload_pm
Added: glue/perl/xsbuilder/Apache/Upload Upload_pod
Log:
Move Apache::Upload docs to Upload_pod and add back-compat code for
Apache::Cookie::fetch
Revision Changes Path
1.2 +1 -0 httpd-apreq-2/glue/perl/t/apreq/cgi.t
Index: cgi.t
===================================================================
RCS file: /home/cvs/httpd-apreq-2/glue/perl/t/apreq/cgi.t,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- cgi.t 15 Jun 2004 15:25:23 -0000 1.1
+++ cgi.t 19 Jun 2004 15:38:18 -0000 1.2
@@ -156,6 +156,7 @@
../../blib/arch/Apache2);
use Apache::Request;
use Apache::Cookie;
+
my $p = APR::Pool->new();
print "Content-Type: text/plain\n\n";
1.14 +16 -2 httpd-apreq-2/glue/perl/xsbuilder/Apache/Cookie/Cookie_pm
Index: Cookie_pm
===================================================================
RCS file:
/home/cvs/httpd-apreq-2/glue/perl/xsbuilder/Apache/Cookie/Cookie_pm,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- Cookie_pm 5 Apr 2004 22:44:30 -0000 1.13
+++ Cookie_pm 19 Jun 2004 15:38:18 -0000 1.14
@@ -29,8 +29,22 @@
}
sub fetch {
- my $self = shift;
- my $jar = $self->jar(@_);
+ my $class = shift;
+ my $env = shift;
+ unless (defined $env) {
+ my $usage = 'Usage: Apache::Cookie->fetch($r): missing argument $r';
+
+ if ($class->env eq "Apache::RequestRec") { # mp2
+ $env = eval {Apache->request} or die <<EOD;
+$usage: attempt to fetch global Apache->request failed: [EMAIL PROTECTED]
+EOD
+ # warn $usage;
+ }
+ else {
+ die $usage;
+ }
+ }
+ my $jar = $class->jar($env, @_);
return wantarray ? %{(scalar $jar->cookie) || {}} : $jar->cookie;
}
1.11 +11 -81
httpd-apreq-2/glue/perl/xsbuilder/Apache/Request/Request_pod
Index: Request_pod
===================================================================
RCS file:
/home/cvs/httpd-apreq-2/glue/perl/xsbuilder/Apache/Request/Request_pod,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- Request_pod 10 Jun 2004 14:27:41 -0000 1.10
+++ Request_pod 19 Jun 2004 15:38:18 -0000 1.11
@@ -9,9 +9,14 @@
=head1 DESCRIPTION
-I<Apache::Request> adds methods for parsing B<GET> requests and B<POST>
-requests where I<Content-type> is one of
I<application/x-www-form-urlencoded> or
-I<multipart/form-data>.
+C<Apache::Request> adds methods for parsing B<GET> requests and B<POST>
+requests where I<Content-type> is one of I<application/x-www-form-urlencoded>
+or I<multipart/form-data>.
+
+=head1 VERSION
+
+This is Version @PACKAGE_VERSION@ of C<Apache::Request>, based on
[EMAIL PROTECTED]@ Version @[EMAIL PROTECTED]
=head1 Apache::Request METHODS
@@ -155,7 +160,7 @@
my $param = $req->body($name);
-=head2 upload
+=head2 upload (requires Apache::Upload)
With no arguments, this returns an I<Apache::Upload::Table> object in
scalar context, or the names of all I<Apache::Upload> objects in
@@ -182,85 +187,10 @@
return bless { r => Apache::Request->new(@args) }, $class;
}
-=head1 Apache::Upload METHODS
-
-=head2 name
-
-The name of the filefield parameter:
-
- my $name = $upload->name;
-
-=head2 filename
-
-The filename of the uploaded file:
-
- my $filename = $upload->filename;
-
-=head2 bb [replaces fh]
-
-The APR::Brigade containing the contents of the uploaded file.
-
-=head2 size [TODO]
-
-The size of the file in bytes:
-
- my $size = $upload->size;
-
-=head2 info
-
-The additional header information for the uploaded file.
-Returns a hash reference tied to the I<Apache::Table> class.
-An optional I<key> argument can be passed to return the value of
-a given header rather than a hash reference. Examples:
-
- my $info = $upload->info;
- while (my($key, $val) = each %$info) {
- ...
- }
-
- my $val = $upload->info("Content-type");
-
-=head2 type [TODO]
-
-Returns the I<Content-Type> for the given I<Apache::Upload> object:
-
- my $type = $upload->type;
- #same as
- my $type = $upload->info("Content-Type");
-
-=head2 tempname [XXX- Does this mesh with brigade API?]
-
-Provides the name of the spool file. This method is reserved for
-debugging purposes, and is possibly subject to change in a future
-version of Apache::Request.
-
-=head2 link
-
-To avoid recopying the upload's internal tempfile brigade on a
-*nix-like system, I<link> will create a hard link to it:
-
- my $upload = $apr->upload('file');
- $upload->link("/path/to/newfile") or
- die sprintf "link from '%s' failed: $!", $upload->tempname;
-
-Typically the new name must lie on the same file system as the
-brigade's tempfile. Check your system's link(2) manpage for details.
-
-=head2 slurp
-
-Reads the full contents of a file upload into the scalar argument.
-The return value is currently an APR status code (0 on success, error
otherwise),
-but this may change in a future release (to bring this function
-in line with similar read-type functions in mp2).
-
- # print out the upload file
- my $contents;
- print $contents if $upload->slurp($contents) == 0;
-
=head1 SEE ALSO
-APR::Table(3)
+Apache::Cookie(3), Apache::Upload(3), APR::Table(3)
=head1 CREDITS
@@ -272,5 +202,5 @@
=head1 MISSING DOCS
-$req->config, Apache::Request::Table, Apache::Upload::Table.
+$req->config, Apache::Request::Table
1.2 +16 -1
httpd-apreq-2/glue/perl/xsbuilder/Apache/Upload/Apache__Upload.h
Index: Apache__Upload.h
===================================================================
RCS file:
/home/cvs/httpd-apreq-2/glue/perl/xsbuilder/Apache/Upload/Apache__Upload.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Apache__Upload.h 14 Jun 2004 02:02:23 -0000 1.1
+++ Apache__Upload.h 19 Jun 2004 15:38:18 -0000 1.2
@@ -1,4 +1,19 @@
-/* Upload API */
+/*
+** Copyright 2003-2004 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.
+*/
+
#define READ_BLOCK_SIZE (1024 * 256)
#define S2P(s) (s ? apreq_value_to_param(apreq_strtoval(s)) : NULL)
#define apreq_xs_upload_do (items==1 ? apreq_xs_upload_table_keys \
1.2 +2 -0 httpd-apreq-2/glue/perl/xsbuilder/Apache/Upload/Upload_pm
Index: Upload_pm
===================================================================
RCS file:
/home/cvs/httpd-apreq-2/glue/perl/xsbuilder/Apache/Upload/Upload_pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Upload_pm 14 Jun 2004 02:02:23 -0000 1.1
+++ Upload_pm 19 Jun 2004 15:38:18 -0000 1.2
@@ -1,6 +1,8 @@
+use APR;
use APR::Table;
use APR::Bucket;
use APR::Brigade;
+use APR::PerlIO;
package Apache::Upload::Table;
push our(@ISA), 'APR::Table';
1.1
httpd-apreq-2/glue/perl/xsbuilder/Apache/Upload/Upload_pod
Index: Upload_pod
===================================================================
=head1 Apache::Upload METHODS
=head2 name
The name of the filefield parameter:
my $name = $upload->name;
=head2 filename
The filename of the uploaded file:
my $filename = $upload->filename;
=head2 bb [replaces fh]
The APR::Brigade containing the contents of the uploaded file.
=head2 size [TODO]
The size of the file in bytes:
my $size = $upload->size;
=head2 info
The additional header information for the uploaded file.
Returns a hash reference tied to the I<Apache::Table> class.
An optional I<key> argument can be passed to return the value of
a given header rather than a hash reference. Examples:
my $info = $upload->info;
while (my($key, $val) = each %$info) {
...
}
my $val = $upload->info("Content-type");
=head2 type [TODO]
Returns the I<Content-Type> for the given I<Apache::Upload> object:
my $type = $upload->type;
#same as
my $type = $upload->info("Content-Type");
=head2 tempname [XXX- Does this mesh with brigade API?]
Provides the name of the spool file. This method is reserved for
debugging purposes, and is possibly subject to change in a future
version of Apache::Request.
=head2 link
To avoid recopying the upload's internal tempfile brigade on a
*nix-like system, I<link> will create a hard link to it:
my $upload = $apr->upload('file');
$upload->link("/path/to/newfile") or
die sprintf "link from '%s' failed: $!", $upload->tempname;
Typically the new name must lie on the same file system as the
brigade's tempfile. Check your system's link(2) manpage for details.
=head2 slurp
Reads the full contents of a file upload into the scalar argument.
The return value is currently an APR status code (0 on success, error
otherwise),
but this may change in a future release (to bring this function
in line with similar read-type functions in mp2).
# print out the upload file
my $contents;
print $contents if $upload->slurp($contents) == 0;
=head1 MISSING DOCS
Apache::Upload::Table.