@@ -1,4 +1,112 @@
_______________________________________________________________________________
+2009-07-26 Release 5.830
+
+Gisle Aas (1):
+ select doesn't return undef on failure [RT#32356]
+
+Ville Skyttä (1):
+ Add raw RFC 1951 deflate test case.
+
+
+
+_______________________________________________________________________________
+2009-07-07 Release 5.829
+
+This release removes callback handlers that were left over on the returned
+HTTP::Responses. This was problematic because it created reference loops
+preventing the Perl garbage collector from releasing their memory. Another
+problem was that Storable by default would not serialize these objects any
+more.
+
+This release also adds support for locating HTML::Form inputs by id or class
+attribute; for instance $form->value("#foo", 42) will set the value on the
+input with the ID of "foo".
+
+
+Gisle Aas (5):
+ Make the example code 'use strict' clean by adding a my
+ Avoid cycle in response
+ Clean up handlers has from response after data processing is done
+ Support finding inputs by id or class in HTML::Form
+ Test HTML::Form selectors
+
+Mark Stosberg (1):
+ Tidy and document the internals of mirror() better [RT#23450]
+
+phrstbrn (1):
+ Avoid warnings from HTML::Form [RT#42654]
+
+
+
+_______________________________________________________________________________
+2009-06-25 Release 5.828
+
+A quick new release to restore compatiblity with perl-5.6.
+
+
+Gisle Aas (4):
+ Less noisy behaviour when we can't download the documents
+ Restore perl-5.6 compatiblity [RT#47054]
+ Don't decode US-ASCII and ISO-8859-1 content
+ Some versions of Encode don't support UTF-16-BE [RT#47152]
+
+Ville Skyttä (1):
+ Spelling fixes.
+
+
+
+_______________________________________________________________________________
+2009-06-15 Release 5.827
+
+The main news this time is better detection of what character set the document
+in a response uses and the addition of the lwp-dump script that I found useful.
+
+
+Gisle Aas (31):
+ Added lwp-dump script
+ Replace calls to $req->url with $req->uri
+ Also need to encode strings in the latin1 range
+ Ignore the value set for file inputs [RT#46911]
+ Add docs to lwp-dump
+ Don't let lwp-dump follow redirects
+ Support --method options
+ Implement the --agent option
+ Dictionary order for the option docs; document --method
+ Merge branch 'dump'
+ Files are passed as an array and we must not stringify it.
+ Add content_charset method to HTTP::Message
+ Start guessing the charset for a message
+ Let content_charset guess the charset to use for decoded_content
+ Specify what's missing for the XML and HTML case
+ Provide charset parameter for HTML::Form->parse()
+ Make content_charset sniff for <meta> elements specifying the charset.
+ Determine charset of XML documents
+ Get rid of the _trivial_http_get() implementation
+ Update the bundled media.types file
+ LWP::Simple::get() now returns decoded_content [RT#44435]
+ Implement content_type_charset method for HTTP::Headers
+ Implement content_is_text method for HTTP::Headers
+ Make use of content_is_text and content_type_charset in decoded_content
+ Don't let the parse_head callback append to the HTTP headers
+ Don't set Range header on request when max_size is used [RT#17208]
+ Still show client headers for internal responses
+ Document Client-Warning: Internal response
+ Don't use 'no' as example domain for no_proxy docs [RT#43728]
+ Drop exit from the Makefile.PL [RT#43060]
+ Merge branch 'content_charset'
+
+Alex Kapranoff (1):
+ Support "accept-charset" attribute in HTML::Form
+
+Mark Stosberg (1):
+ new tests for max_size and 206 responses [RT#46230]
+
+murphy (1):
+ Reformulation of Client-Warning: Internal documentation
+
+
+
+_______________________________________________________________________________
2009-04-24 Release 5.826
Gisle Aas (2):
@@ -18,6 +126,7 @@ john9art (1):
Make LWP::UserAgent constructor honor the default_headers option [RT#16637]
+
_______________________________________________________________________________
2009-02-16 Release 5.825
@@ -261,7 +370,7 @@ _______________________________________________________________________________
Gisle Aas (13):
Typo fix.
Add HTTP::Message::decodable()
- Use decoded_content in the synposis
+ Use decoded_content in the synopsis
Avoid adding an empty first part in $mess->add_part()
Get rid of all the manual dependency tests.
Simplify the Makefile.PL (no interactivity)
@@ -458,7 +567,7 @@ _______________________________________________________________________________
HTML::Form: The parse method now takes hash style optional
arguments and the old verbose behaviour is now off by default.
- HTML::Form: Accept <select multiple=""> for compatibilty with
+ HTML::Form: Accept <select multiple=""> for compatibility with
other browsers. Patch by Josh Rai <josh@rai.name>.
HTML::Form: Sane handling of 'disabled' for ListInput.
@@ -562,9 +671,9 @@ _______________________________________________________________________________
Release 5.802
- The HTTP::Message object now have a decoded_content() method.
+ The HTTP::Message object now has a decoded_content() method.
This will return the content after any Content-Encodings and
- charsets has been decoded.
+ charsets have been decoded.
Compress::Zlib is now a prerequisite module.
@@ -858,7 +967,7 @@ _______________________________________________________________________________
introduced in 5.72 was broken and provided a patch for that.
Not all ftp servers return 550 responses when trying to
- to RETR a directory. Microsofts IIS is one of those.
+ to RETR a directory. Microsoft's IIS is one of those.
Patch provided by Thomas Lotterer <thl@dev.de.cw.com>.
Some documentation tweaks.
@@ -899,7 +1008,7 @@ _______________________________________________________________________________
redirects to the same URL to get a cookie set did not work.
Based on a patch by Sean M. Burke <sburke@cpan.org>.
- NTML authentication should continue to fail if the Authen::NTLM
+ NTLM authentication should continue to fail if the Authen::NTLM
module can't be loaded. LWP used to think the scheme was
available as soon as the module stash showed up. Not it looks
for the authenticate method to be defined. Patch by Jan Dubois.
@@ -927,7 +1036,7 @@ _______________________________________________________________________________
Patch by Matthew Eldridge <eldridge@Graphics.Stanford.EDU>.
lwp-request now prints unsuccessful responses in the same way
- as successsful ones. The status will still indicate failures.
+ as successful ones. The status will still indicate failures.
Based on a patch by Steve Hay <steve.hay@uk.radan.com>.
HTML::Form's dump now also print alternative value names.
@@ -1849,7 +1958,7 @@ Tue Aug 4 1998 Gisle Aas <aas@sn.no>
o LWP::UserAgent will lowercase all authentication parameter names
before passing it to the authentication module. Previous releases
- ignored parameters like; Realm="Foo" (bacause Realm contained
+ ignored parameters like; Realm="Foo" (because Realm contained
upper case letters).
o LWP::Protocol::ftp test for If-Modified-Since was wrong.
@@ -2132,7 +2241,7 @@ Tue Dec 16 1997 Gisle Aas <aas@sn.no>
o LWP::Protocol::ftp patch from Tony Finch <fanf@demon.net>.
- o Removed depreciated modules from the distibution; HTML::Parse,
+ o Removed deprecated modules from the distribution; HTML::Parse,
LWP::Socket, LWP::SecureSocket, LWP::IO, LWP::TkIO.
@@ -2147,7 +2256,7 @@ Fri Dec 12 1997 Gisle Aas <aas@sn.no>
o HTML::Parser patch by Brian McCauley <B.A.McCauley@bham.ac.uk>.
Pass original text to end() method.
- o The HTML::Parser->netscape_buggy_comment method is depreciated.
+ o The HTML::Parser->netscape_buggy_comment method is deprecated.
Use HTML::Parser->strict_comment instead. The default value
has changed with the name.
@@ -2589,7 +2698,7 @@ Wed Sep 11 1996 Gisle Aas <aas@sn.no>
o Release 5.02
- o lwp-rget: Initialize proxy settings from envirionment
+ o lwp-rget: Initialize proxy settings from environment
o HTML::Entities::encode_entities: Don't encode $ and %
@@ -2727,7 +2836,7 @@ Wed Apr 24 1996 Gisle Aas <aas@sn.no>
o Trap exceptions (die) from the response callback routine
- o The RobotUA now requires an e-mail address of the person reponsible
+ o The RobotUA now requires an e-mail address of the person responsible
for the robot.
o New $ua->from() method.
@@ -2790,7 +2899,7 @@ Thu Mar 14 1996 Gisle Aas <aas@sn.no>
o GET ftp://host/doc was never successful for normal files.
- o LWP::Socket: read_until() did not notice EOF condidtion. I.e. if
+ o LWP::Socket: read_until() did not notice EOF condition. I.e. if
a HTTP server closed the connection before any output was generated,
the we continued to read 0 bytes in a busy loop until the alarm()
killed us.
@@ -2802,7 +2911,7 @@ Thu Mar 14 1996 Gisle Aas <aas@sn.no>
o No longer print message content in HTTP::Response::error_as_HTML()
- o Access to "file:/path" gave warning when the envirionment variable
+ o Access to "file:/path" gave warning when the environment variable
no_proxy was set.
o The http-post test sends a Content-Type header. Some servers hang
@@ -2831,7 +2940,7 @@ Tue Mar 5 1996 Gisle Aas <aas@sn.no>
o Does not try generate password for ftp-URLs unless the username is
"anonymous" or "ftp"
- o The LWP::Simple user agent proxy settings are intialized from
+ o The LWP::Simple user agent proxy settings are initialized from
the proxy environment variables.
o LWP::Protocol::ftp: Use the Net::FTP library to access ftp servers.
@@ -2935,7 +3044,7 @@ Mon Feb 5 1996 Gisle Aas <aas@sn.no>
vms_path
o URI::Escape now semi-compile regular expressions (by evaling an
- anonymous sub). Same techinque is also used in HTML::Entities.
+ anonymous sub). Same technique is also used in HTML::Entities.
o HTTP::Date parser rewritten using regular expressions.
@@ -2956,7 +3065,7 @@ Mon Feb 5 1996 Gisle Aas <aas@sn.no>
o The HTML::Formatter now knows about <menu> and <dir> tags
o The construct "defined ref($arg)" did not work on perl5.002
- becase ref now always return something defined.
+ because ref now always return something defined.
o LWP::UserAgent sends by default an 'User-Agent' header.
@@ -2982,7 +3091,7 @@ Mon Nov 6 1995 Gisle Aas <aas@oslonett.no>
perl4 as 'perl'. The mirror script is not installed by
default.
- o LWP::Socket::_getaddress() Numerical IP adresses did not work.
+ o LWP::Socket::_getaddress() Numerical IP addresses did not work.
o LWP::Socket::pushback() did not work. This also avoids the bad
pp_select() core dump from perl.
@@ -3015,9 +3124,9 @@ Sat Sep 16 1995 Gisle Aas <aas@oslonett.no>
Thu Sep 14 1995 Gisle Aas <aas@oslonett.no>
o Speedups and bug fixes in the HTML parser. The parser now
- understands some more depreciated tags (like <xmp> and <listing>).
+ understands some more deprecated tags (like <xmp> and <listing>).
- o HTML::Elements are now stingified using perl overloading.
+ o HTML::Elements are now stringified using perl overloading.
The interface to the traverse() callback has changed.
o Implemented HTML formatters for plain text and Postscript.
@@ -3057,7 +3166,7 @@ Mon Sep 4 1995 Gisle Aas <aas@oslonett.no>
o Moved Base64 to MIME::Base64. Reimplemented MIME::Base64 by using
[un]pack("u",...) Implemented LWP::MIME::QuotedPrint for
- completness sake. Routine names has changed as suggested by Tim
+ completeness' sake. Routine names has changed as suggested by Tim
Bunce.
o LWP::MediaType reads default types from media.types file.
@@ -3180,7 +3289,7 @@ Mon Aug 7 1995 Gisle Aas <aas@oslonett.no>
o Use "\015\012" instead of "\r\n" in protocol modules. Some systems
define \r and \n differently.
- o request program can now handle documents that needs autorization by
+ o request program can now handle documents that needs authorization by
prompting the user for username/password. Added new -S option to print
request/response chain.
@@ -3254,7 +3363,7 @@ Mon Jul 17 1995 Gisle Aas <aas@oslonett.no>
Fri Jul 14 1995 Gisle Aas <aas@oslonett.no>
o Reorganized directories. Moved LWP.pm up. Moved file.pm and http.pm
- into the LWP::Protocol direcotory. Moved LWP out of the lib directory
+ into the LWP::Protocol directory. Moved LWP out of the lib directory
and removed lib.
o Implemented the "get" and "mirror" scripts in the "bin" directory.
@@ -3287,7 +3396,7 @@ Fri Jul 14 1995 Gisle Aas <aas@oslonett.no>
"use LWP 1.0;" if you need at least this version.
o Various cleanups and arranging layout as I like it. Use fooBar-style
- (as opposed to foo_bar stype) everywhere. This means that as_string()
+ (as opposed to foo_bar style) everywhere. This means that as_string()
now is called asString().
o Added more documentation.
@@ -3296,7 +3405,7 @@ Fri Jul 14 1995 Gisle Aas <aas@oslonett.no>
Wed Jun 14 1995 Gisle Aas <aas@oslonett.no>
- o Removed lot of rendundant & before function calls.
+ o Removed lot of redundant & before function calls.
o $this --> $self
@@ -5,6 +5,7 @@ Makefile.PL Makefile generator
README Get you started with this package
README.SSL When you need SSL support
bin/lwp-download Writes bin/lwp-download script
+bin/lwp-dump Writes bin/lwp-dump script
bin/lwp-mirror Writes bin/lwp-mirror script
bin/lwp-request Writes bin/lwp-request script
bin/lwp-rget Writes bin/lwp-rget script
@@ -78,6 +79,7 @@ t/base/http-config.t Test HTTP::Config module
t/base/listing.t Test File::Listing module
t/base/mediatypes.t Test LWP::MediaTypes module
t/base/message.t Test HTTP::Message
+t/base/message-charset.t Test HTTP::Message content_charset method
t/base/message-old.t Test HTTP::Request/HTTP::Response
t/base/message-parts.t Test HTTP::Message parts method
t/base/negotiate.t Test HTTP::Negotiation module
@@ -91,6 +93,7 @@ t/html/form.t Test HTML::Form module
t/html/form-param.t More HTML::Form tests.
t/html/form-multi-select.t More HTML::Form tests
t/html/form-maxlength.t More HTML::Form tests
+t/html/form-selector.t More HTML::Form tests
t/live/apache.t
t/live/apache-listing.t Test File::Listing::apache package
t/live/https.t
@@ -1,6 +1,6 @@
--- #YAML:1.0
name: libwww-perl
-version: 5.826
+version: 5.830
abstract: The World-Wide Web library for Perl
author:
- Gisle Aas <gisle@activestate.com>
@@ -8,6 +8,8 @@ license: perl
distribution_type: module
configure_requires:
ExtUtils::MakeMaker: 0
+build_requires:
+ ExtUtils::MakeMaker: 0
requires:
Compress::Zlib: 1.10
Digest::MD5: 0
@@ -24,7 +26,7 @@ no_index:
directory:
- t
- inc
-generated_by: ExtUtils::MakeMaker version 6.4801
+generated_by: ExtUtils::MakeMaker version 6.55_02
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: 1.4
@@ -14,7 +14,7 @@ GetOptions(\my %opt,
};
my @prog;
-push(@prog, qw(lwp-request lwp-mirror lwp-rget lwp-download))
+push(@prog, qw(lwp-request lwp-mirror lwp-rget lwp-download lwp-dump))
unless $opt{'no-programs'} || grep /^LIB=/, @ARGV;
if ($opt{'aliases'} && grep(/lwp-request/, @prog)) {
@@ -67,7 +67,6 @@ if($] >= 5.008 && !(eval { require Encode; defined(Encode::decode("UTF-8", "\xff
"install the latest Encode from CPAN.\n\n";
}
-exit;
sub MY::test
@@ -73,7 +73,7 @@ unless (getopts('a', \%opt)) {
my $url = URI->new(shift || usage());
my $argfile = shift;
usage() if defined($argfile) && !length($argfile);
-my $VERSION = "5.813";
+my $VERSION = "5.827";
my $ua = LWP::UserAgent->new(
agent => "lwp-download/$VERSION ",
@@ -111,7 +111,7 @@ my $res = $ua->request(HTTP::Request->new(GET => $url),
# if this fails we try to make something from the URL
unless ($file) {
my $req = $res->request; # not always there
- my $rurl = $req ? $req->url : $url;
+ my $rurl = $req ? $req->uri : $url;
$file = ($rurl->path_segments)[-1];
if (!defined($file) || !length($file)) {
@@ -0,0 +1,107 @@
+#!/usr/bin/perl -w
+
+use strict;
+use LWP::UserAgent ();
+use Getopt::Long qw(GetOptions);
+
+my $VERSION = "5.827";
+
+GetOptions(\my %opt,
+ 'parse-head',
+ 'max-length=n',
+ 'keep-client-headers',
+ 'method=s',
+ 'agent=s',
+) || usage();
+
+my $url = shift || usage();
+@ARGV && usage();
+
+sub usage {
+ (my $progname = $0) =~ s,.*/,,;
+ die <<"EOT";
+Usage: $progname [options] <url>
+
+Recognized options are:
+ --agent <str>
+ --keep-client-headers
+ --max-length <n>
+ --method <str>
+ --parse-head
+
+EOT
+}
+
+my $ua = LWP::UserAgent->new(
+ parse_head => $opt{'parse-head'} || 0,
+ keep_alive => 1,
+ env_proxy => 1,
+ agent => $opt{agent} || "lwp-dump/$VERSION ",
+);
+
+my $req = HTTP::Request->new($opt{method} || 'GET' => $url);
+my $res = $ua->simple_request($req);
+$res->remove_header(grep /^Client-/, $res->header_field_names)
+ unless $opt{'keep-client-headers'} or
+ ($res->header("Client-Warning") || "") eq "Internal response";
+
+$res->dump(maxlength => $opt{'max-length'});
+
+__END__
+
+=head1 NAME
+
+lwp-dump - See what headers and content is returned for a URL
+
+=head1 SYNOPSIS
+
+B<lwp-dump> [ I<options> ] I<URL>
+
+=head1 DESCRIPTION
+
+The B<lwp-dump> program will get the resource indentified by the URL and then
+dump the response object to STDOUT. This will display the headers returned and
+the initial part of the content, escaped so that it's safe to display even
+binary content. The escapes syntax used is the same as for Perl's double
+quoted strings. If there is no content the string "(no content)" is shown in
+its place.
+
+The following options are recognized:
+
+=over
+
+=item B<--agent> I<str>
+
+Override the user agent string passed to the server.
+
+=item B<--keep-client-headers>
+
+LWP internally generate various C<Client-*> headers that are stripped by
+B<lwp-dump> in order to show the headers exactly as the server provided them.
+This option will suppress this.
+
+=item B<--max-length> I<n>
+
+How much of the content to show. The default is 512. Set this
+to 0 for unlimited.
+
+If the content is longer then the string is chopped at the
+limit and the string "...\n(### more bytes not shown)"
+appended.
+
+=item B<--method> I<str>
+
+Use the given method for the request instead of the default "GET".
+
+=item B<--parse-head>
+
+By default B<lwp-dump> will not try to initialize headers by looking at the
+head section of HTML documents. This option enables this. This corresponds to
+L<LWP::UserAgent/"parse_head">.
+
+=back
+
+=head1 SEE ALSO
+
+L<lwp-request>, L<LWP>, L<HTTP::Message/"dump">
+
@@ -180,7 +180,7 @@ $progname = $0;
$progname =~ s,.*[\\/],,; # use basename only
$progname =~ s/\.\w*$//; # strip extension, if any
-$VERSION = "5.824";
+$VERSION = "5.827";
require LWP;
@@ -411,11 +411,11 @@ while ($url = shift) {
$ua->proxy($url->scheme, $options{'p'}) if $options{'p'};
# Send the request and get a response back from the server
- $request->url($url);
+ $request->uri($url);
$response = $ua->request($request);
if ($options{'u'} || $options{'U'}) {
- my $url = $response->request->url->as_string;
+ my $url = $response->request->uri->as_string;
print "$method $url\n";
print $response->request->headers_as_string, "\n" if $options{'U'};
}
@@ -423,7 +423,7 @@ while ($url = shift) {
if ($options{'S'}) {
for my $r ($response->redirects, $response) {
my $method = $r->request->method;
- my $url = $r->request->url->as_string;
+ my $url = $r->request->uri->as_string;
print "$method $url --> ", $r->status_line, "\n";
}
}
@@ -152,7 +152,7 @@ my $progname = $0;
$progname =~ s|.*/||; # only basename left
$progname =~ s/\.\w*$//; #strip extension if any
-$VERSION = "5.818";
+$VERSION = "5.827";
#$Getopt::Long::debug = 1;
#$Getopt::Long::ignorecase = 0;
@@ -300,7 +300,7 @@ sub fetch
$req->header ('Accept', '*/*') if (defined $IIS); # GIF/JPG from IIS 2.0
$req->authorization_basic(split (/:/, $AUTH)) if (defined $AUTH);
if ($referer && !$SUPPRESS_REFERER) {
- if ($req->url->scheme eq 'http') {
+ if ($req->uri->scheme eq 'http') {
# RFC 2616, section 15.1.3
$referer = url($referer) unless ref($referer);
undef $referer if ($referer->scheme || '') eq 'https';
@@ -313,7 +313,7 @@ sub fetch
if ($res->is_success) {
my $doc = $res->content;
my $ct = $res->content_type;
- my $name = find_name($res->request->url, $ct);
+ my $name = find_name($res->request->uri, $ct);
print STDERR "$name\n" unless $QUIET;
$seen{$plain_url->as_string} = $name;
@@ -4,8 +4,11 @@ use strict;
use URI;
use Carp ();
-use vars qw($VERSION);
-$VERSION = "5.817";
+use vars qw($VERSION $Encode_available);
+$VERSION = "5.829";
+
+eval { require Encode };
+$Encode_available = !$@;
my %form_tags = map {$_ => 1} qw(input textarea button select option);
@@ -56,45 +59,67 @@ The following methods are available:
=over 4
-=item @forms = HTML::Form->parse( $response )
+=item @forms = HTML::Form->parse( $html_document, $base_uri )
-=item @forms = HTML::Form->parse( $html_document, $base )
+=item @forms = HTML::Form->parse( $html_document, base => $base_uri, %opt )
-=item @forms = HTML::Form->parse( $html_document, %opt )
+=item @forms = HTML::Form->parse( $response, %opt )
The parse() class method will parse an HTML document and build up
C<HTML::Form> objects for each <form> element found. If called in scalar
context only returns the first <form>. Returns an empty list if there
are no forms to be found.
-The $base is the URI used to retrieve the $html_document. It is
-needed to resolve relative action URIs. If the document was retrieved
-with LWP then this this parameter is obtained from the
-$response->base() method, as shown by the following example:
+The required arguments is the HTML document to parse ($html_document) and the
+URI used to retrieve the document ($base_uri). The base URI is needed to resolve
+relative action URIs. The provided HTML document should be a Unicode string
+(or US-ASCII).
+
+By default HTML::Form assumes that the original document was UTF-8 encoded and
+thus encode forms that don't specify an explict I<accept-charset> as UTF-8.
+The charset assumed can be overridden by providing the C<charset> option to
+parse(). It's a good idea to be explict about this parameter as well, thus
+the recommended simplest invocation becomes:
+
+ my @forms = HTML::Form->parse(
+ Encode::decode($encoding, $html_document_bytes),
+ base => $base_uri,
+ charset => $encoding,
+ );
+
+If the document was retrieved with LWP then the response object provide methods
+to obtain a proper value for C<base> and C<charset>:
my $ua = LWP::UserAgent->new;
my $response = $ua->get("http://www.example.com/form.html");
my @forms = HTML::Form->parse($response->decoded_content,
- $response->base);
+ base => $response->base,
+ charset => $response->content_charset,
+ );
-The parse() method can parse from an C<HTTP::Response> object
+In fact, the parse() method can parse from an C<HTTP::Response> object
directly, so the example above can be more conveniently written as:
my $ua = LWP::UserAgent->new;
my $response = $ua->get("http://www.example.com/form.html");
my @forms = HTML::Form->parse($response);
-Note that any object that implements a decoded_content() and base() method
-with similar behaviour as C<HTTP::Response> will do.
+Note that any object that implements a decoded_content(), base() and
+content_charset() method with similar behaviour as C<HTTP::Response> will do.
-Finally options might be passed in to control how the parse method
-behaves. The following options are currently recognized:
+Additional options might be passed in to control how the parse method
+behaves. The following are all the options currently recognized:
=over
=item C<< base => $uri >>
-Another way to provide the base URI.
+This is the URI used to retrive the original document. This option is not optional ;-)
+
+=item C<< charset => $str >>
+
+Specify what charset the original document was encoded in. This is used as
+the default for accept_charset. If not provided this defaults to "UTF-8".
=item C<< verbose => $bool >>
@@ -121,6 +146,7 @@ sub parse
die "Failed to create HTML::TokeParser object" unless $p;
my $base_uri = delete $opt{base};
+ my $charset = delete $opt{charset};
my $strict = delete $opt{strict};
my $verbose = delete $opt{verbose};
@@ -136,6 +162,14 @@ sub parse
Carp::croak("HTML::Form::parse: No \$base_uri provided");
}
}
+ unless (defined $charset) {
+ if (ref($html) and $html->can("content_charset")) {
+ $charset = $html->content_charset;
+ }
+ unless ($charset) {
+ $charset = "UTF-8";
+ }
+ }
my @forms;
my $f; # current form
@@ -151,6 +185,8 @@ sub parse
$f = $class->new($attr->{'method'},
$action,
$attr->{'enctype'});
+ $f->accept_charset($attr->{'accept-charset'}) if $attr->{'accept-charset'};
+ $f->{default_charset} = $charset;
$f->{attr} = $attr;
$f->strict(1) if $strict;
%openselect = ();
@@ -206,7 +242,9 @@ sub parse
if exists $attr->{$_};
}
# count this new select option separately
- $openselect{$attr->{name}}++;
+ my $name = $attr->{name};
+ $name = "" unless defined $name;
+ $openselect{$name}++;
while ($t = $p->get_tag) {
my $tag = shift @$t;
@@ -226,7 +264,7 @@ sub parse
$a{value_name} = $p->get_trimmed_text;
$a{value} = delete $a{value_name}
unless defined $a{value};
- $a{idx} = $openselect{$attr->{name}};
+ $a{idx} = $openselect{$name};
$f->push_input("option", \%a, $verbose);
}
else {
@@ -271,6 +309,8 @@ sub new {
$self->{method} = uc(shift || "GET");
$self->{action} = shift || Carp::croak("No action defined");
$self->{enctype} = lc(shift || "application/x-www-form-urlencoded");
+ $self->{accept_charset} = "UNKNOWN";
+ $self->{default_charset} = "UTF-8";
$self->{inputs} = [@_];
$self;
}
@@ -289,7 +329,11 @@ sub push_input
my @extra;
push(@extra, readonly => 1) if $type eq "hidden";
push(@extra, strict => 1) if $self->{strict};
-
+ if ($type eq "file" && exists $attr->{value}) {
+ # it's not safe to trust the value set by the server
+ # the user always need to explictly set the names of files to upload
+ $attr->{orig_value} = delete $attr->{value};
+ }
delete $attr->{type}; # don't confuse the type argument
my $input = $class->new(type => $type, %$attr, @extra);
$input->add_to_form($self);
@@ -317,11 +361,22 @@ I<method> to.
This method gets/sets the encoding type for the form data. It is a
string like "application/x-www-form-urlencoded" or "multipart/form-data".
+=item $accept = $form->accept_charset
+
+=item $form->accept_charset( $new_accept )
+
+This method gets/sets the list of charset encodings that the server processing
+the form accepts. Current implementation supports only one-element lists.
+Default value is "UNKNOWN" which we interpret as a request to use document
+charset as specified by the 'charset' parameter of the parse() method. To
+encode character strings you should have modern perl with Encode module. On
+older perls the setting of this attribute has no effect.
+
=cut
BEGIN {
# Set up some accesor
- for (qw(method action enctype)) {
+ for (qw(method action enctype accept_charset)) {
my $m = $_;
no strict 'refs';
*{$m} = sub {
@@ -399,17 +454,20 @@ sub inputs
}
-=item $input = $form->find_input( $name )
+=item $input = $form->find_input( $selector )
-=item $input = $form->find_input( $name, $type )
+=item $input = $form->find_input( $selector, $type )
-=item $input = $form->find_input( $name, $type, $index )
+=item $input = $form->find_input( $selector, $type, $index )
This method is used to locate specific inputs within the form. All
inputs that match the arguments given are returned. In scalar context
only the first is returned, or C<undef> if none match.
-If $name is specified, then the input must have the indicated name.
+If $selector is specified, then the input's name, id, class attribute must
+match. A selector prefixed with '#' must match the id attribute of the input.
+A selector prefixed with '.' matches the class attribute. A selector prefixed
+with '^' or with no prefix matches the name attribute.
If $type is specified, then the input must have the specified type.
The following type names are used: "text", "password", "hidden",
@@ -428,10 +486,7 @@ sub find_input
my @res;
my $c;
for (@{$self->{'inputs'}}) {
- if (defined $name) {
- next unless exists $_->{name};
- next if $name ne $_->{name};
- }
+ next if defined($name) && !$_->selected($name);
next if $type && $type ne $_->{type};
$c++;
next if $no && $no != $c;
@@ -443,10 +498,7 @@ sub find_input
else {
$no ||= 1;
for (@{$self->{'inputs'}}) {
- if (defined $name) {
- next unless exists $_->{name};
- next if $name ne $_->{name};
- }
+ next if defined($name) && !$_->selected($name);
next if $type && $type ne $_->{type};
next if --$no;
return $_;
@@ -464,9 +516,9 @@ sub fixup
}
-=item $value = $form->value( $name )
+=item $value = $form->value( $selector )
-=item $form->value( $name, $new_value )
+=item $form->value( $selector, $new_value )
The value() method can be used to get/set the value of some input. If
strict is enabled and no input has the indicated name, then this method will croak.
@@ -641,6 +693,13 @@ sub make_request
my $enctype = $self->{'enctype'};
my @form = $self->form;
+ my $charset = $self->accept_charset eq "UNKNOWN" ? $self->{default_charset} : $self->accept_charset;
+ if ($Encode_available) {
+ foreach my $fi (@form) {
+ $fi = Encode::encode($charset, $fi) unless ref($fi);
+ }
+ }
+
if ($method eq "GET") {
require HTTP::Request;
$uri = URI->new($uri, "http");
@@ -660,23 +719,24 @@ sub make_request
=item $request = $form->click
-=item $request = $form->click( $name )
+=item $request = $form->click( $selector )
=item $request = $form->click( $x, $y )
-=item $request = $form->click( $name, $x, $y )
+=item $request = $form->click( $selector, $x, $y )
Will "click" on the first clickable input (which will be of type
C<submit> or C<image>). The result of clicking is an C<HTTP::Request>
object that can then be passed to C<LWP::UserAgent> if you want to
obtain the server response.
-If a $name is specified, we will click on the first clickable input
-with the given name, and the method will croak if no clickable input
-with the given name is found. If $name is I<not> specified, then it
+If a $selector is specified, we will click on the first clickable input
+matching the selector, and the method will croak if no matching clickable
+input is found. If $selector is I<not> specified, then it
is ok if the form contains no clickable inputs. In this case the
click() method returns the same request as the make_request() method
-would do.
+would do. See description of the find_input() method above for how
+the $selector is specified.
If there are multiple clickable inputs with the same name, then there
is no way to get the click() method of the C<HTML::Form> to click on
@@ -701,7 +761,7 @@ sub click
# try to find first submit button to activate
for (@{$self->{'inputs'}}) {
next unless $_->can("click");
- next if $name && $_->name ne $name;
+ next if $name && !$_->selected($name);
next if $_->disabled;
return $_->click($self, @_);
}
@@ -836,6 +896,17 @@ sub type
This method can be used to get/set the current name of the input.
+=item $input->id
+
+=item $input->class
+
+These methods can be used to get/set the current id or class attribute for the input.
+
+=item $input->selected( $selector )
+
+Returns TRUE if the given selector matched the input. See the description of
+the find_input() method above for a description of the selector syntax.
+
=item $value = $input->value
=item $input->value( $new_value )
@@ -860,6 +931,34 @@ sub name
$old;
}
+sub id
+{
+ my $self = shift;
+ my $old = $self->{id};
+ $self->{id} = shift if @_;
+ $old;
+}
+
+sub class
+{
+ my $self = shift;
+ my $old = $self->{class};
+ $self->{class} = shift if @_;
+ $old;
+}
+
+sub selected {
+ my($self, $sel) = @_;
+ return undef unless defined $sel;
+ my $attr =
+ $sel =~ s/^\^// ? "name" :
+ $sel =~ s/^#// ? "id" :
+ $sel =~ s/^\.// ? "class" :
+ "name";
+ return 0 unless defined $self->{$attr};
+ return $self->{$attr} eq $sel;
+}
+
sub value
{
my $self = shift;
@@ -1322,6 +1421,10 @@ If the input is of type C<file>, then it has these additional methods:
This is just an alias for the value() method. It sets the filename to
read data from.
+For security reasons this field will never be initialized from the parsing
+of a form. This prevents the server from triggering stealth uploads of
+arbitrary files from the client machine.
+
=cut
sub file {
@@ -5,7 +5,7 @@ use HTTP::Date qw(str2time time2str);
use HTTP::Headers::Util qw(_split_header_words join_header_words);
use vars qw($VERSION $EPOCH_OFFSET);
-$VERSION = "5.824";
+$VERSION = "5.827";
# Legacy: because "use "HTTP::Cookies" used be the ONLY way
# to load the class HTTP::Cookies::Netscape.
@@ -39,7 +39,7 @@ sub add_cookie_header
{
my $self = shift;
my $request = shift || return;
- my $url = $request->url;
+ my $url = $request->uri;
my $scheme = $url->scheme;
unless ($scheme =~ /^https?\z/) {
return;
@@ -177,7 +177,7 @@ sub extract_cookies
return $response unless @set || @ns_set; # quick exit
my $request = $response->request;
- my $url = $request->url;
+ my $url = $request->uri;
my $req_host = _host($request, $url);
$req_host = "$req_host.local" unless $req_host =~ /\./;
my $req_port = $url->port;
@@ -3,7 +3,7 @@ package HTTP::Daemon;
use strict;
use vars qw($VERSION @ISA $PROTO $DEBUG);
-$VERSION = "5.826";
+$VERSION = "5.827";
use IO::Socket qw(AF_INET INADDR_ANY inet_ntoa);
@ISA=qw(IO::Socket::INET);
@@ -626,7 +626,7 @@ HTTP::Daemon - a simple http server class
print "Please contact me at: <URL:", $d->url, ">\n";
while (my $c = $d->accept) {
while (my $r = $c->get_request) {
- if ($r->method eq 'GET' and $r->url->path eq "/xyzzy") {
+ if ($r->method eq 'GET' and $r->uri->path eq "/xyzzy") {
# remember, this is *not* recommended practice :-)
$c->send_file_response("/etc/passwd");
}
@@ -4,7 +4,7 @@ use strict;
use Carp ();
use vars qw($VERSION $TRANSLATE_UNDERSCORE);
-$VERSION = "5.822";
+$VERSION = "5.827";
# The $TRANSLATE_UNDERSCORE variable controls whether '_' can be used
# as a replacement for '-' in header field names.
@@ -313,6 +313,37 @@ sub content_type {
wantarray ? @ct : $ct[0];
}
+sub content_type_charset {
+ my $self = shift;
+ require HTTP::Headers::Util;
+ my $h = $self->{'content-type'};
+ $h = $h->[0] if ref($h);
+ $h = "" unless defined $h;
+ my @v = HTTP::Headers::Util::split_header_words($h);
+ if (@v) {
+ my($ct, undef, %ct_param) = @{$v[0]};
+ my $charset = $ct_param{charset};
+ if ($ct) {
+ $ct = lc($ct);
+ $ct =~ s/\s+//;
+ }
+ if ($charset) {
+ $charset = uc($charset);
+ $charset =~ s/^\s+//; $charset =~ s/\s+\z//;
+ undef($charset) if $charset eq "";
+ }
+ return $ct, $charset if wantarray;
+ return $charset;
+ }
+ return undef, undef if wantarray;
+ return undef;
+}
+
+sub content_is_text {
+ my $self = shift;
+ return $self->content_type =~ m,^text/,;
+}
+
sub content_is_html {
my $self = shift;
return $self->content_type eq 'text/html' || $self->content_is_xhtml;
@@ -635,6 +666,17 @@ string is returned. This makes it safe to do the following:
...
}
+=item $h->content_type_charset
+
+Returns the upper-cased charset specified in the Content-Type header. In list
+context return the lower-cased bare content type followed by the upper-cased
+charset. Both values will be C<undef> if not specified in the header.
+
+=item $h->content_is_text
+
+Returns TRUE if the Content-Type header field indicate that the
+content is textual.
+
=item $h->content_is_html
Returns TRUE if the Content-Type header field indicate that the
@@ -2,7 +2,7 @@ package HTTP::Message;
use strict;
use vars qw($VERSION $AUTOLOAD);
-$VERSION = "5.826";
+$VERSION = "5.828";
require HTTP::Headers;
require Carp;
@@ -194,6 +194,94 @@ sub content_ref
}
+sub content_charset
+{
+ my $self = shift;
+ if (my $charset = $self->content_type_charset) {
+ return $charset;
+ }
+
+ # time to start guessing
+ my $cref = $self->decoded_content(ref => 1, charset => "none");
+
+ # Unicode BOM
+ local $_;
+ for ($$cref) {
+ return "UTF-8" if /^\xEF\xBB\xBF/;
+ return "UTF-32-LE" if /^\xFF\xFE\x00\x00/;
+ return "UTF-32-BE" if /^\x00\x00\xFE\xFF/;
+ return "UTF-16-LE" if /^\xFF\xFE/;
+ return "UTF-16-BE" if /^\xFE\xFF/;
+ }
+
+ if ($self->content_is_xml) {
+ # http://www.w3.org/TR/2006/REC-xml-20060816/#sec-guessing
+ # XML entity not accompanied by external encoding information and not
+ # in UTF-8 or UTF-16 encoding must begin with an XML encoding declaration,
+ # in which the first characters must be '<?xml'
+ for ($$cref) {
+ return "UTF-32-BE" if /^\x00\x00\x00</;
+ return "UTF-32-LE" if /^<\x00\x00\x00/;
+ return "UTF-16-BE" if /^(?:\x00\s)*\x00</;
+ return "UTF-16-LE" if /^(?:\s\x00)*<\x00/;
+ if (/^\s*(<\?xml[^\x00]*?\?>)/) {
+ if ($1 =~ /\sencoding\s*=\s*(["'])(.*?)\1/) {
+ my $enc = $2;
+ $enc =~ s/^\s+//; $enc =~ s/\s+\z//;
+ return $enc if $enc;
+ }
+ }
+ }
+ return "UTF-8";
+ }
+ elsif ($self->content_is_html) {
+ # look for <META charset="..."> or <META content="...">
+ # http://dev.w3.org/html5/spec/Overview.html#determining-the-character-encoding
+ my $charset;
+ require HTML::Parser;
+ my $p = HTML::Parser->new(
+ start_h => [sub {
+ my($tag, $attr, $self) = @_;
+ $charset = $attr->{charset};
+ unless ($charset) {
+ # look at $attr->{content} ...
+ if (my $c = $attr->{content}) {
+ require HTTP::Headers::Util;
+ my @v = HTTP::Headers::Util::split_header_words($c);
+ my($ct, undef, %ct_param) = @{$v[0]};
+ $charset = $ct_param{charset};
+ }
+ return unless $charset;
+ }
+ if ($charset =~ /^utf-?16/i) {
+ # converted document, assume UTF-8
+ $charset = "UTF-8";
+ }
+ $self->eof;
+ }, "tagname, attr, self"],
+ report_tags => [qw(meta)],
+ );
+ $p->parse($$cref);
+ return $charset if $charset;
+ }
+ if ($self->content_type =~ /^text\//) {
+ for ($$cref) {
+ if (length) {
+ return "US-ASCII" unless /[\x80-\xFF]/;
+ require Encode;
+ eval {
+ Encode::decode_utf8($_, Encode::FB_CROAK());
+ };
+ return "UTF-8" unless $@;
+ return "ISO-8859-1";
+ }
+ }
+ }
+
+ return undef;
+}
+
+
sub decoded_content
{
my($self, %opt) = @_;
@@ -201,14 +289,6 @@ sub decoded_content
my $content_ref_iscopy;
eval {
-
- require HTTP::Headers::Util;
- my($ct, %ct_param);
- if (my @ct = HTTP::Headers::Util::split_header_words($self->header("Content-Type"))) {
- ($ct, undef, %ct_param) = @{$ct[-1]};
- die "Can't decode multipart content" if $ct =~ m,^multipart/,;
- }
-
$content_ref = $self->content_ref;
die "Can't decode ref content" if ref($content_ref) ne "SCALAR";
@@ -296,10 +376,15 @@ sub decoded_content
}
}
- if ($ct && $ct =~ m,^text/,,) {
- my $charset = $opt{charset} || $ct_param{charset} || $opt{default_charset} || "ISO-8859-1";
- $charset = lc($charset);
- if ($charset ne "none") {
+ if ($self->content_is_text || $self->content_is_xml) {
+ my $charset = lc(
+ $opt{charset} ||
+ $self->content_type_charset ||
+ $opt{default_charset} ||
+ $self->content_charset ||
+ "ISO-8859-1"
+ );
+ unless ($charset =~ /^(?:none|us-ascii|iso-8859-1)\z/) {
require Encode;
if (do{my $v = $Encode::VERSION; $v =~ s/_//g; $v} < 2.0901 &&
!$content_ref_iscopy)
@@ -756,6 +841,15 @@ will automatically dereference scalar references passed this way. For
other references content() will return the reference itself and
add_content() will refuse to do anything.
+=item $mess->content_charset
+
+This returns the charset used by the content in the message. The
+charset is either found as the charset attribute of the
+C<Content-Type> header or by guessing.
+
+See L<http://www.w3.org/TR/REC-html40/charset.html#spec-char-encoding>
+for details about how charset is determined.
+
=item $mess->decoded_content( %options )
Returns the content with any C<Content-Encoding> undone and the raw
@@ -774,7 +868,8 @@ C<none> can used to suppress decoding of the charset.
=item C<default_charset>
-This override the default charset of "ISO-8859-1".
+This override the default charset guessed by content_charset() or
+if that fails "ISO-8859-1".
=item C<charset_strict>
@@ -2,7 +2,7 @@ package HTTP::Request;
require HTTP::Message;
@ISA = qw(HTTP::Message);
-$VERSION = "5.818";
+$VERSION = "5.827";
use strict;
@@ -119,7 +119,7 @@ sub as_string
sub dump
{
my $self = shift;
- my @pre = ($self->method || "-", $self->url || "-");
+ my @pre = ($self->method || "-", $self->uri || "-");
if (my $prot = $self->protocol) {
push(@pre, $prot);
}
@@ -13,7 +13,7 @@ sub auth_header {
my $nc = sprintf "%08X", ++$ua->{authen_md5_nonce_count}{$auth_param->{nonce}};
my $cnonce = sprintf "%8x", time;
- my $uri = $request->url->path_query;
+ my $uri = $request->uri->path_query;
$uri = "/" unless length $uri;
my $md5 = Digest::MD5->new;
@@ -3,7 +3,7 @@ package LWP::Authen::Ntlm;
use strict;
use vars qw/$VERSION/;
-$VERSION = '5.822';
+$VERSION = '5.827';
use Authen::NTLM "1.02";
use MIME::Base64 "2.12";
@@ -13,7 +13,7 @@ sub authenticate {
$request, $arg, $size) = @_;
my($user, $pass) = $ua->get_basic_credentials($auth_param->{realm},
- $request->url, $proxy);
+ $request->uri, $proxy);
unless(defined $user and defined $pass) {
return $response;
@@ -33,7 +33,7 @@ sub request
"$method for 'data:' URLs";
}
- my $url = $request->url;
+ my $url = $request->uri;
my $response = new HTTP::Response &HTTP::Status::RC_OK, "Document follows";
my $media_type = $url->media_type;
@@ -34,7 +34,7 @@ sub request
}
# check url
- my $url = $request->url;
+ my $url = $request->uri;
my $scheme = $url->scheme;
if ($scheme ne 'file') {
@@ -133,7 +133,7 @@ sub request
'You can not proxy through the ftp');
}
- my $url = $request->url;
+ my $url = $request->uri;
if ($url->scheme ne 'ftp') {
my $scheme = $url->scheme;
return HTTP::Response->new(&HTTP::Status::RC_INTERNAL_SERVER_ERROR,
@@ -347,7 +347,7 @@ sub request
elsif ($prefer eq 'html') {
$response->header('Content-Type' => 'text/html');
$content = "<HEAD><TITLE>File Listing</TITLE>\n";
- my $base = $request->url->clone;
+ my $base = $request->uri->clone;
my $path = $base->path;
$base->path("$path/") unless $path =~ m|/$|;
$content .= qq(<BASE HREF="$base">\n</HEAD>\n);
@@ -51,7 +51,7 @@ sub request
'You can not proxy through the gopher');
}
- my $url = $request->url;
+ my $url = $request->uri;
die "bad scheme" if $url->scheme ne 'gopher';
@@ -126,7 +126,7 @@ sub request
"$method for 'http:' URLs";
}
- my $url = $request->url;
+ my $url = $request->uri;
my($host, $port, $fullpath);
# Check if we're proxy'ing
@@ -269,7 +269,7 @@ sub request
SELECT:
{
my $nfound = select($rbits, $wbits, undef, $sel_timeout);
- unless (defined $nfound) {
+ if ($nfound < 0) {
if ($!{EINTR} || $!{EAGAIN}) {
if ($time_before) {
$sel_timeout = $sel_timeout_before - (time - $time_before);
@@ -436,7 +436,7 @@ sub can_read {
my $before;
$before = time if $timeout;
my $nfound = select($fbits, undef, undef, $timeout);
- unless (defined $nfound) {
+ if ($nfound < 0) {
if ($!{EINTR} || $!{EAGAIN}) {
# don't really think EAGAIN can happen here
if ($timeout) {
@@ -102,7 +102,7 @@ sub request
"$method for 'http:' URLs";
}
- my $url = $request->url;
+ my $url = $request->uri;
my($host, $port, $fullpath);
# Check if we're proxy'ing
@@ -53,7 +53,7 @@ sub request
}
# check url
- my $url = $request->url;
+ my $url = $request->uri;
my $scheme = $url->scheme;
if ($scheme ne 'mailto') {
@@ -25,7 +25,7 @@ sub request
}
# Check that the scheme is as expected
- my $url = $request->url;
+ my $url = $request->uri;
my $scheme = $url->scheme;
unless ($scheme eq 'news' || $scheme eq 'nntp') {
return HTTP::Response->new(&HTTP::Status::RC_INTERNAL_SERVER_ERROR,
@@ -14,7 +14,7 @@ require LWP::Protocol;
sub request {
my($self, $request) = @_;
- my $scheme = $request->url->scheme;
+ my $scheme = $request->uri->scheme;
return HTTP::Response->new(
&HTTP::Status::RC_INTERNAL_SERVER_ERROR,
@@ -2,7 +2,7 @@ package LWP::Protocol;
require LWP::MemberMixin;
@ISA = qw(LWP::MemberMixin);
-$VERSION = "5.826";
+$VERSION = "5.829";
use strict;
use Carp ();
@@ -161,9 +161,12 @@ sub collect
}
}
};
- if ($@) {
- chomp($@);
- $response->push_header('X-Died' => $@);
+ my $err = $@;
+ delete $response->{handlers}{response_data};
+ delete $response->{handlers} unless %{$response->{handlers}};
+ if ($err) {
+ chomp($err);
+ $response->push_header('X-Died' => $err);
$response->push_header("Client-Aborted", "die");
return $response;
}
@@ -2,7 +2,7 @@ package LWP::RobotUA;
require LWP::UserAgent;
@ISA = qw(LWP::UserAgent);
-$VERSION = "5.822";
+$VERSION = "5.827";
require WWW::RobotRules;
require HTTP::Request;
@@ -114,11 +114,11 @@ sub simple_request
my($self, $request, $arg, $size) = @_;
# Do we try to access a new server?
- my $allowed = $self->{'rules'}->allowed($request->url);
+ my $allowed = $self->{'rules'}->allowed($request->uri);
if ($allowed < 0) {
# Host is not visited before, or robots.txt expired; fetch "robots.txt"
- my $robot_url = $request->url->clone;
+ my $robot_url = $request->uri->clone;
$robot_url->path("robots.txt");
$robot_url->query(undef);
@@ -143,7 +143,7 @@ sub simple_request
}
# recalculate allowed...
- $allowed = $self->{'rules'}->allowed($request->url);
+ $allowed = $self->{'rules'}->allowed($request->uri);
}
# Check rules
@@ -154,7 +154,7 @@ sub simple_request
return $res;
}
- my $netloc = eval { local $SIG{__DIE__}; $request->url->host_port; };
+ my $netloc = eval { local $SIG{__DIE__}; $request->uri->host_port; };
my $wait = $self->host_wait($netloc);
if ($wait) {
@@ -14,51 +14,27 @@ require Exporter;
use HTTP::Status;
push(@EXPORT, @HTTP::Status::EXPORT);
-$VERSION = "5.810";
-$FULL_LWP++ if grep {lc($_) eq "http_proxy"} keys %ENV;
-
+$VERSION = "5.827";
sub import
{
my $pkg = shift;
my $callpkg = caller;
- if (grep $_ eq '$ua', @_) {
- $FULL_LWP++;
- _init_ua();
- }
Exporter::export($pkg, $callpkg, @_);
}
-
-sub _init_ua
-{
- require LWP;
- require LWP::UserAgent;
- require HTTP::Status;
- require HTTP::Date;
- $ua = new LWP::UserAgent; # we create a global UserAgent object
- my $ver = $LWP::VERSION = $LWP::VERSION; # avoid warning
- $ua->agent("LWP::Simple/$LWP::VERSION");
- $ua->env_proxy;
-}
+use LWP::UserAgent ();
+use HTTP::Status ();
+use HTTP::Date ();
+$ua = new LWP::UserAgent; # we create a global UserAgent object
+$ua->agent("LWP::Simple/$VERSION ");
+$ua->env_proxy;
sub get ($)
{
- %loop_check = ();
- goto \&_get;
-}
-
-
-sub get_old ($)
-{
- my($url) = @_;
- _init_ua() unless $ua;
-
- my $request = HTTP::Request->new(GET => $url);
- my $response = $ua->request($request);
-
- return $response->content if $response->is_success;
+ my $response = $ua->get(shift);
+ return $response->decoded_content if $response->is_success;
return undef;
}
@@ -66,8 +42,6 @@ sub get_old ($)
sub head ($)
{
my($url) = @_;
- _init_ua() unless $ua;
-
my $request = HTTP::Request->new(HEAD => $url);
my $response = $ua->request($request);
@@ -87,8 +61,6 @@ sub head ($)
sub getprint ($)
{
my($url) = @_;
- _init_ua() unless $ua;
-
my $request = HTTP::Request->new(GET => $url);
local($\) = ""; # ensure standard $OUTPUT_RECORD_SEPARATOR
my $callback = sub { print $_[0] };
@@ -106,8 +78,6 @@ sub getprint ($)
sub getstore ($$)
{
my($url, $file) = @_;
- _init_ua() unless $ua;
-
my $request = HTTP::Request->new(GET => $url);
my $response = $ua->request($request, $file);
@@ -118,80 +88,11 @@ sub getstore ($$)
sub mirror ($$)
{
my($url, $file) = @_;
- _init_ua() unless $ua;
my $response = $ua->mirror($url, $file);
$response->code;
}
-sub _get
-{
- my $url = shift;
- my $ret;
- if (!$FULL_LWP && $url =~ m,^http://([^/:\@]+)(?::(\d+))?(/\S*)?$,) {
- my $host = $1;
- my $port = $2 || 80;
- my $path = $3;
- $path = "/" unless defined($path);
- return _trivial_http_get($host, $port, $path);
- }
- else {
- _init_ua() unless $ua;
- if (@_ && $url !~ /^\w+:/) {
- # non-absolute redirect from &_trivial_http_get
- my($host, $port, $path) = @_;
- require URI;
- $url = URI->new_abs($url, "http://$host:$port$path");
- }
- my $request = HTTP::Request->new(GET => $url);
- my $response = $ua->request($request);
- return $response->is_success ? $response->content : undef;
- }
-}
-
-
-sub _trivial_http_get
-{
- my($host, $port, $path) = @_;
- #print "HOST=$host, PORT=$port, PATH=$path\n";
-
- require IO::Socket;
- local($^W) = 0;
- my $sock = IO::Socket::INET->new(PeerAddr => $host,
- PeerPort => $port,
- Proto => 'tcp',
- Timeout => 60) || return undef;
- $sock->autoflush;
- my $netloc = $host;
- $netloc .= ":$port" if $port != 80;
- print $sock join("\015\012" =>
- "GET $path HTTP/1.0",
- "Host: $netloc",
- "User-Agent: lwp-trivial/$VERSION",
- "", "");
-
- my $buf = "";
- my $n;
- 1 while $n = sysread($sock, $buf, 8*1024, length($buf));
- return undef unless defined($n);
-
- if ($buf =~ m,^HTTP/\d+\.\d+\s+(\d+)[^\012]*\012,) {
- my $code = $1;
- #print "CODE=$code\n$buf\n";
- if ($code =~ /^30[1237]/ && $buf =~ /\012Location:\s*(\S+)/i) {
- # redirect
- my $url = $1;
- return undef if $loop_check{$url}++;
- return _get($url, $host, $port, $path);
- }
- return undef unless $code =~ /^2/;
- $buf =~ s/.+?\015?\012\015?\012//s; # zap header
- }
-
- return $buf;
-}
-
-
1;
__END__
@@ -328,7 +229,7 @@ The module will also export the LWP::UserAgent object as C<$ua> if you
ask for it explicitly.
The user agent created by this module will identify itself as
-"LWP::Simple/#.##" (where "#.##" is the libwww-perl version number)
+"LWP::Simple/#.##"
and will initialize its proxy defaults from the environment (by
calling $ua->env_proxy).
@@ -5,7 +5,7 @@ use vars qw(@ISA $VERSION);
require LWP::MemberMixin;
@ISA = qw(LWP::MemberMixin);
-$VERSION = "5.826";
+$VERSION = "5.829";
use HTTP::Request ();
use HTTP::Response ();
@@ -203,19 +203,12 @@ sub prepare_request
{
my($self, $request) = @_;
die "Method missing" unless $request->method;
- my $url = $request->url;
+ my $url = $request->uri;
die "URL missing" unless $url;
die "URL must be absolute" unless $url->scheme;
$self->run_handlers("request_preprepare", $request);
- my $max_size = $self->{max_size};
- if (defined $max_size) {
- my $last = $max_size - 1;
- $last = 0 if $last < 0; # there is no way to actually request no content
- $request->init_header('Range' => "bytes=0-$last");
- }
-
if (my $def_headers = $self->{def_headers}) {
for my $h ($def_headers->header_field_names) {
$request->init_header($h => [$def_headers->header($h)]);
@@ -288,8 +281,8 @@ sub request
$referral->remove_header('Host', 'Cookie');
if ($referral->header('Referer') &&
- $request->url->scheme eq 'https' &&
- $referral->url->scheme eq 'http')
+ $request->uri->scheme eq 'https' &&
+ $referral->uri->scheme eq 'http')
{
# RFC 2616, section 15.1.3.
# https -> http redirect, suppressing Referer
@@ -318,7 +311,7 @@ sub request
$referral_uri = $HTTP::URI_CLASS->new($referral_uri, $base)
->abs($base);
}
- $referral->url($referral_uri);
+ $referral->uri($referral_uri);
return $response unless $self->redirect_ok($referral, $response);
return $self->request($referral, $arg, $size, $response);
@@ -546,7 +539,7 @@ sub redirect_ok
return 0 unless grep $_ eq $method,
@{ $self->requests_redirectable || [] };
- if ($new_request->url->scheme eq 'file') {
+ if ($new_request->uri->scheme eq 'file') {
$response->header("Client-Warning" =>
"Can't redirect to a file:// URL!");
return 0;
@@ -593,14 +586,21 @@ sub parse_head {
my $old = $self->set_my_handler("response_header", $flag ? sub {
my($response, $ua) = @_;
require HTML::HeadParser;
- $parser = HTML::HeadParser->new($response->{'_headers'});
+ $parser = HTML::HeadParser->new;
$parser->xml_mode(1) if $response->content_is_xhtml;
$parser->utf8_mode(1) if $] >= 5.008 && $HTML::Parser::VERSION >= 3.40;
push(@{$response->{handlers}{response_data}}, {
callback => sub {
return unless $parser;
- $parser->parse($_[3]) or undef($parser);
+ unless ($parser->parse($_[3])) {
+ my $h = $parser->header;
+ my $r = $_[0];
+ for my $f ($h->header_field_names) {
+ $r->init_header($f, [$h->header($f)]);
+ }
+ undef($parser);
+ }
},
});
@@ -824,47 +824,50 @@ sub mirror
my $request = HTTP::Request->new('GET', $url);
- if (-e $file) {
- my($mtime) = (stat($file))[9];
- if($mtime) {
- $request->header('If-Modified-Since' =>
- HTTP::Date::time2str($mtime));
- }
+ # If the file exists, add a cache-related header
+ if ( -e $file ) {
+ my ($mtime) = ( stat($file) )[9];
+ if ($mtime) {
+ $request->header( 'If-Modified-Since' => HTTP::Date::time2str($mtime) );
+ }
}
my $tmpfile = "$file-$$";
my $response = $self->request($request, $tmpfile);
- if ($response->is_success) {
- my $file_length = (stat($tmpfile))[7];
- my($content_length) = $response->header('Content-length');
+ # Only fetching a fresh copy of the would be considered success.
+ # If the file was not modified, "304" would returned, which
+ # is considered by HTTP::Status to be a "redirect", /not/ "success"
+ if ( $response->is_success ) {
+ my $file_length = ( stat($tmpfile) )[7];
+ my ($content_length) = $response->header('Content-length');
- if (defined $content_length and $file_length < $content_length) {
- unlink($tmpfile);
- die "Transfer truncated: " .
- "only $file_length out of $content_length bytes received\n";
- }
- elsif (defined $content_length and $file_length > $content_length) {
- unlink($tmpfile);
- die "Content-length mismatch: " .
- "expected $content_length bytes, got $file_length\n";
- }
- else {
- # OK
- if (-e $file) {
- # Some dosish systems fail to rename if the target exists
- chmod 0777, $file;
- unlink $file;
- }
- rename($tmpfile, $file) or
- die "Cannot rename '$tmpfile' to '$file': $!\n";
+ if ( defined $content_length and $file_length < $content_length ) {
+ unlink($tmpfile);
+ die "Transfer truncated: " . "only $file_length out of $content_length bytes received\n";
+ }
+ elsif ( defined $content_length and $file_length > $content_length ) {
+ unlink($tmpfile);
+ die "Content-length mismatch: " . "expected $content_length bytes, got $file_length\n";
+ }
+ # The file was the expected length.
+ else {
+ # Replace the stale file with a fresh copy
+ if ( -e $file ) {
+ # Some dosish systems fail to rename if the target exists
+ chmod 0777, $file;
+ unlink $file;
+ }
+ rename( $tmpfile, $file )
+ or die "Cannot rename '$tmpfile' to '$file': $!\n";
- if (my $lm = $response->last_modified) {
- # make sure the file has the same last modification time
- utime $lm, $lm, $file;
- }
- }
+ # make sure the file has the same last modification time
+ if ( my $lm = $response->last_modified ) {
+ utime $lm, $lm, $file;
+ }
+ }
}
+ # The local copy is fresh enough, so just delete the temp file
else {
unlink($tmpfile);
}
@@ -875,9 +878,9 @@ sub mirror
sub _need_proxy {
my($req, $ua) = @_;
return if exists $req->{proxy};
- my $proxy = $ua->{proxy}{$req->url->scheme} || return;
+ my $proxy = $ua->{proxy}{$req->uri->scheme} || return;
if ($ua->{no_proxy}) {
- if (my $host = eval { $req->url->host }) {
+ if (my $host = eval { $req->uri->host }) {
for my $domain (@{$ua->{no_proxy}}) {
if ($host =~ /\Q$domain\E$/) {
return;
@@ -1290,7 +1293,7 @@ proxy URL for a single access scheme.
Do not proxy requests to the given domains. Calling no_proxy without
any domains clears the list of domains. Eg:
- $ua->no_proxy('localhost', 'no', ...);
+ $ua->no_proxy('localhost', 'example.com');
=item $ua->env_proxy
@@ -1299,7 +1302,7 @@ specify proxies like this (sh-syntax):
gopher_proxy=http://proxy.my.place/
wais_proxy=http://proxy.my.place/
- no_proxy="localhost,my.domain"
+ no_proxy="localhost,example.com"
export gopher_proxy wais_proxy no_proxy
csh or tcsh users should use the C<setenv> command to define these
@@ -1453,6 +1456,15 @@ are given as separate name/value pairs. The return value is a
response object. See L<HTTP::Response> for a description of the
interface it provides.
+There will still be a response object returned when LWP can't connect to the
+server specified in the URL or when other failures in protocol handlers occur.
+These internal responses use the standard HTTP status codes, so the responses
+can't be differentiated by testing the response status code alone. Error
+responses that LWP generates internally will have the "Client-Warning" header
+set to the value "Internal response". If you need to differentiate these
+internal responses from responses that a remote server actually generates, you
+need to test this header value.
+
Fields names that start with ":" are special. These will not
initialize headers of the request but will determine how the response
content is treated. The following special field names are recognized:
@@ -1,118 +1,1064 @@
-# This file defines the mapping from file name extentions to media types.
-# Media types where the subtype does not have the "x-" prefix should be
-# registered by IANA:
-#
-# ftp://www.isi.edu/in-notes/iana/assignments/media-types/
-#
-# See also: RFC-1590
+# This is a comment. I love comments.
-# Text formats
-text/html html htm
-text/plain txt text pm el c h cc hh cxx hxx f90
-text/richtext rtx
-text/tab-separated-values tsv
+# This file controls what Internet media types are sent to the client for
+# given file extension(s). Sending the correct media type to the client
+# is important so they know how to handle the content of the file.
+# For more information about Internet media types, please read RFC 2045,
+# 2046, 2047, 2048, and 2077. The Internet media type registry is
+# at <http://www.iana.org/assignments/media-types/>.
-text/x-setext etx
-text/x-pod pod # Perl documentation
-
-# Image formats
-image/png png
-image/gif gif # Compuserve
-image/ief ief
-image/jpeg jpeg jpg jpe jfif
-image/tiff tiff tif
-
-image/x-cmu-raster ras
-image/x-portable-anymap pnm
-image/x-portable-bitmap pbm
-image/x-portable-graymap pgm
-image/x-portable-pixmap ppm
-image/x-rgb rgb # SGI IRIS
-image/x-xbitmap xbm # X Windows
-image/x-xpixmap xpm # X Windows
-image/x-xwindowdump xwd # X Windows
-image/x-bmp bmp # MS Windows
-image/x-targa tga
-image/x-fits fts
-
-
-# Audio formats
-audio/basic au snd
-audio/x-aiff aif aiff aifc
-audio/x-wav wav # MS Windows
-audio/x-mpeg-2 mp2 # MPEG layer 2 audio
-
-# Video formats
-video/mpeg mpeg mpg mpe
-video/quicktime qt mov
-video/x-msvideo avi
-video/x-sgi-movie movie
-
-# Message
-message/rfc822 mail
-message/partial
-message/external-body
-message/news art
-
-# Applications
-application/octet-stream bin
-application/postscript ai eps ps
-application/oda oda
-application/atomicmail
-application/andrew-insert
-application/slate
-application/wita
-application/dec-dx
-application/dca-rtf
+# MIME type Extensions
application/activemessage
-application/rtf rft # MS Word
+application/andrew-inset ez
application/applefile
-application/mac-binhex40 hqx
-application/news-message-id
-application/news-transmission
-application/wordperfect5.1
-application/pdf pdf
-application/zip zip
-application/macwriteii
-application/msword
-application/remote-printing
-application/mathematica
-application/cybercash
+application/atom+xml atom
+application/atomcat+xml atomcat
+application/atomicmail
+application/atomsvc+xml atomsvc
+application/auth-policy+xml
+application/batch-smtp
+application/beep+xml
+application/cals-1840
+application/ccxml+xml ccxml
+application/cellml+xml
+application/cnrp+xml
application/commonground
+application/conference-info+xml
+application/cpl+xml
+application/csta+xml
+application/cstadata+xml
+application/cybercash
+application/davmount+xml davmount
+application/dca-rft
+application/dec-dx
+application/dialog-info+xml
+application/dicom
+application/dns
+application/dvcs
+application/ecmascript ecma
+application/edi-consent
+application/edi-x12
+application/edifact
+application/epp+xml
+application/eshop
+application/fastinfoset
+application/fastsoap
+application/fits
+application/font-tdpfr pfr
+application/h224
+application/http
+application/hyperstudio stk
application/iges
+application/im-iscomposing+xml
+application/index
+application/index.cmd
+application/index.obj
+application/index.response
+application/index.vnd
+application/iotp
+application/ipp
+application/isup
+application/javascript js
+application/json json
+application/kpml-request+xml
+application/kpml-response+xml
+application/lost+xml lostxml
+application/mac-binhex40 hqx
+application/mac-compactpro cpt
+application/macwriteii
+application/marc mrc
+application/mathematica ma nb mb
+application/mathml+xml mathml
+application/mbms-associated-procedure-description+xml
+application/mbms-deregister+xml
+application/mbms-envelope+xml
+application/mbms-msk+xml
+application/mbms-msk-response+xml
+application/mbms-protection-description+xml
+application/mbms-reception-report+xml
+application/mbms-register+xml
+application/mbms-register-response+xml
+application/mbms-user-service-description+xml
+application/mbox mbox
+application/media_control+xml
+application/mediaservercontrol+xml mscml
+application/mikey
+application/moss-keys
+application/moss-signature
+application/mosskey-data
+application/mosskey-request
+application/mp4 mp4s
+application/mpeg4-generic
+application/mpeg4-iod
+application/mpeg4-iod-xmt
+application/msword doc dot
+application/mxf mxf
+application/nasdata
+application/news-transmission
+application/nss
+application/ocsp-request
+application/ocsp-response
+application/octet-stream bin dms lha lzh class so iso dmg dist distz pkg bpk dump elc
+application/oda oda
+application/oebps-package+xml
+application/ogg ogx
+application/parityfec
+application/patch-ops-error+xml xer
+application/pdf pdf
+application/pgp-encrypted pgp
+application/pgp-keys
+application/pgp-signature asc sig
+application/pics-rules prf
+application/pidf+xml
+application/pidf-diff+xml
+application/pkcs10 p10
+application/pkcs7-mime p7m p7c
+application/pkcs7-signature p7s
+application/pkix-cert cer
+application/pkix-crl crl
+application/pkix-pkipath pkipath
+application/pkixcmp pki
+application/pls+xml pls
+application/poc-settings+xml
+application/postscript ai eps ps
+application/prs.alvestrand.titrax-sheet
+application/prs.cww cww
+application/prs.nprend
+application/prs.plucker
+application/qsig
+application/rdf+xml rdf
+application/reginfo+xml rif
+application/relax-ng-compact-syntax rnc
+application/remote-printing
+application/resource-lists+xml rl
+application/resource-lists-diff+xml rld
application/riscos
-application/eshop
-
-application/x-mif mif # FrameMaker
-application/x-maker fm
-application/x-csh csh
-application/x-dvi dvi
-application/x-hdf hdf
-application/x-latex latex
-application/x-netcdf nc cdf
-application/x-sh sh
-application/x-tcl tcl
-application/x-perl pl
-application/x-tex tex
-application/x-texinfo texinfo texi
-application/x-troff t tr roff
-application/x-troff-man man 1 2 3 4 5 6 7 8
-application/x-troff-me me
-application/x-troff-ms ms
-application/x-wais-source src
-application/x-bcpio bcpio
-application/x-cpio cpio
-application/x-gtar gtar # GNU tar
-application/x-shar shar
-application/x-sv4cpio sv4cpio
-application/x-sv4crc sv4crc
-application/x-tar tar
-application/x-ustar ustar
-
-# Multipart
-multipart/mixed
+application/rlmi+xml
+application/rls-services+xml rs
+application/rsd+xml rsd
+application/rss+xml rss
+application/rtf rtf
+application/rtx
+application/samlassertion+xml
+application/samlmetadata+xml
+application/sbml+xml sbml
+application/scvp-cv-request scq
+application/scvp-cv-response scs
+application/scvp-vp-request spq
+application/scvp-vp-response spp
+application/sdp sdp
+application/set-payment
+application/set-payment-initiation setpay
+application/set-registration
+application/set-registration-initiation setreg
+application/sgml
+application/sgml-open-catalog
+application/shf+xml shf
+application/sieve
+application/simple-filter+xml
+application/simple-message-summary
+application/simplesymbolcontainer
+application/slate
+application/smil
+application/smil+xml smi smil
+application/soap+fastinfoset
+application/soap+xml
+application/sparql-query rq
+application/sparql-results+xml srx
+application/spirits-event+xml
+application/srgs gram
+application/srgs+xml grxml
+application/ssml+xml ssml
+application/timestamp-query
+application/timestamp-reply
+application/tve-trigger
+application/ulpfec
+application/vemmi
+application/vividence.scriptfile
+application/vnd.3gpp.bsf+xml
+application/vnd.3gpp.pic-bw-large plb
+application/vnd.3gpp.pic-bw-small psb
+application/vnd.3gpp.pic-bw-var pvb
+application/vnd.3gpp.sms
+application/vnd.3gpp2.bcmcsinfo+xml
+application/vnd.3gpp2.sms
+application/vnd.3gpp2.tcap tcap
+application/vnd.3m.post-it-notes pwn
+application/vnd.accpac.simply.aso aso
+application/vnd.accpac.simply.imp imp
+application/vnd.acucobol acu
+application/vnd.acucorp atc acutc
+application/vnd.adobe.xdp+xml xdp
+application/vnd.adobe.xfdf xfdf
+application/vnd.aether.imp
+application/vnd.americandynamics.acc acc
+application/vnd.amiga.ami ami
+application/vnd.anser-web-certificate-issue-initiation cii
+application/vnd.anser-web-funds-transfer-initiation fti
+application/vnd.antix.game-component atx
+application/vnd.apple.installer+xml mpkg
+application/vnd.arastra.swi swi
+application/vnd.audiograph aep
+application/vnd.autopackage
+application/vnd.avistar+xml
+application/vnd.blueice.multipass mpm
+application/vnd.bmi bmi
+application/vnd.businessobjects rep
+application/vnd.cab-jscript
+application/vnd.canon-cpdl
+application/vnd.canon-lips
+application/vnd.cendio.thinlinc.clientconf
+application/vnd.chemdraw+xml cdxml
+application/vnd.chipnuts.karaoke-mmd mmd
+application/vnd.cinderella cdy
+application/vnd.cirpack.isdn-ext
+application/vnd.claymore cla
+application/vnd.clonk.c4group c4g c4d c4f c4p c4u
+application/vnd.commerce-battelle
+application/vnd.commonspace csp cst
+application/vnd.contact.cmsg cdbcmsg
+application/vnd.cosmocaller cmc
+application/vnd.crick.clicker clkx
+application/vnd.crick.clicker.keyboard clkk
+application/vnd.crick.clicker.palette clkp
+application/vnd.crick.clicker.template clkt
+application/vnd.crick.clicker.wordbank clkw
+application/vnd.criticaltools.wbs+xml wbs
+application/vnd.ctc-posml pml
+application/vnd.ctct.ws+xml
+application/vnd.cups-pdf
+application/vnd.cups-postscript
+application/vnd.cups-ppd ppd
+application/vnd.cups-raster
+application/vnd.cups-raw
+application/vnd.curl curl
+application/vnd.cybank
+application/vnd.data-vision.rdz rdz
+application/vnd.denovo.fcselayout-link fe_launch
+application/vnd.dna dna
+application/vnd.dolby.mlp mlp
+application/vnd.dpgraph dpg
+application/vnd.dreamfactory dfac
+application/vnd.dvb.esgcontainer
+application/vnd.dvb.ipdcesgaccess
+application/vnd.dvb.iptv.alfec-base
+application/vnd.dvb.iptv.alfec-enhancement
+application/vnd.dxr
+application/vnd.ecdis-update
+application/vnd.ecowin.chart mag
+application/vnd.ecowin.filerequest
+application/vnd.ecowin.fileupdate
+application/vnd.ecowin.series
+application/vnd.ecowin.seriesrequest
+application/vnd.ecowin.seriesupdate
+application/vnd.enliven nml
+application/vnd.epson.esf esf
+application/vnd.epson.msf msf
+application/vnd.epson.quickanime qam
+application/vnd.epson.salt slt
+application/vnd.epson.ssf ssf
+application/vnd.ericsson.quickcall
+application/vnd.eszigno3+xml es3 et3
+application/vnd.eudora.data
+application/vnd.ezpix-album ez2
+application/vnd.ezpix-package ez3
+application/vnd.fdf fdf
+application/vnd.ffsns
+application/vnd.fints
+application/vnd.flographit gph
+application/vnd.fluxtime.clip ftc
+application/vnd.font-fontforge-sfd
+application/vnd.framemaker fm frame maker
+application/vnd.frogans.fnc fnc
+application/vnd.frogans.ltf ltf
+application/vnd.fsc.weblaunch fsc
+application/vnd.fujitsu.oasys oas
+application/vnd.fujitsu.oasys2 oa2
+application/vnd.fujitsu.oasys3 oa3
+application/vnd.fujitsu.oasysgp fg5
+application/vnd.fujitsu.oasysprs bh2
+application/vnd.fujixerox.art-ex
+application/vnd.fujixerox.art4
+application/vnd.fujixerox.hbpl
+application/vnd.fujixerox.ddd ddd
+application/vnd.fujixerox.docuworks xdw
+application/vnd.fujixerox.docuworks.binder xbd
+application/vnd.fut-misnet
+application/vnd.fuzzysheet fzs
+application/vnd.genomatix.tuxedo txd
+application/vnd.gmx gmx
+application/vnd.google-earth.kml+xml kml
+application/vnd.google-earth.kmz kmz
+application/vnd.grafeq gqf gqs
+application/vnd.gridmp
+application/vnd.groove-account gac
+application/vnd.groove-help ghf
+application/vnd.groove-identity-message gim
+application/vnd.groove-injector grv
+application/vnd.groove-tool-message gtm
+application/vnd.groove-tool-template tpl
+application/vnd.groove-vcard vcg
+application/vnd.handheld-entertainment+xml zmm
+application/vnd.hbci hbci
+application/vnd.hcl-bireports
+application/vnd.hhe.lesson-player les
+application/vnd.hp-hpgl hpgl
+application/vnd.hp-hpid hpid
+application/vnd.hp-hps hps
+application/vnd.hp-jlyt jlt
+application/vnd.hp-pcl pcl
+application/vnd.hp-pclxl pclxl
+application/vnd.httphone
+application/vnd.hydrostatix.sof-data sfd-hdstx
+application/vnd.hzn-3d-crossword x3d
+application/vnd.ibm.afplinedata
+application/vnd.ibm.electronic-media
+application/vnd.ibm.minipay mpy
+application/vnd.ibm.modcap afp listafp list3820
+application/vnd.ibm.rights-management irm
+application/vnd.ibm.secure-container sc
+application/vnd.iccprofile icc icm
+application/vnd.igloader igl
+application/vnd.immervision-ivp ivp
+application/vnd.immervision-ivu ivu
+application/vnd.informedcontrol.rms+xml
+application/vnd.intercon.formnet xpw xpx
+application/vnd.intertrust.digibox
+application/vnd.intertrust.nncp
+application/vnd.intu.qbo qbo
+application/vnd.intu.qfx qfx
+application/vnd.iptc.g2.conceptitem+xml
+application/vnd.iptc.g2.knowledgeitem+xml
+application/vnd.iptc.g2.newsitem+xml
+application/vnd.iptc.g2.packageitem+xml
+application/vnd.ipunplugged.rcprofile rcprofile
+application/vnd.irepository.package+xml irp
+application/vnd.is-xpr xpr
+application/vnd.jam jam
+application/vnd.japannet-directory-service
+application/vnd.japannet-jpnstore-wakeup
+application/vnd.japannet-payment-wakeup
+application/vnd.japannet-registration
+application/vnd.japannet-registration-wakeup
+application/vnd.japannet-setstore-wakeup
+application/vnd.japannet-verification
+application/vnd.japannet-verification-wakeup
+application/vnd.jcp.javame.midlet-rms rms
+application/vnd.jisp jisp
+application/vnd.joost.joda-archive joda
+application/vnd.kahootz ktz ktr
+application/vnd.kde.karbon karbon
+application/vnd.kde.kchart chrt
+application/vnd.kde.kformula kfo
+application/vnd.kde.kivio flw
+application/vnd.kde.kontour kon
+application/vnd.kde.kpresenter kpr kpt
+application/vnd.kde.kspread ksp
+application/vnd.kde.kword kwd kwt
+application/vnd.kenameaapp htke
+application/vnd.kidspiration kia
+application/vnd.kinar kne knp
+application/vnd.koan skp skd skt skm
+application/vnd.kodak-descriptor sse
+application/vnd.liberty-request+xml
+application/vnd.llamagraphics.life-balance.desktop lbd
+application/vnd.llamagraphics.life-balance.exchange+xml lbe
+application/vnd.lotus-1-2-3 123
+application/vnd.lotus-approach apr
+application/vnd.lotus-freelance pre
+application/vnd.lotus-notes nsf
+application/vnd.lotus-organizer org
+application/vnd.lotus-screencam scm
+application/vnd.lotus-wordpro lwp
+application/vnd.macports.portpkg portpkg
+application/vnd.marlin.drm.actiontoken+xml
+application/vnd.marlin.drm.conftoken+xml
+application/vnd.marlin.drm.license+xml
+application/vnd.marlin.drm.mdcf
+application/vnd.mcd mcd
+application/vnd.medcalcdata mc1
+application/vnd.mediastation.cdkey cdkey
+application/vnd.meridian-slingshot
+application/vnd.mfer mwf
+application/vnd.mfmp mfm
+application/vnd.micrografx.flo flo
+application/vnd.micrografx.igx igx
+application/vnd.mif mif
+application/vnd.minisoft-hp3000-save
+application/vnd.mitsubishi.misty-guard.trustweb
+application/vnd.mobius.daf daf
+application/vnd.mobius.dis dis
+application/vnd.mobius.mbk mbk
+application/vnd.mobius.mqy mqy
+application/vnd.mobius.msl msl
+application/vnd.mobius.plc plc
+application/vnd.mobius.txf txf
+application/vnd.mophun.application mpn
+application/vnd.mophun.certificate mpc
+application/vnd.motorola.flexsuite
+application/vnd.motorola.flexsuite.adsi
+application/vnd.motorola.flexsuite.fis
+application/vnd.motorola.flexsuite.gotap
+application/vnd.motorola.flexsuite.kmr
+application/vnd.motorola.flexsuite.ttc
+application/vnd.motorola.flexsuite.wem
+application/vnd.motorola.iprm
+application/vnd.mozilla.xul+xml xul
+application/vnd.ms-artgalry cil
+application/vnd.ms-asf asf
+application/vnd.ms-cab-compressed cab
+application/vnd.ms-excel xls xlm xla xlc xlt xlw
+application/vnd.ms-fontobject eot
+application/vnd.ms-htmlhelp chm
+application/vnd.ms-ims ims
+application/vnd.ms-lrm lrm
+application/vnd.ms-playready.initiator+xml
+application/vnd.ms-powerpoint ppt pps pot
+application/vnd.ms-project mpp mpt
+application/vnd.ms-tnef
+application/vnd.ms-wmdrm.lic-chlg-req
+application/vnd.ms-wmdrm.lic-resp
+application/vnd.ms-wmdrm.meter-chlg-req
+application/vnd.ms-wmdrm.meter-resp
+application/vnd.ms-works wps wks wcm wdb
+application/vnd.ms-wpl wpl
+application/vnd.ms-xpsdocument xps
+application/vnd.mseq mseq
+application/vnd.msign
+application/vnd.multiad.creator
+application/vnd.multiad.creator.cif
+application/vnd.music-niff
+application/vnd.musician mus
+application/vnd.muvee.style msty
+application/vnd.ncd.control
+application/vnd.ncd.reference
+application/vnd.nervana
+application/vnd.netfpx
+application/vnd.neurolanguage.nlu nlu
+application/vnd.noblenet-directory nnd
+application/vnd.noblenet-sealer nns
+application/vnd.noblenet-web nnw
+application/vnd.nokia.catalogs
+application/vnd.nokia.conml+wbxml
+application/vnd.nokia.conml+xml
+application/vnd.nokia.isds-radio-presets
+application/vnd.nokia.iptv.config+xml
+application/vnd.nokia.landmark+wbxml
+application/vnd.nokia.landmark+xml
+application/vnd.nokia.landmarkcollection+xml
+application/vnd.nokia.n-gage.ac+xml
+application/vnd.nokia.n-gage.data ngdat
+application/vnd.nokia.n-gage.symbian.install n-gage
+application/vnd.nokia.ncd
+application/vnd.nokia.pcd+wbxml
+application/vnd.nokia.pcd+xml
+application/vnd.nokia.radio-preset rpst
+application/vnd.nokia.radio-presets rpss
+application/vnd.novadigm.edm edm
+application/vnd.novadigm.edx edx
+application/vnd.novadigm.ext ext
+application/vnd.oasis.opendocument.chart odc
+application/vnd.oasis.opendocument.chart-template otc
+application/vnd.oasis.opendocument.formula odf
+application/vnd.oasis.opendocument.formula-template otf
+application/vnd.oasis.opendocument.graphics odg
+application/vnd.oasis.opendocument.graphics-template otg
+application/vnd.oasis.opendocument.image odi
+application/vnd.oasis.opendocument.image-template oti
+application/vnd.oasis.opendocument.presentation odp
+application/vnd.oasis.opendocument.presentation-template otp
+application/vnd.oasis.opendocument.spreadsheet ods
+application/vnd.oasis.opendocument.spreadsheet-template ots
+application/vnd.oasis.opendocument.text odt
+application/vnd.oasis.opendocument.text-master otm
+application/vnd.oasis.opendocument.text-template ott
+application/vnd.oasis.opendocument.text-web oth
+application/vnd.obn
+application/vnd.olpc-sugar xo
+application/vnd.oma-scws-config
+application/vnd.oma-scws-http-request
+application/vnd.oma-scws-http-response
+application/vnd.oma.bcast.associated-procedure-parameter+xml
+application/vnd.oma.bcast.drm-trigger+xml
+application/vnd.oma.bcast.imd+xml
+application/vnd.oma.bcast.ltkm
+application/vnd.oma.bcast.notification+xml
+application/vnd.oma.bcast.provisioningtrigger
+application/vnd.oma.bcast.sgboot
+application/vnd.oma.bcast.sgdd+xml
+application/vnd.oma.bcast.sgdu
+application/vnd.oma.bcast.simple-symbol-container
+application/vnd.oma.bcast.smartcard-trigger+xml
+application/vnd.oma.bcast.sprov+xml
+application/vnd.oma.bcast.stkm
+application/vnd.oma.dcd
+application/vnd.oma.dcdc
+application/vnd.oma.dd2+xml dd2
+application/vnd.oma.drm.risd+xml
+application/vnd.oma.group-usage-list+xml
+application/vnd.oma.poc.detailed-progress-report+xml
+application/vnd.oma.poc.final-report+xml
+application/vnd.oma.poc.groups+xml
+application/vnd.oma.poc.invocation-descriptor+xml
+application/vnd.oma.poc.optimized-progress-report+xml
+application/vnd.oma.xcap-directory+xml
+application/vnd.omads-email+xml
+application/vnd.omads-file+xml
+application/vnd.omads-folder+xml
+application/vnd.omaloc-supl-init
+application/vnd.openofficeorg.extension oxt
+application/vnd.osa.netdeploy
+application/vnd.osgi.dp dp
+application/vnd.otps.ct-kip+xml
+application/vnd.palm prc pdb pqa oprc
+application/vnd.paos.xml
+application/vnd.pg.format str
+application/vnd.pg.osasli ei6
+application/vnd.piaccess.application-licence
+application/vnd.picsel efif
+application/vnd.poc.group-advertisement+xml
+application/vnd.pocketlearn plf
+application/vnd.powerbuilder6 pbd
+application/vnd.powerbuilder6-s
+application/vnd.powerbuilder7
+application/vnd.powerbuilder7-s
+application/vnd.powerbuilder75
+application/vnd.powerbuilder75-s
+application/vnd.preminet
+application/vnd.previewsystems.box box
+application/vnd.proteus.magazine mgz
+application/vnd.publishare-delta-tree qps
+application/vnd.pvi.ptid1 ptid
+application/vnd.pwg-multiplexed
+application/vnd.pwg-xhtml-print+xml
+application/vnd.qualcomm.brew-app-res
+application/vnd.quark.quarkxpress qxd qxt qwd qwt qxl qxb
+application/vnd.rapid
+application/vnd.recordare.musicxml mxl
+application/vnd.recordare.musicxml+xml
+application/vnd.renlearn.rlprint
+application/vnd.rn-realmedia rm
+application/vnd.route66.link66+xml link66
+application/vnd.ruckus.download
+application/vnd.s3sms
+application/vnd.sbm.mid2
+application/vnd.scribus
+application/vnd.sealed.3df
+application/vnd.sealed.csf
+application/vnd.sealed.doc
+application/vnd.sealed.eml
+application/vnd.sealed.mht
+application/vnd.sealed.net
+application/vnd.sealed.ppt
+application/vnd.sealed.tiff
+application/vnd.sealed.xls
+application/vnd.sealedmedia.softseal.html
+application/vnd.sealedmedia.softseal.pdf
+application/vnd.seemail see
+application/vnd.sema sema
+application/vnd.semd semd
+application/vnd.semf semf
+application/vnd.shana.informed.formdata ifm
+application/vnd.shana.informed.formtemplate itp
+application/vnd.shana.informed.interchange iif
+application/vnd.shana.informed.package ipk
+application/vnd.simtech-mindmapper twd twds
+application/vnd.smaf mmf
+application/vnd.software602.filler.form+xml
+application/vnd.software602.filler.form-xml-zip
+application/vnd.solent.sdkm+xml sdkm sdkd
+application/vnd.spotfire.dxp dxp
+application/vnd.spotfire.sfs sfs
+application/vnd.sss-cod
+application/vnd.sss-dtf
+application/vnd.sss-ntf
+application/vnd.street-stream
+application/vnd.sun.wadl+xml
+application/vnd.sus-calendar sus susp
+application/vnd.svd svd
+application/vnd.swiftview-ics
+application/vnd.syncml+xml xsm
+application/vnd.syncml.dm+wbxml bdm
+application/vnd.syncml.dm+xml xdm
+application/vnd.syncml.ds.notification
+application/vnd.tao.intent-module-archive tao
+application/vnd.tmobile-livetv tmo
+application/vnd.trid.tpt tpt
+application/vnd.triscape.mxs mxs
+application/vnd.trueapp tra
+application/vnd.truedoc
+application/vnd.ufdl ufd ufdl
+application/vnd.uiq.theme utz
+application/vnd.umajin umj
+application/vnd.unity unityweb
+application/vnd.uoml+xml uoml
+application/vnd.uplanet.alert
+application/vnd.uplanet.alert-wbxml
+application/vnd.uplanet.bearer-choice
+application/vnd.uplanet.bearer-choice-wbxml
+application/vnd.uplanet.cacheop
+application/vnd.uplanet.cacheop-wbxml
+application/vnd.uplanet.channel
+application/vnd.uplanet.channel-wbxml
+application/vnd.uplanet.list
+application/vnd.uplanet.list-wbxml
+application/vnd.uplanet.listcmd
+application/vnd.uplanet.listcmd-wbxml
+application/vnd.uplanet.signal
+application/vnd.vcx vcx
+application/vnd.vd-study
+application/vnd.vectorworks
+application/vnd.vidsoft.vidconference
+application/vnd.visio vsd vst vss vsw
+application/vnd.visionary vis
+application/vnd.vividence.scriptfile
+application/vnd.vsf vsf
+application/vnd.wap.sic
+application/vnd.wap.slc
+application/vnd.wap.wbxml wbxml
+application/vnd.wap.wmlc wmlc
+application/vnd.wap.wmlscriptc wmlsc
+application/vnd.webturbo wtb
+application/vnd.wfa.wsc
+application/vnd.wmc
+application/vnd.wmf.bootstrap
+application/vnd.wordperfect wpd
+application/vnd.wqd wqd
+application/vnd.wrq-hp3000-labelled
+application/vnd.wt.stf stf
+application/vnd.wv.csp+wbxml
+application/vnd.wv.csp+xml
+application/vnd.wv.ssp+xml
+application/vnd.xara xar
+application/vnd.xfdl xfdl
+application/vnd.xmi+xml
+application/vnd.xmpie.cpkg
+application/vnd.xmpie.dpkg
+application/vnd.xmpie.plan
+application/vnd.xmpie.ppkg
+application/vnd.xmpie.xlim
+application/vnd.yamaha.hv-dic hvd
+application/vnd.yamaha.hv-script hvs
+application/vnd.yamaha.hv-voice hvp
+application/vnd.yamaha.smaf-audio saf
+application/vnd.yamaha.smaf-phrase spf
+application/vnd.yellowriver-custom-menu cmp
+application/vnd.zzazz.deck+xml zaz
+application/voicexml+xml vxml
+application/watcherinfo+xml
+application/whoispp-query
+application/whoispp-response
+application/winhlp hlp
+application/wita
+application/wordperfect5.1
+application/wsdl+xml wsdl
+application/wspolicy+xml wspolicy
+application/x-ace-compressed ace
+application/x-bcpio bcpio
+application/x-bittorrent torrent
+application/x-bzip bz
+application/x-bzip2 bz2 boz
+application/x-cdlink vcd
+application/x-chat chat
+application/x-chess-pgn pgn
+application/x-compress
+application/x-cpio cpio
+application/x-csh csh
+application/x-director dcr dir dxr fgd
+application/x-dvi dvi
+application/x-futuresplash spl
+application/x-gtar gtar
+application/x-gzip
+application/x-hdf hdf
+application/x-latex latex
+application/x-ms-wmd wmd
+application/x-ms-wmz wmz
+application/x-msaccess mdb
+application/x-msbinder obd
+application/x-mscardfile crd
+application/x-msclip clp
+application/x-msdownload exe dll com bat msi
+application/x-msmediaview mvb m13 m14
+application/x-msmetafile wmf
+application/x-msmoney mny
+application/x-mspublisher pub
+application/x-msschedule scd
+application/x-msterminal trm
+application/x-mswrite wri
+application/x-netcdf nc cdf
+application/x-pkcs12 p12 pfx
+application/x-pkcs7-certificates p7b spc
+application/x-pkcs7-certreqresp p7r
+application/x-rar-compressed rar
+application/x-sh sh
+application/x-shar shar
+application/x-shockwave-flash swf
+application/x-stuffit sit
+application/x-stuffitx sitx
+application/x-sv4cpio sv4cpio
+application/x-sv4crc sv4crc
+application/x-tar tar
+application/x-tcl tcl
+application/x-tex tex
+application/x-texinfo texinfo texi
+application/x-ustar ustar
+application/x-wais-source src
+application/x-x509-ca-cert der crt
+application/x400-bp
+application/xcap-att+xml
+application/xcap-caps+xml
+application/xcap-el+xml
+application/xcap-error+xml
+application/xcap-ns+xml
+application/xenc+xml xenc
+application/xhtml+xml xhtml xht
+application/xml xml xsl
+application/xml-dtd dtd
+application/xml-external-parsed-entity
+application/xmpp+xml
+application/xop+xml xop
+application/xslt+xml xslt
+application/xspf+xml xspf
+application/xv+xml mxml xhvml xvml xvm
+application/zip zip
+audio/32kadpcm
+audio/3gpp
+audio/3gpp2
+audio/ac3
+audio/amr
+audio/amr-wb
+audio/amr-wb+
+audio/asc
+audio/basic au snd
+audio/bv16
+audio/bv32
+audio/clearmode
+audio/cn
+audio/dat12
+audio/dls
+audio/dsr-es201108
+audio/dsr-es202050
+audio/dsr-es202211
+audio/dsr-es202212
+audio/dvi4
+audio/eac3
+audio/evrc
+audio/evrc-qcp
+audio/evrc0
+audio/evrc1
+audio/evrcb
+audio/evrcb0
+audio/evrcb1
+audio/evrcwb
+audio/evrcwb0
+audio/evrcwb1
+audio/g722
+audio/g7221
+audio/g723
+audio/g726-16
+audio/g726-24
+audio/g726-32
+audio/g726-40
+audio/g728
+audio/g729
+audio/g7291
+audio/g729d
+audio/g729e
+audio/gsm
+audio/gsm-efr
+audio/ilbc
+audio/l16
+audio/l20
+audio/l24
+audio/l8
+audio/lpc
+audio/midi mid midi kar rmi
+audio/mobile-xmf
+audio/mp4 mp4a
+audio/mp4a-latm
+audio/mpa
+audio/mpa-robust
+audio/mpeg mpga mp2 mp2a mp3 m2a m3a
+audio/mpeg4-generic
+audio/ogg oga ogg spx
+audio/parityfec
+audio/pcma
+audio/pcmu
+audio/prs.sid
+audio/qcelp
+audio/red
+audio/rtp-enc-aescm128
+audio/rtp-midi
+audio/rtx
+audio/smv
+audio/smv0
+audio/smv-qcp
+audio/sp-midi
+audio/t140c
+audio/t38
+audio/telephone-event
+audio/tone
+audio/ulpfec
+audio/vdvi
+audio/vmr-wb
+audio/vnd.3gpp.iufp
+audio/vnd.4sb
+audio/vnd.audiokoz
+audio/vnd.celp
+audio/vnd.cisco.nse
+audio/vnd.cmles.radio-events
+audio/vnd.cns.anp1
+audio/vnd.cns.inf1
+audio/vnd.digital-winds eol
+audio/vnd.dlna.adts
+audio/vnd.dolby.mlp
+audio/vnd.dts dts
+audio/vnd.dts.hd dtshd
+audio/vnd.everad.plj
+audio/vnd.hns.audio
+audio/vnd.lucent.voice lvp
+audio/vnd.ms-playready.media.pya pya
+audio/vnd.nokia.mobile-xmf
+audio/vnd.nortel.vbk
+audio/vnd.nuera.ecelp4800 ecelp4800
+audio/vnd.nuera.ecelp7470 ecelp7470
+audio/vnd.nuera.ecelp9600 ecelp9600
+audio/vnd.octel.sbc
+audio/vnd.qcelp
+audio/vnd.rhetorex.32kadpcm
+audio/vnd.sealedmedia.softseal.mpeg
+audio/vnd.vmx.cvsd
+audio/vorbis
+audio/vorbis-config
+audio/wav wav
+audio/x-aiff aif aiff aifc
+audio/x-mpegurl m3u
+audio/x-ms-wax wax
+audio/x-ms-wma wma
+audio/x-pn-realaudio ram ra
+audio/x-pn-realaudio-plugin rmp
+audio/x-wav wav
+chemical/x-cdx cdx
+chemical/x-cif cif
+chemical/x-cmdf cmdf
+chemical/x-cml cml
+chemical/x-csml csml
+chemical/x-pdb pdb
+chemical/x-xyz xyz
+image/bmp bmp
+image/cgm cgm
+image/fits
+image/g3fax g3
+image/gif gif
+image/ief ief
+image/jp2
+image/jpeg jpeg jpg jpe
+image/jpm
+image/jpx
+image/naplps
+image/png png
+image/prs.btif btif
+image/prs.pti
+image/svg+xml svg svgz
+image/t38
+image/tiff tiff tif
+image/tiff-fx
+image/vnd.adobe.photoshop psd
+image/vnd.cns.inf2
+image/vnd.djvu djvu djv
+image/vnd.dwg dwg
+image/vnd.dxf dxf
+image/vnd.fastbidsheet fbs
+image/vnd.fpx fpx
+image/vnd.fst fst
+image/vnd.fujixerox.edmics-mmr mmr
+image/vnd.fujixerox.edmics-rlc rlc
+image/vnd.globalgraphics.pgb
+image/vnd.microsoft.icon
+image/vnd.mix
+image/vnd.ms-modi mdi
+image/vnd.net-fpx npx
+image/vnd.sealed.png
+image/vnd.sealedmedia.softseal.gif
+image/vnd.sealedmedia.softseal.jpg
+image/vnd.svf
+image/vnd.wap.wbmp wbmp
+image/vnd.xiff xif
+image/x-cmu-raster ras
+image/x-cmx cmx
+image/x-icon ico
+image/x-pcx pcx
+image/x-pict pic pct
+image/x-portable-anymap pnm
+image/x-portable-bitmap pbm
+image/x-portable-graymap pgm
+image/x-portable-pixmap ppm
+image/x-rgb rgb
+image/x-xbitmap xbm
+image/x-xpixmap xpm
+image/x-xwindowdump xwd
+message/cpim
+message/delivery-status
+message/disposition-notification
+message/external-body
+message/global
+message/global-delivery-status
+message/global-disposition-notification
+message/global-headers
+message/http
+message/news
+message/partial
+message/rfc822 eml mime
+message/s-http
+message/sip
+message/sipfrag
+message/tracking-status
+message/vnd.si.simp
+model/iges igs iges
+model/mesh msh mesh silo
+model/vnd.dwf dwf
+model/vnd.flatland.3dml
+model/vnd.gdl gdl
+model/vnd.gs.gdl
+model/vnd.gtw gtw
+model/vnd.moml+xml
+model/vnd.mts mts
+model/vnd.parasolid.transmit.binary
+model/vnd.parasolid.transmit.text
+model/vnd.vtu vtu
+model/vrml wrl vrml
multipart/alternative
-multipart/digest
-multipart/parallel
multipart/appledouble
+multipart/byteranges
+multipart/digest
+multipart/encrypted
+multipart/form-data
multipart/header-set
+multipart/mixed
+multipart/parallel
+multipart/related
+multipart/report
+multipart/signed
+multipart/voice-message
+text/calendar ics ifb
+text/css css
+text/csv csv
+text/directory
+text/dns
+text/enriched
+text/html html htm
+text/parityfec
+text/plain txt text conf def list log in
+text/prs.fallenstein.rst
+text/prs.lines.tag dsc
+text/red
+text/rfc822-headers
+text/richtext rtx
+text/rtf
+text/rtp-enc-aescm128
+text/rtx
+text/sgml sgml sgm
+text/t140
+text/tab-separated-values tsv
+text/troff t tr roff man me ms
+text/ulpfec
+text/uri-list uri uris urls
+text/vnd.abc
+text/vnd.curl
+text/vnd.dmclientscript
+text/vnd.esmertec.theme-descriptor
+text/vnd.fly fly
+text/vnd.fmi.flexstor flx
+text/vnd.graphviz gv
+text/vnd.in3d.3dml 3dml
+text/vnd.in3d.spot spot
+text/vnd.iptc.newsml
+text/vnd.iptc.nitf
+text/vnd.latex-z
+text/vnd.motorola.reflex
+text/vnd.ms-mediapackage
+text/vnd.net2phone.commcenter.command
+text/vnd.si.uricatalogue
+text/vnd.sun.j2me.app-descriptor jad
+text/vnd.trolltech.linguist
+text/vnd.wap.si
+text/vnd.wap.sl
+text/vnd.wap.wml wml
+text/vnd.wap.wmlscript wmls
+text/x-asm s asm
+text/x-c c cc cxx cpp h hh dic
+text/x-fortran f for f77 f90
+text/x-pascal p pas
+text/x-java-source java
+text/x-setext etx
+text/x-uuencode uu
+text/x-vcalendar vcs
+text/x-vcard vcf
+text/xml
+text/xml-external-parsed-entity
+video/3gpp 3gp
+video/3gpp-tt
+video/3gpp2 3g2
+video/bmpeg
+video/bt656
+video/celb
+video/dv
+video/h261 h261
+video/h263 h263
+video/h263-1998
+video/h263-2000
+video/h264 h264
+video/jpeg jpgv
+video/jpeg2000
+video/jpm jpm jpgm
+video/mj2 mj2 mjp2
+video/mp1s
+video/mp2p
+video/mp2t
+video/mp4 mp4 mp4v mpg4
+video/mp4v-es
+video/mpeg mpeg mpg mpe m1v m2v
+video/mpeg4-generic
+video/mpv
+video/nv
+video/ogg ogv
+video/parityfec
+video/pointer
+video/quicktime qt mov
+video/raw
+video/rtp-enc-aescm128
+video/rtx
+video/smpte292m
+video/ulpfec
+video/vc1
+video/vnd.cctv
+video/vnd.dlna.mpeg-tts
+video/vnd.fvt fvt
+video/vnd.hns.video
+video/vnd.iptvforum.1dparityfec-1010
+video/vnd.iptvforum.1dparityfec-2005
+video/vnd.iptvforum.2dparityfec-1010
+video/vnd.iptvforum.2dparityfec-2005
+video/vnd.iptvforum.ttsavc
+video/vnd.iptvforum.ttsmpeg2
+video/vnd.motorola.video
+video/vnd.motorola.videop
+video/vnd.mpegurl mxu m4u
+video/vnd.ms-playready.media.pyv pyv
+video/vnd.nokia.interleaved-multimedia
+video/vnd.nokia.videovoip
+video/vnd.objectvideo
+video/vnd.sealed.mpeg1
+video/vnd.sealed.mpeg4
+video/vnd.sealed.swf
+video/vnd.sealedmedia.softseal.mov
+video/vnd.vivo viv
+video/x-fli fli
+video/x-ms-asf asf asx
+video/x-ms-wm wm
+video/x-ms-wmv wmv
+video/x-ms-wmx wmx
+video/x-ms-wvx wvx
+video/x-msvideo avi
+video/x-sgi-movie movie
+x-conference/x-cooltalk ice
@@ -1,6 +1,6 @@
package LWP;
-$VERSION = "5.826";
+$VERSION = "5.830";
sub Version { $VERSION; }
require 5.005;
@@ -295,7 +295,7 @@ represented in actual perl code:
# Create a user agent object
use LWP::UserAgent;
- $ua = LWP::UserAgent->new;
+ my $ua = LWP::UserAgent->new;
$ua->agent("MyApp/0.1 ");
# Create a request
@@ -9,7 +9,7 @@ $r = GET 'http://www.sn.no/';
print $r->as_string;
ok($r->method, "GET");
-ok($r->url, "http://www.sn.no/");
+ok($r->uri, "http://www.sn.no/");
$r = HEAD "http://www.sn.no/",
If_Match => 'abc',
@@ -17,7 +17,7 @@ $r = HEAD "http://www.sn.no/",
print $r->as_string;
ok($r->method, "HEAD");
-ok($r->url->eq("http://www.sn.no"));
+ok($r->uri->eq("http://www.sn.no"));
ok($r->header('If-Match'), "abc");
ok($r->header("from"), "aas\@sn.no");
@@ -83,7 +83,7 @@ $r = POST 'http://www.perl.org/survey.cgi',
unlink($file) or warn "Can't unlink $file: $!";
ok($r->method, "POST");
-ok($r->url->path, "/survey.cgi");
+ok($r->uri->path, "/survey.cgi");
ok($r->content_type, "multipart/form-data");
ok($r->header(Content_type) =~ /boundary="?([^"]+)"?/);
$boundary = $1;
@@ -153,7 +153,7 @@ $r = POST 'http://www.perl.org/survey.cgi',
print $r->as_string, "\n";
ok($r->method, "POST");
-ok($r->url->path, "/survey.cgi");
+ok($r->uri->path, "/survey.cgi");
ok($r->content_type, "multipart/form-data");
ok($r->header(Content_type) =~ /boundary="?([^"]+)"?/);
$boundary = $1;
@@ -35,7 +35,7 @@ $request->header("User-Agent" => "Moz/1.0");
ok(j($conf->matching_items($request)), "u:p|slash|.com|GET|not secure|always");
$request->method("HEAD");
-$request->url->scheme("https");
+$request->uri->scheme("https");
ok(j($conf->matching_items($request)), ".com|GET|secure|always");
@@ -0,0 +1,93 @@
+#!perl -w
+
+use strict;
+
+BEGIN {
+ eval {
+ require Encode;
+ Encode::find_encoding("UTF-16-BE") || die "Need a version of Encode that supports UTF-16-BE";
+ };
+ if ($@) {
+ print "1..0 # Skipped: Encode not available\n";
+ print $@;
+ exit;
+ }
+}
+
+use Test;
+plan tests => 21;
+
+use HTTP::Response;
+my $r = HTTP::Response->new(200, "OK");
+ok($r->content_charset, undef);
+ok($r->content_type_charset, undef);
+
+$r->content_type("text/plain");
+ok($r->content_charset, undef);
+
+$r->content("abc");
+ok($r->content_charset, "US-ASCII");
+
+$r->content("f\xE5rep\xF8lse\n");
+ok($r->content_charset, "ISO-8859-1");
+
+$r->content("f\xC3\xA5rep\xC3\xB8lse\n");
+ok($r->content_charset, "UTF-8");
+
+$r->content_type("text/html");
+$r->content(<<'EOT');
+<meta charset="UTF-8">
+EOT
+ok($r->content_charset, "UTF-8");
+
+$r->content(<<'EOT');
+<body>
+<META CharSet="Utf-16-LE">
+<meta charset="ISO-8859-1">
+EOT
+ok($r->content_charset, "UTF-8");
+
+$r->content(<<'EOT');
+<!-- <meta charset="UTF-8">
+EOT
+ok($r->content_charset, "US-ASCII");
+
+$r->content(<<'EOT');
+<meta content="text/plain; charset=UTF-8">
+EOT
+ok($r->content_charset, "UTF-8");
+
+$r->content_type('text/plain; charset="iso-8859-1"');
+ok($r->content_charset, "ISO-8859-1");
+ok($r->content_type_charset, "ISO-8859-1");
+
+$r->content_type("application/xml");
+$r->content("<foo>..</foo>");
+ok($r->content_charset, "UTF-8");
+
+require Encode;
+for my $enc ("UTF-16-BE", "UTF-16-LE", "UTF-32-BE", "UTF-32-LE") {
+ $r->content(Encode::encode($enc, "<foo>..</foo>"));
+ ok($r->content_charset, $enc);
+}
+
+$r->content(<<'EOT');
+<?xml version="1.0" encoding="utf8" ?>
+EOT
+ok($r->content_charset, "utf8");
+
+$r->content(<<'EOT');
+<?xml version="1.0" encoding=" "?>
+EOT
+ok($r->content_charset, "UTF-8");
+
+$r->content(<<'EOT');
+<?xml version="1.0" encoding=" ISO-8859-1 "?>
+EOT
+ok($r->content_charset, "ISO-8859-1");
+
+$r->content(<<'EOT');
+<?xml version="1.0"
+encoding="US-ASCII" ?>
+EOT
+ok($r->content_charset, "US-ASCII");
@@ -3,7 +3,7 @@
use strict;
use Test qw(plan ok skip);
-plan tests => 119;
+plan tests => 121;
require HTTP::Message;
use Config qw(%Config);
@@ -459,6 +459,16 @@ if (eval { require Encode; 1 }) {
skip('Needs Encode.pm for this test', undef);
}
+# Raw RFC 1951 deflate
+$m = HTTP::Message->new([
+ "Content-Type" => "text/plain",
+ "Content-Encoding" => "deflate, base64",
+ ],
+ "80jNyclXCM8vyklRBAA="
+ );
+ok($m->decoded_content, "Hello World!");
+ok(!$m->header("Client-Warning"));
+
if (eval "require Compress::Bzip2") {
$m = HTTP::Message->new([
"Content-Type" => "text/plain",
@@ -30,6 +30,9 @@ sub new {
sub base {
return "http://foo.com"
}
+sub content_charset {
+ return "iso-8859-1";
+}
sub decoded_content {
my $html = qq{
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
@@ -0,0 +1,47 @@
+#!perl -w
+
+use strict;
+use Test qw(plan ok);
+
+plan tests => 12;
+
+use HTML::Form;
+
+my $form = HTML::Form->parse(<<"EOT", base => "http://example.com", strict => 1);
+<form>
+<input name="n1" id="id1" class="A" value="1">
+<input id="id2" class="A" value="2">
+<input id="id3" class="B" value="3">
+<select id="id4">
+ <option>1
+ <option>2
+ <option>3
+</selector>
+<input id="#foo" name="#bar" class=".D" disabled>
+</form>
+EOT
+
+#$form->dump;
+
+ok($form->value("n1"), 1);
+ok($form->value("^n1"), 1);
+ok($form->value("#id1"), 1);
+ok($form->value(".A"), 1);
+ok($form->value("#id2"), 2);
+ok($form->value(".B"), 3);
+
+ok(j(map $_->value, $form->find_input(".A")), "1:2");
+
+$form->find_input("#id2")->name("n2");
+$form->value("#id2", 22);
+ok($form->click->uri->query, "n1=1&n2=22");
+
+# try some odd names
+ok($form->find_input("##foo")->name, "#bar");
+ok($form->find_input("#bar"), undef);
+ok($form->find_input("^#bar")->class, ".D");
+ok($form->find_input("..D")->id, "#foo");
+
+sub j {
+ join(":", @_);
+}
@@ -3,7 +3,7 @@
use strict;
use Test qw(plan ok);
-plan tests => 126;
+plan tests => 127;
use HTML::Form;
@@ -81,10 +81,10 @@ EOT
ok($f->click->as_string, <<'EOT');
POST http://localhost/
-Content-Length: 76
+Content-Length: 69
Content-Type: application/x-www-form-urlencoded
-i.x=1&i.y=1&c=on&r=b&t=&p=&h=xyzzy&f=foo.txt&x=&a=%0Aabc%0A+++&s=bar&m=a&m=b
+i.x=1&i.y=1&c=on&r=b&t=&p=&h=xyzzy&f=&x=&a=%0Aabc%0A+++&s=bar&m=a&m=b
EOT
ok(@warn, 1);
@@ -108,7 +108,7 @@ EOT
# test file upload
$f = HTML::Form->parse(<<'EOT', "http://localhost/");
<form method=post enctype="MULTIPART/FORM-DATA">
- <input name=f type=file value=>
+ <input name=f type=file value="/etc/passwd">
<input type=submit value="Upload it!">
</form>
EOT
@@ -581,3 +581,15 @@ $f = HTML::Form->parse(<<EOT, "http://www.example.com");
EOT
ok(join(":", $f->find_input("test")->possible_values), "1:2");
ok(join(":", $f->find_input("test")->other_possible_values), "2");
+
+@warn = ();
+$f = HTML::Form->parse(<<EOT, "http://www.example.com");
+<form>
+<select id="myselect">
+<option>one</option>
+<option>two</option>
+<option>three</option>
+</select>
+</form>
+EOT
+ok(@warn, 0);
@@ -17,6 +17,12 @@ plan tests => scalar(@urls);
for my $url (@urls) {
print "# $url\n";
- my @listing = parse_dir(get($url),undef,"apache");
+ my $dir = get($url);
+ unless ($dir) {
+ print "# Can't get document at $url\n";
+ ok(0);
+ next;
+ }
+ my @listing = parse_dir($dir, undef, "apache");
ok(@listing);
}
@@ -26,7 +26,7 @@ if ($D eq 'daemon') {
while ($c = $d->accept) {
$r = $c->get_request;
if ($r) {
- my $p = ($r->url->path_segments)[1];
+ my $p = ($r->uri->path_segments)[1];
my $func = lc("httpd_" . $r->method . "_$p");
if (defined &$func) {
&$func($c, $r);
@@ -48,7 +48,7 @@ else {
}
use Test;
-plan tests => 49;
+plan tests => 52;
my $greeting = <DAEMON>;
$greeting =~ /(<[^>]+>)/;
@@ -154,7 +154,7 @@ close(FILE);
sub httpd_get_file
{
my($c, $r) = @_;
- my %form = $r->url->query_form;
+ my %form = $r->uri->query_form;
my $file = $form{'name'};
$c->send_file_response($file);
unlink($file) if $file =~ /^test-/;
@@ -204,7 +204,7 @@ ok($res->previous->code, 301);
sub httpd_get_redirect2 { shift->send_redirect("/redirect3/") }
sub httpd_get_redirect3 { shift->send_redirect("/redirect2/") }
-$req->url(url("/redirect2", $base));
+$req->uri(url("/redirect2", $base));
$ua->max_redirect(5);
$res = $ua->request($req);
#print $res->as_string;
@@ -263,12 +263,12 @@ $res = $ua->request($req);
ok($res->code, 401);
# Let's try to set credentials for this realm
-$ua->credentials($req->url->host_port, "libwww-perl", "ok 12", "xyzzy");
+$ua->credentials($req->uri->host_port, "libwww-perl", "ok 12", "xyzzy");
$res = $ua->request($req);
ok($res->is_success);
# Then illegal credentials
-$ua->credentials($req->url->host_port, "libwww-perl", "user", "passwd");
+$ua->credentials($req->uri->host_port, "libwww-perl", "user", "passwd");
$res = $ua->request($req);
ok($res->code, 401);
@@ -279,7 +279,7 @@ sub httpd_get_proxy
{
my($c,$r) = @_;
if ($r->method eq "GET" and
- $r->url->scheme eq "ftp") {
+ $r->uri->scheme eq "ftp") {
$c->send_basic_header(200);
$c->send_crlf;
}
@@ -328,6 +328,34 @@ ok($_, qr/^Content-Type:\s*application\/x-www-form-urlencoded$/mi);
ok($_, qr/^foo=bar&bar=test$/m);
#----------------------------------------------------------------
+print "Check partial content response...\n";
+sub httpd_get_partial
+{
+ my($c) = @_;
+ $c->send_basic_header(206);
+ print $c "Content-Type: image/jpeg\015\012";
+ $c->send_crlf;
+ print $c "some fake JPEG content";
+
+}
+
+{
+ $req = HTTP::Request->new( GET => url("/partial", $base) );
+ $res = $ua->request($req);
+ ok($res->is_success); # "a 206 response is considered successful"
+}
+{
+ $ua->max_size(3);
+ $req = HTTP::Request->new( GET => url("/partial", $base) );
+ $res = $ua->request($req);
+ ok($res->is_success); # "a 206 response is considered successful"
+ # Put max_size back how we found it.
+ $ua->max_size(undef);
+ ok($res->as_string, qr/Client-Aborted: max_size/); # Client-Aborted is returned when max_size is given
+}
+
+
+#----------------------------------------------------------------
print "Terminating server...\n";
sub httpd_get_quit
{
@@ -59,7 +59,7 @@ sub request
#print $request->as_string;
ok($proxy, "http://www.sn.no/");
- ok($request->url, "ftp://foo/");
+ ok($request->uri, "ftp://foo/");
ok($request->header("cookie"), "perl=cool");
my $res = HTTP::Response->new(200 => "OK");
@@ -25,7 +25,7 @@ if ($D eq 'daemon') {
while ($c = $d->accept) {
$r = $c->get_request;
if ($r) {
- my $p = ($r->url->path_segments)[1];
+ my $p = ($r->uri->path_segments)[1];
$p =~ s/\W//g;
my $func = lc("httpd_" . $r->method . "_$p");
#print STDERR "Calling $func...\n";
@@ -25,7 +25,7 @@ if ($D eq 'daemon') {
while ($c = $d->accept) {
$r = $c->get_request;
if ($r) {
- my $p = ($r->url->path_segments)[1];
+ my $p = ($r->uri->path_segments)[1];
$p =~ s/\W//g;
my $func = lc("httpd_" . $r->method . "_$p");
#print STDERR "Calling $func...\n";