Skip to content

Commit

Permalink
Checked all this stuff in. I'm going to work with it
Browse files Browse the repository at this point in the history
on presto for a while.
  • Loading branch information
lstein committed Nov 24, 1998
1 parent c432665 commit 7106769
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 61 deletions.
30 changes: 17 additions & 13 deletions ANNOUNCE
@@ -1,20 +1,24 @@
CGI.pm version 2.42 is now available for your fun and edification.
CGI.pm version 2.43 is now available for your fun and edification.
This version includes the following bug fixes and features:

1. Fixed nasty bug in url() method

2. Added new features to url() method.

3. Added regression tests ("make test" works)

4. Remove warnings about ambiguous use of shift() when running on
windows platforms

5. Small documentation fixes.
1. Fixed problem with "use strict" and file uploads (thanks to Peter Haworth)
2. Fixed problem with not MSIE 3.01 for the power_mac not doing
file uploads right.
3. Fixed problem with file upload on IIS 4.0 when authorization in
use.
4. -content_type and '-content-type' can now be provided to
header() as synonyms for -type.
5. CGI::Carp now escapes the ampersand BEFORE escaping the > and
< signs.
6. Fixed "not an array reference" error when passing a hash
reference to radio_group().
7. Fixed non-removal of uploaded TMP files on NT platforms which
occurs when server runs on non-C drive (thanks to Steve Kilbane
for finding this one).

The master copy can be found at
http://www.genome.wi.mit.edu/ftp/pub/software/WWW/. Mirror copies
are available on a CPAN near you.
http://stein.cshl.org/WWW/software/CGI/. Mirror copies are
available on a CPAN near you.

Lincoln Stein

Expand Down
69 changes: 37 additions & 32 deletions CGI.pm
Expand Up @@ -18,7 +18,7 @@ require 5.004;
# http://www.genome.wi.mit.edu/ftp/pub/software/WWW/cgi_docs.html
# ftp://ftp-genome.wi.mit.edu/pub/software/WWW/

$CGI::revision = '$Id: CGI.pm,v 1.1 1998-10-08 20:23:02 lstein Exp $';
$CGI::revision = '$Id: CGI.pm,v 1.2 1998-11-24 12:20:46 lstein Exp $';
$CGI::VERSION='2.43';

# HARD-CODED LOCATION FOR FILE UPLOAD TEMPORARY FILES.
Expand Down Expand Up @@ -157,15 +157,15 @@ if ($needs_binmode) {
tt u i b blockquote pre img a address cite samp dfn html head
base body Link nextid title meta kbd start_html end_html
input Select option comment/],
':html3'=>[qw/div table caption th td TR Tr sup sub strike applet Param
':html3'=>[qw/div table caption th td TR Tr sup Sub strike applet Param
embed basefont style span layer ilayer font frameset frame script small big/],
':netscape'=>[qw/blink fontsize center/],
':form'=>[qw/textfield textarea filefield password_field hidden checkbox checkbox_group
submit reset defaults radio_group popup_menu button autoEscape
scrolling_list image_button start_form end_form startform endform
start_multipart_form isindex tmpFileName uploadInfo URL_ENCODED MULTIPART/],
':cgi'=>[qw/param path_info path_translated url self_url script_name cookie dump
raw_cookie request_method query_string accept user_agent remote_host
':cgi'=>[qw/param path_info path_translated url self_url script_name cookie Dump
raw_cookie request_method query_string Accept user_agent remote_host
remote_addr referer server_name server_software server_port server_protocol
virtual_host remote_ident auth_type http use_named_parameters
save_parameters restore_parameters param_fetch
Expand Down Expand Up @@ -280,7 +280,7 @@ sub param {
$name = $p[0];
}

return () unless defined($name) && $self->{$name};
return unless defined($name) && $self->{$name};
return wantarray ? @{$self->{$name}} : $self->{$name}->[0];
}

Expand Down Expand Up @@ -322,6 +322,7 @@ sub self_or_CGI {
sub init {
my($self,$initializer) = @_;
my($query_string,$meth,$content_length,$fh,@lines) = ('','','','');
local($/) = "\n";

# if we get called more than once, we want to initialize
# ourselves from the original query (which may be gone
Expand Down Expand Up @@ -1052,6 +1053,7 @@ sub save {
$filehandle = to_filehandle($filehandle);
my($param);
local($,) = ''; # set print field separator back to a sane value
local($\) = ''; # set output line separator to a sane value
foreach $param ($self->param) {
my($escaped_param) = escape($param);
my($value);
Expand Down Expand Up @@ -1160,7 +1162,7 @@ sub header {
# rearrange() was designed for the HTML portion, so we
# need to fix it up a little.
foreach (@other) {
next unless my($header,$value) = /([^\s=]+)=\"?(.+?)\"?$/;
next unless my($header,$value) = /([^\s=]+)=\"?(.+?)\"?$/;
($_ = $header) =~ s/^(\w)(.*)/$1 . lc ($2) . ": $value"/e;
}
Expand All @@ -1176,7 +1178,8 @@ sub header {
if ($cookie) {
my(@cookie) = ref($cookie) && ref($cookie) eq 'ARRAY' ? @{$cookie} : $cookie;
foreach (@cookie) {
push(@header,"Set-Cookie: " . (UNIVERSAL::isa($_,'CGI::Cookie') ? $_->as_string : $_));
my $cs = UNIVERSAL::isa($_,'CGI::Cookie') ? $_->as_string : $_;
push(@header,"Set-Cookie: $cs") if $cs ne '';
}
}
# if the user indicates an expiration time, then we need
Expand Down Expand Up @@ -2357,8 +2360,8 @@ END_OF_FUNC
# declares a quantitative score for it.
# This handles MIME type globs correctly.
####
'accept' => <<'END_OF_FUNC',
sub accept {
'Accept' => <<'END_OF_FUNC',
sub Accept {
my($self,$search) = self_or_CGI(@_);
my(%prefs,$type,$pref,$pat);
Expand Down Expand Up @@ -2862,10 +2865,7 @@ $AUTOLOADED_ROUTINES=<<'END_OF_AUTOLOAD';
'asString' => <<'END_OF_FUNC',
sub asString {
my $self = shift;
my $i = $$self;
$i=~ s/^\*(\w+::)+//; # get rid of package name
$i =~ s/\\(.)/$1/g;
return $i;
return ${*{$self}{SCALAR}};
}
END_OF_FUNC
Expand All @@ -2882,11 +2882,12 @@ sub new {
my($pack,$name,$file,$delete) = @_;
require Fcntl unless defined &Fcntl::O_RDWR;
++$FH;
*{$FH} = quotemeta($name);
sysopen($FH,$file,Fcntl::O_RDWR()|Fcntl::O_CREAT()|Fcntl::O_EXCL())
my $ref = \*{'Fh::' . quotemeta($name)};
sysopen($ref,$file,Fcntl::O_RDWR()|Fcntl::O_CREAT()|Fcntl::O_EXCL())
|| die "CGI open of $file: $!\n";
unlink($file) if $delete;
return bless \*{$FH},$pack;
delete $Fh::{$FH};
return bless $ref,$pack;
}
END_OF_FUNC
Expand All @@ -2904,10 +2905,10 @@ END_OF_AUTOLOAD
package MultipartBuffer;

# how many bytes to read at a time. We use
# a 5K buffer by default.
$INITIAL_FILLUNIT = 1024 * 5;
$TIMEOUT = 10*60; # 10 minute timeout
$SPIN_LOOP_MAX = 1000; # bug fix for some Netscape servers
# a 4K buffer by default.
$INITIAL_FILLUNIT = 1024 * 4;
$TIMEOUT = 240*60; # 4 hour timeout for big files
$SPIN_LOOP_MAX = 2000; # bug fix for some Netscape servers
$CRLF=$CGI::CRLF;

#reuse the autoload function
Expand Down Expand Up @@ -2951,8 +2952,8 @@ sub new {
# characters "--" PLUS the Boundary string
# BUG: IE 3.01 on the Macintosh uses just the boundary -- not
# the two extra spaces. We do a special case here on the user-agent!!!!
$boundary = "--$boundary" unless CGI::user_agent('MSIE 3\.0[12]; Mac');
# the two extra hyphens. We do a special case here on the user-agent!!!!
$boundary = "--$boundary" unless CGI::user_agent('MSIE 3\.0[12]; ?Mac');
} else { # otherwise we find it ourselves
my($old);
Expand Down Expand Up @@ -5208,6 +5209,9 @@ reset() creates the "reset" button. Note that it restores the
form to its value from the last time the script was called,
NOT necessarily to the defaults.
Note that this conflicts with the Perl reset() built-in. Use
CORE::reset() to get the original reset function.
=head2 CREATING A DEFAULT BUTTON
print $query->defaults('button_label')
Expand Down Expand Up @@ -5655,16 +5659,17 @@ through this interface. The methods are as follows:
=over 4
=item B<accept()>
=item B<Accept()>
Return a list of MIME types that the remote browser accepts. If you
give this method a single argument corresponding to a MIME type, as in
$query->Accept('text/html'), it will return a floating point value
corresponding to the browser's preference for this type from 0.0
(don't want) to 1.0. Glob types (e.g. text/*) in the browser's accept
list are handled correctly.
Return a list of MIME types that the remote browser
accepts. If you give this method a single argument
corresponding to a MIME type, as in
$query->accept('text/html'), it will return a
floating point value corresponding to the browser's
preference for this type from 0.0 (don't want) to 1.0.
Glob types (e.g. text/*) in the browser's accept list
are handled correctly.
Note that the capitalization changed between version 2.43 and 2.44 in
order to avoid conflict with Perl's accept() function.
=item B<raw_cookie()>
Expand Down Expand Up @@ -6100,7 +6105,7 @@ for suggestions and bug fixes.
-rows=>10,
-columns=>50);
print "<P>",$query->reset;
print "<P>",$query->Reset;
print $query->submit('Action','Shout');
print $query->submit('Action','Scream');
print $query->endform;
Expand Down
10 changes: 7 additions & 3 deletions CGI/Carp.pm
Expand Up @@ -155,6 +155,10 @@ set_message() from within a BEGIN{} block.
1.10 Patch from Chris Dean (ctdean@cogit.com) to allow
module to run correctly under mod_perl.
1.11 Changed order of &gt; and &lt; escapes.
1.12 Changed die() on line 217 to CORE::die to avoid B<-w> warning.
=head1 AUTHORS
Lincoln D. Stein <lstein@genome.wi.mit.edu>. Feel free to redistribute
Expand All @@ -178,7 +182,7 @@ use Carp;

$main::SIG{__WARN__}=\&CGI::Carp::warn;
$main::SIG{__DIE__}=\&CGI::Carp::die;
$CGI::Carp::VERSION = '1.11';
$CGI::Carp::VERSION = '1.12';
$CGI::Carp::CUSTOM_MSG = undef;

# fancy import routine detects and handles 'errorWrap' specially.
Expand All @@ -195,7 +199,7 @@ sub import {

# These are the originals
sub realwarn { warn(@_); }
sub realdie { die(@_); }
sub realdie { CORE::die(@_); }

sub id {
my $level = shift;
Expand Down Expand Up @@ -268,7 +272,7 @@ EOF
sub carpout {
my($in) = @_;
my($no) = fileno(to_filehandle($in));
die "Invalid filehandle $in\n" unless defined $no;
realdie("Invalid filehandle $in\n") unless defined $no;

open(SAVEERR, ">&STDERR");
open(STDERR, ">&$no") or
Expand Down
1 change: 1 addition & 0 deletions CGI/Cookie.pm
Expand Up @@ -401,6 +401,7 @@ Get or set the cookie's expiration time.
=head1 AUTHOR INFORMATION
Copyright 1995-1998, Lincoln D. Stein. All rights reserved. It may
be used and modified freely, but I do request that this copyright
notice remain attached to the file. You may modify this module as you
wish, but if you redistribute a modified version, please attach a note
Expand Down
10 changes: 6 additions & 4 deletions CGI/Fast.pm
Expand Up @@ -16,7 +16,7 @@ package CGI::Fast;
# The most recent version and complete docs are available at:
# http://www.genome.wi.mit.edu/ftp/pub/software/WWW/cgi_docs.html
# ftp://ftp-genome.wi.mit.edu/pub/software/WWW/
$CGI::Fast::VERSION='1.00a';
$CGI::Fast::VERSION='1.01';

use CGI;
use FCGI;
Expand All @@ -34,9 +34,11 @@ sub save_request {
# New is slightly different in that it calls FCGI's
# accept() method.
sub new {
return undef unless FCGI::accept() >= 0;
my($self,@param) = @_;
return $CGI::Q = $self->SUPER::new(@param);
my ($self, $initializer, @param) = @_;
unless (defined $initializer) {
return undef unless FCGI::accept() >= 0;
}
return $CGI::Q = $self->SUPER::new($initializer, @param);
}

1;
Expand Down
28 changes: 19 additions & 9 deletions cgi_docs.html
Expand Up @@ -5,7 +5,7 @@
<BODY bgcolor="#FFFFFF">
<H1><IMG SRC="examples/dna.small.gif" ALT="[logo]">
CGI.pm - a Perl5 CGI Library</H1>
Version 2.43, 7/??/98, L. Stein
Version 2.44, 10/28/98, L. Stein
<p>

<H2>Abstract</H2> This perl 5 library uses objects to create Web
Expand Down Expand Up @@ -109,16 +109,16 @@ <H2>Contents</H2>
<LI><A HREF="#book">The CGI.pm Book</A>
<LI><A HREF="#y2000">CGI.pm and the Year 2000 Problem</A>
<LI><A HREF="#bugs">Bug Reporting and Support</A>
<LI><A HREF="#new">What's new in version 2.42?</A>
<LI><A HREF="#new">What's new in version 2.44?</A>
</MENU>

<HR>
<A NAME="installation">
<H2>Downloading & Installation</H2>
</A>
<ul>
<li><STRONG><A HREF="CGI.pm-2.42.tar.gz">Download 2.42 (gzip tar archive)</A></STRONG>
<li><STRONG><A HREF="CGI.pm-2.42.zip">Download 2.42 (pkzip archive)</A></STRONG>
<li><STRONG><A HREF="CGI.pm-2.43.tar.gz">Download 2.43 (gzip tar archive)</A></STRONG>
<li><STRONG><A HREF="CGI.pm-2.43.zip">Download 2.43 (pkzip archive)</A></STRONG>
<li><STRONG><A HREF="CGI.pm-2.41.sit">Download 2.41
(Macintosh stuffit archive)</A></STRONG>
<li><strong><A HREF="CGI.pm">Download just the CGI module (uncompressed)</a></strong>
Expand All @@ -131,7 +131,7 @@ <H2>Downloading & Installation</H2>

The current version of the software can always be downloaded from the
master copy of this document maintained at <a
href="http://www.genome.wi.mit.edu/ftp/pub/software/WWW/">http://www.genome.wi.mit.edu/ftp/pub/software/WWW/</a>.
href="http://stein.cshl.org/WWW/software/CGI/">http://stein.cshl.org/WWW/software/CGI/</a>.

<P>

Expand Down Expand Up @@ -2680,15 +2680,16 @@ <H2>HTTP Session Variables</H2>
Some of the more useful environment variables can be fetched
through this interface. The methods are as follows:
<DL>
<DT>accept()
<DT>Accept()
<DD>Return a list of MIME types that the remote browser
accepts. If you give this method a single argument
corresponding to a MIME type, as in
<CODE>$query-&gt;accept('text/html')</CODE>, it will return a
<CODE>$query-&gt;Accept('text/html')</CODE>, it will return a
floating point value corresponding to the browser's
preference for this type from 0.0 (don't want) to 1.0.
Glob types (e.g. text/*) in the browser's accept list
are handled correctly.
are handled correctly. Note the capitalization of the initial letter. This avoids
conflict with the Perl built-in accept().
<DT>auth_type()
<DD>Return the authorization type, if protection is active. Example "Basic".
<DT><a name="raw_cookie">raw_cookie()</a>
Expand Down Expand Up @@ -4358,9 +4359,18 @@ <H3>Bug Reports</H3>
<HR>

<H2><A NAME="new">Revision History</A></H2>
<h3>Version 2.44</h3>
<ol>
<li>Fixed bug in header() that prevented fields from containing double quotes.
<li>Changed accept() to Accept(), sub() to Sub(). There's still a conflict with
reset(), but this will break too many existing scripts!
</ol>

<h3>Version 2.43</h3>
<ol>
<li>Fixed problem with "use strict" and file uploads (thanks to Peter Haworth)
<li>Fixed problem with not MSIE 3.01 for the power_mac not doing
file uploads right.
<li>Fixed problem with file upload on IIS 4.0 when authorization in
use.
<li>-content_type and '-content-type' can now be provided to
Expand Down Expand Up @@ -4968,6 +4978,6 @@ <H3>Bug fixes</H3>
<a href="http://www.cshl.org/">Cold Spring Harbor Laboratory</a></ADDRESS>
<P>
<!-- hhmts start -->
Last modified: Fri Sep 11 09:44:43 EDT 1998
Last modified: Wed Oct 28 10:17:20 EST 1998
<!-- hhmts end -->
</BODY> </HTML>

0 comments on commit 7106769

Please sign in to comment.