mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
[svn] Fix #20323 - Adjustments and tests for when HEAD should be sent.
This commit is contained in:
parent
4358313069
commit
6e3d978b8b
@ -33,6 +33,21 @@
|
|||||||
|
|
||||||
* spider.c (in_url_list_p): Removed the bool verbose argument
|
* spider.c (in_url_list_p): Removed the bool verbose argument
|
||||||
|
|
||||||
|
2007-08-22 Mauro Tortonesi <mauro@ferrara.linux.it>
|
||||||
|
|
||||||
|
* http.c (http_loop): Fall back to GET if HEAD fails with a 500 or 501
|
||||||
|
error code.
|
||||||
|
|
||||||
|
2007-08-21 Mauro Tortonesi <mauro@ferrara.linux.it>
|
||||||
|
|
||||||
|
* http.c (http_loop): Send preliminary HEAD request if -N is given and
|
||||||
|
the destination file exists already.
|
||||||
|
|
||||||
|
2007-08-10 Mauro Tortonesi <mauro@ferrara.linux.it>
|
||||||
|
|
||||||
|
* http.c (http_loop): Fixed HTTP HEAD requests logic when --spider is
|
||||||
|
given.
|
||||||
|
|
||||||
2007-08-10 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
|
2007-08-10 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
|
||||||
|
|
||||||
* url.c (append_uri_pathel): Do not assume dest string to be
|
* url.c (append_uri_pathel): Do not assume dest string to be
|
||||||
@ -110,6 +125,12 @@
|
|||||||
* test.h: tests made more verbose; now displays the name
|
* test.h: tests made more verbose; now displays the name
|
||||||
of each test run.
|
of each test run.
|
||||||
|
|
||||||
|
2007-07-10 Mauro Tortonesi <mauro@ferrara.linux.it>
|
||||||
|
|
||||||
|
* http.c (http_loop): Fixed the HTTP requests logic. Now it skips the
|
||||||
|
preliminary HEAD request if either -O or --no-content-disposition are
|
||||||
|
given, and neither --spider and -N are given.
|
||||||
|
|
||||||
2007-07-05 Micah Cowan <micah@cowan.name>
|
2007-07-05 Micah Cowan <micah@cowan.name>
|
||||||
|
|
||||||
* cmpt.c, connect.c, connect.h, convert.c, convert.h:
|
* cmpt.c, connect.c, connect.h, convert.c, convert.h:
|
||||||
@ -127,6 +148,11 @@
|
|||||||
Updated GPL reference to version 3 or later, removed FSF
|
Updated GPL reference to version 3 or later, removed FSF
|
||||||
address.
|
address.
|
||||||
|
|
||||||
|
2007-07-04 Mauro Tortonesi <mauro@ferrara.linux.it>
|
||||||
|
|
||||||
|
* http.c (http_loop): Skip HEAD request and start immediately with GET
|
||||||
|
if -O is given.
|
||||||
|
|
||||||
2007-02-02 Hrvoje Niksic <hniksic@xemacs.org>
|
2007-02-02 Hrvoje Niksic <hniksic@xemacs.org>
|
||||||
|
|
||||||
* http.c (print_server_response): Escape non-printable characters
|
* http.c (print_server_response): Escape non-printable characters
|
||||||
|
45
src/http.c
45
src/http.c
@ -2314,6 +2314,7 @@ http_loop (struct url *u, char **newloc, char **local_file, const char *referer,
|
|||||||
wgint local_size = 0; /* the size of the local file */
|
wgint local_size = 0; /* the size of the local file */
|
||||||
struct http_stat hstat; /* HTTP status */
|
struct http_stat hstat; /* HTTP status */
|
||||||
struct_stat st;
|
struct_stat st;
|
||||||
|
bool send_head_first = true;
|
||||||
|
|
||||||
/* Assert that no value for *LOCAL_FILE was passed. */
|
/* Assert that no value for *LOCAL_FILE was passed. */
|
||||||
assert (local_file == NULL || *local_file == NULL);
|
assert (local_file == NULL || *local_file == NULL);
|
||||||
@ -2351,6 +2352,19 @@ http_loop (struct url *u, char **newloc, char **local_file, const char *referer,
|
|||||||
/* Reset the document type. */
|
/* Reset the document type. */
|
||||||
*dt = 0;
|
*dt = 0;
|
||||||
|
|
||||||
|
/* Skip preliminary HEAD request if we're not in spider mode AND
|
||||||
|
* if -O was given or HTTP Content-Disposition support is disabled. */
|
||||||
|
if (!opt.spider
|
||||||
|
&& (got_name || !opt.content_disposition))
|
||||||
|
send_head_first = false;
|
||||||
|
|
||||||
|
/* Send preliminary HEAD request if -N is given and we have an existing
|
||||||
|
* destination file. */
|
||||||
|
if (opt.timestamping
|
||||||
|
&& !opt.content_disposition
|
||||||
|
&& file_exists_p (url_file_name (u)))
|
||||||
|
send_head_first = true;
|
||||||
|
|
||||||
/* THE loop */
|
/* THE loop */
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
@ -2392,8 +2406,7 @@ Spider mode enabled. Check if remote file exists.\n"));
|
|||||||
/* Default document type is empty. However, if spider mode is
|
/* Default document type is empty. However, if spider mode is
|
||||||
on or time-stamping is employed, HEAD_ONLY commands is
|
on or time-stamping is employed, HEAD_ONLY commands is
|
||||||
encoded within *dt. */
|
encoded within *dt. */
|
||||||
if (((opt.spider || opt.timestamping) && !got_head)
|
if (send_head_first && !got_head)
|
||||||
|| (opt.always_rest && !got_name))
|
|
||||||
*dt |= HEAD_ONLY;
|
*dt |= HEAD_ONLY;
|
||||||
else
|
else
|
||||||
*dt &= ~HEAD_ONLY;
|
*dt &= ~HEAD_ONLY;
|
||||||
@ -2434,7 +2447,7 @@ Spider mode enabled. Check if remote file exists.\n"));
|
|||||||
/* Get the new location (with or without the redirection). */
|
/* Get the new location (with or without the redirection). */
|
||||||
if (hstat.newloc)
|
if (hstat.newloc)
|
||||||
*newloc = xstrdup (hstat.newloc);
|
*newloc = xstrdup (hstat.newloc);
|
||||||
|
|
||||||
switch (err)
|
switch (err)
|
||||||
{
|
{
|
||||||
case HERR: case HEOF: case CONSOCKERR: case CONCLOSED:
|
case HERR: case HEOF: case CONSOCKERR: case CONCLOSED:
|
||||||
@ -2485,7 +2498,7 @@ Spider mode enabled. Check if remote file exists.\n"));
|
|||||||
/* All possibilities should have been exhausted. */
|
/* All possibilities should have been exhausted. */
|
||||||
abort ();
|
abort ();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(*dt & RETROKF))
|
if (!(*dt & RETROKF))
|
||||||
{
|
{
|
||||||
char *hurl = NULL;
|
char *hurl = NULL;
|
||||||
@ -2495,9 +2508,17 @@ Spider mode enabled. Check if remote file exists.\n"));
|
|||||||
hurl = url_string (u, URL_AUTH_HIDE_PASSWD);
|
hurl = url_string (u, URL_AUTH_HIDE_PASSWD);
|
||||||
logprintf (LOG_NONVERBOSE, "%s:\n", hurl);
|
logprintf (LOG_NONVERBOSE, "%s:\n", hurl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Fall back to GET if HEAD fails with a 500 or 501 error code. */
|
||||||
|
if (*dt & HEAD_ONLY
|
||||||
|
&& (hstat.statcode == 500 || hstat.statcode == 501))
|
||||||
|
{
|
||||||
|
got_head = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
/* Maybe we should always keep track of broken links, not just in
|
/* Maybe we should always keep track of broken links, not just in
|
||||||
* spider mode. */
|
* spider mode. */
|
||||||
if (opt.spider)
|
else if (opt.spider)
|
||||||
{
|
{
|
||||||
/* #### Again: ugly ugly ugly! */
|
/* #### Again: ugly ugly ugly! */
|
||||||
if (!hurl)
|
if (!hurl)
|
||||||
@ -2518,7 +2539,7 @@ Remote file does not exist -- broken link!!!\n"));
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Did we get the time-stamp? */
|
/* Did we get the time-stamp? */
|
||||||
if (!got_head)
|
if (send_head_first && !got_head)
|
||||||
{
|
{
|
||||||
bool restart_loop = false;
|
bool restart_loop = false;
|
||||||
|
|
||||||
@ -2584,12 +2605,6 @@ The sizes do not match (local %s) -- retrieving.\n"),
|
|||||||
restart_loop = true;
|
restart_loop = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opt.always_rest)
|
|
||||||
{
|
|
||||||
got_name = true;
|
|
||||||
restart_loop = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (opt.spider)
|
if (opt.spider)
|
||||||
{
|
{
|
||||||
if (opt.recursive)
|
if (opt.recursive)
|
||||||
@ -2617,6 +2632,12 @@ Remote file exists but recursion is disabled -- not retrieving.\n\n"));
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (send_head_first)
|
||||||
|
{
|
||||||
|
got_name = true;
|
||||||
|
restart_loop = true;
|
||||||
|
}
|
||||||
|
|
||||||
got_head = true; /* no more time-stamping */
|
got_head = true; /* no more time-stamping */
|
||||||
*dt &= ~HEAD_ONLY;
|
*dt &= ~HEAD_ONLY;
|
||||||
count = 0; /* the retrieve count for HEAD is reset */
|
count = 0; /* the retrieve count for HEAD is reset */
|
||||||
|
@ -1,17 +1,34 @@
|
|||||||
2007-08-21 Mauro Tortonesi <mauro@ferrara.linux.it>
|
2007-08-21 Mauro Tortonesi <mauro@ferrara.linux.it>
|
||||||
|
|
||||||
* WgetTest.pm.in: Added support for timestamping of pre-existing
|
* WgetTest.pm.in: Added support for timestamping of pre-existing
|
||||||
files.
|
files.
|
||||||
|
|
||||||
* Test-N-current.px: Fixed broken test logic.
|
* Test-N-current.px: Fixed broken test logic.
|
||||||
|
|
||||||
* Makefile.in: Updated list of automatically run tests.
|
* Makefile.in: Updated list of automatically run tests.
|
||||||
|
|
||||||
* Test-HTTP-Content-Disposition.px: Added -e contentdisposition=on
|
* Test-HTTP-Content-Disposition.px: Added -e contentdisposition=on
|
||||||
option, since now HTTP Content-Disposition header support is turned
|
option, since now HTTP Content-Disposition header support is turned
|
||||||
off by default.
|
off by default.
|
||||||
|
|
||||||
* Test-HTTP-Content-Disposition-1.px: Ditto.
|
* Test-HTTP-Content-Disposition-1.px: Ditto.
|
||||||
|
|
||||||
|
2007-08-10 Mauro Tortonesi <mauro@ferrara.linux.it>
|
||||||
|
|
||||||
|
* Test--spider--no-content-disposition-trivial.px: Added new tests for
|
||||||
|
validation of HTTP Content-Disposition header support logic. In
|
||||||
|
particular, these tests check wget's behavior for every combination of
|
||||||
|
--spider [-r] and -e contentdisposition=on/off options.
|
||||||
|
|
||||||
|
* Test--spider-r-HTTP-Content-Disposition.px: Ditto.
|
||||||
|
|
||||||
|
* Test--spider-HTTP-Content-Disposition.px: Ditto.
|
||||||
|
|
||||||
|
* Test--spider--no-content-disposition.px: Ditto.
|
||||||
|
|
||||||
|
* Test--spider-r--no-content-disposition-trivial.px: Ditto.
|
||||||
|
|
||||||
|
* Test--spider-r--no-content-disposition.px: Ditto.
|
||||||
|
|
||||||
2007-07-25 Micah Cowan <micah@cowan.name>
|
2007-07-25 Micah Cowan <micah@cowan.name>
|
||||||
|
|
||||||
@ -29,6 +46,27 @@
|
|||||||
ensure that correct basic creds are sent, but never until a
|
ensure that correct basic creds are sent, but never until a
|
||||||
challenge has been sent.
|
challenge has been sent.
|
||||||
|
|
||||||
|
2007-07-10 Mauro Tortonesi <mauro@ferrara.linux.it>
|
||||||
|
|
||||||
|
* Test--no-content-disposition.px: Added new tests for validation of
|
||||||
|
HTTP Content-Disposition header support logic. In particular, these
|
||||||
|
tests check wget's behavior for every combination of -N/-O and -e
|
||||||
|
contentdisposition=on/off options.
|
||||||
|
|
||||||
|
* Test--no-content-disposition-trivial.px: Ditto.
|
||||||
|
|
||||||
|
* Test-N-HTTP-Content-Disposition.px: Ditto.
|
||||||
|
|
||||||
|
* Test-N--no-content-disposition.px: Ditto.
|
||||||
|
|
||||||
|
* Test-N--no-content-disposition-trivial.px: Ditto.
|
||||||
|
|
||||||
|
* Test-O-HTTP-Content-Disposition.px: Ditto.
|
||||||
|
|
||||||
|
* Test-O--no-content-disposition.px: Ditto.
|
||||||
|
|
||||||
|
* Test-O--no-content-disposition-trivial.px: Ditto.
|
||||||
|
|
||||||
2007-07-05 Micah Cowan <micah@cowan.name>
|
2007-07-05 Micah Cowan <micah@cowan.name>
|
||||||
|
|
||||||
* Makefile.in:
|
* Makefile.in:
|
||||||
|
@ -95,18 +95,33 @@ run-px-tests: WgetTest.pm
|
|||||||
./Test-HTTP-Content-Disposition-1.px && echo && echo
|
./Test-HTTP-Content-Disposition-1.px && echo && echo
|
||||||
./Test-HTTP-Content-Disposition-2.px && echo && echo
|
./Test-HTTP-Content-Disposition-2.px && echo && echo
|
||||||
./Test-HTTP-Content-Disposition.px && echo && echo
|
./Test-HTTP-Content-Disposition.px && echo && echo
|
||||||
|
./Test-N-current-HTTP-CD.px && echo && echo
|
||||||
./Test-N-current.px && echo && echo
|
./Test-N-current.px && echo && echo
|
||||||
|
./Test-N-HTTP-Content-Disposition.px && echo && echo
|
||||||
|
./Test-N--no-content-disposition.px && echo && echo
|
||||||
|
./Test-N--no-content-disposition-trivial.px && echo && echo
|
||||||
|
./Test--no-content-disposition.px && echo && echo
|
||||||
|
./Test--no-content-disposition-trivial.px && echo && echo
|
||||||
./Test-N-old.px && echo && echo
|
./Test-N-old.px && echo && echo
|
||||||
./Test-nonexisting-quiet.px && echo && echo
|
./Test-nonexisting-quiet.px && echo && echo
|
||||||
./Test-noop.px && echo && echo
|
./Test-noop.px && echo && echo
|
||||||
./Test-np.px && echo && echo
|
./Test-np.px && echo && echo
|
||||||
./Test-N.px && echo && echo
|
./Test-N.px && echo && echo
|
||||||
|
./Test-O-HTTP-Content-Disposition.px && echo && echo
|
||||||
|
./Test-O--no-content-disposition.px && echo && echo
|
||||||
|
./Test-O--no-content-disposition-trivial.px && echo && echo
|
||||||
./Test-O-nonexisting.px && echo && echo
|
./Test-O-nonexisting.px && echo && echo
|
||||||
./Test-O.px && echo && echo
|
./Test-O.px && echo && echo
|
||||||
./Test-Restrict-Lowercase.px && echo && echo
|
./Test-Restrict-Lowercase.px && echo && echo
|
||||||
./Test-Restrict-Uppercase.px && echo && echo
|
./Test-Restrict-Uppercase.px && echo && echo
|
||||||
./Test--spider-fail.px && echo && echo
|
./Test--spider-fail.px && echo && echo
|
||||||
|
./Test--spider-HTTP-Content-Disposition.px && echo && echo
|
||||||
|
./Test--spider--no-content-disposition.px && echo && echo
|
||||||
|
./Test--spider--no-content-disposition-trivial.px && echo && echo
|
||||||
./Test--spider.px && echo && echo
|
./Test--spider.px && echo && echo
|
||||||
|
./Test--spider-r-HTTP-Content-Disposition.px && echo && echo
|
||||||
|
./Test--spider-r--no-content-disposition.px && echo && echo
|
||||||
|
./Test--spider-r--no-content-disposition-trivial.px && echo && echo
|
||||||
./Test--spider-r.px && echo && echo
|
./Test--spider-r.px && echo && echo
|
||||||
|
|
||||||
WgetTest.pm: WgetTest.pm.in @top_srcdir@/config.status
|
WgetTest.pm: WgetTest.pm.in @top_srcdir@/config.status
|
||||||
|
55
tests/Test--no-content-disposition-trivial.px
Executable file
55
tests/Test--no-content-disposition-trivial.px
Executable file
@ -0,0 +1,55 @@
|
|||||||
|
#!/usr/bin/perl -w
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
|
||||||
|
use HTTPTest;
|
||||||
|
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
my $dummyfile = <<EOF;
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Page Title</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>
|
||||||
|
Some text.
|
||||||
|
</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# code, msg, headers, content
|
||||||
|
my %urls = (
|
||||||
|
'/dummy.html' => {
|
||||||
|
code => "200",
|
||||||
|
msg => "Dontcare",
|
||||||
|
headers => {
|
||||||
|
"Content-type" => "text/html",
|
||||||
|
},
|
||||||
|
content => $dummyfile,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
my $cmdline = $WgetTest::WGETPATH . " --no-content-disposition http://localhost:8080/dummy.html";
|
||||||
|
|
||||||
|
my $expected_error_code = 0;
|
||||||
|
|
||||||
|
my %expected_downloaded_files = (
|
||||||
|
'dummy.html' => {
|
||||||
|
content => $dummyfile,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
my $the_test = HTTPTest->new (name => "Test--no-content-disposition-trivial",
|
||||||
|
input => \%urls,
|
||||||
|
cmdline => $cmdline,
|
||||||
|
errcode => $expected_error_code,
|
||||||
|
output => \%expected_downloaded_files);
|
||||||
|
exit $the_test->run();
|
||||||
|
|
||||||
|
# vim: et ts=4 sw=4
|
||||||
|
|
56
tests/Test--no-content-disposition.px
Executable file
56
tests/Test--no-content-disposition.px
Executable file
@ -0,0 +1,56 @@
|
|||||||
|
#!/usr/bin/perl -w
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
|
||||||
|
use HTTPTest;
|
||||||
|
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
my $dummyfile = <<EOF;
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Page Title</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>
|
||||||
|
Some text.
|
||||||
|
</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# code, msg, headers, content
|
||||||
|
my %urls = (
|
||||||
|
'/dummy.html' => {
|
||||||
|
code => "200",
|
||||||
|
msg => "Dontcare",
|
||||||
|
headers => {
|
||||||
|
"Content-type" => "text/html",
|
||||||
|
"Content-Disposition" => "attachment; filename=\"filename.html\"",
|
||||||
|
},
|
||||||
|
content => $dummyfile,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
my $cmdline = $WgetTest::WGETPATH . " --no-content-disposition http://localhost:8080/dummy.html";
|
||||||
|
|
||||||
|
my $expected_error_code = 0;
|
||||||
|
|
||||||
|
my %expected_downloaded_files = (
|
||||||
|
'dummy.html' => {
|
||||||
|
content => $dummyfile,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
my $the_test = HTTPTest->new (name => "Test--no-content-disposition",
|
||||||
|
input => \%urls,
|
||||||
|
cmdline => $cmdline,
|
||||||
|
errcode => $expected_error_code,
|
||||||
|
output => \%expected_downloaded_files);
|
||||||
|
exit $the_test->run();
|
||||||
|
|
||||||
|
# vim: et ts=4 sw=4
|
||||||
|
|
52
tests/Test--spider--no-content-disposition-trivial.px
Executable file
52
tests/Test--spider--no-content-disposition-trivial.px
Executable file
@ -0,0 +1,52 @@
|
|||||||
|
#!/usr/bin/perl -w
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
|
||||||
|
use HTTPTest;
|
||||||
|
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
my $mainpage = <<EOF;
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Main Page</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>
|
||||||
|
Some text.
|
||||||
|
</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# code, msg, headers, content
|
||||||
|
my %urls = (
|
||||||
|
'/index.html' => {
|
||||||
|
code => "200",
|
||||||
|
msg => "Dontcare",
|
||||||
|
headers => {
|
||||||
|
"Content-type" => "text/html",
|
||||||
|
},
|
||||||
|
content => $mainpage,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
my $cmdline = $WgetTest::WGETPATH . " --spider --no-content-disposition http://localhost:8080/index.html";
|
||||||
|
|
||||||
|
my $expected_error_code = 256;
|
||||||
|
|
||||||
|
my %expected_downloaded_files = (
|
||||||
|
);
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
my $the_test = HTTPTest->new (name => "Test--spider--no-content-disposition-trivial",
|
||||||
|
input => \%urls,
|
||||||
|
cmdline => $cmdline,
|
||||||
|
errcode => $expected_error_code,
|
||||||
|
output => \%expected_downloaded_files);
|
||||||
|
exit $the_test->run();
|
||||||
|
|
||||||
|
# vim: et ts=4 sw=4
|
||||||
|
|
53
tests/Test--spider--no-content-disposition.px
Executable file
53
tests/Test--spider--no-content-disposition.px
Executable file
@ -0,0 +1,53 @@
|
|||||||
|
#!/usr/bin/perl -w
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
|
||||||
|
use HTTPTest;
|
||||||
|
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
my $mainpage = <<EOF;
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Main Page</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>
|
||||||
|
Some text.
|
||||||
|
</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# code, msg, headers, content
|
||||||
|
my %urls = (
|
||||||
|
'/index.html' => {
|
||||||
|
code => "200",
|
||||||
|
msg => "Dontcare",
|
||||||
|
headers => {
|
||||||
|
"Content-type" => "text/html",
|
||||||
|
"Content-Disposition" => "attachment; filename=\"filename.html\"",
|
||||||
|
},
|
||||||
|
content => $mainpage,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
my $cmdline = $WgetTest::WGETPATH . " --spider --no-content-disposition http://localhost:8080/index.html";
|
||||||
|
|
||||||
|
my $expected_error_code = 256;
|
||||||
|
|
||||||
|
my %expected_downloaded_files = (
|
||||||
|
);
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
my $the_test = HTTPTest->new (name => "Test--spider--no-content-disposition",
|
||||||
|
input => \%urls,
|
||||||
|
cmdline => $cmdline,
|
||||||
|
errcode => $expected_error_code,
|
||||||
|
output => \%expected_downloaded_files);
|
||||||
|
exit $the_test->run();
|
||||||
|
|
||||||
|
# vim: et ts=4 sw=4
|
||||||
|
|
53
tests/Test--spider-HTTP-Content-Disposition.px
Executable file
53
tests/Test--spider-HTTP-Content-Disposition.px
Executable file
@ -0,0 +1,53 @@
|
|||||||
|
#!/usr/bin/perl -w
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
|
||||||
|
use HTTPTest;
|
||||||
|
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
my $mainpage = <<EOF;
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Main Page</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>
|
||||||
|
Some text.
|
||||||
|
</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# code, msg, headers, content
|
||||||
|
my %urls = (
|
||||||
|
'/index.html' => {
|
||||||
|
code => "200",
|
||||||
|
msg => "Dontcare",
|
||||||
|
headers => {
|
||||||
|
"Content-type" => "text/html",
|
||||||
|
"Content-Disposition" => "attachment; filename=\"filename.html\"",
|
||||||
|
},
|
||||||
|
content => $mainpage,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
my $cmdline = $WgetTest::WGETPATH . " --spider http://localhost:8080/index.html";
|
||||||
|
|
||||||
|
my $expected_error_code = 256;
|
||||||
|
|
||||||
|
my %expected_downloaded_files = (
|
||||||
|
);
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
my $the_test = HTTPTest->new (name => "Test--spider-HTTP-Content-Disposition",
|
||||||
|
input => \%urls,
|
||||||
|
cmdline => $cmdline,
|
||||||
|
errcode => $expected_error_code,
|
||||||
|
output => \%expected_downloaded_files);
|
||||||
|
exit $the_test->run();
|
||||||
|
|
||||||
|
# vim: et ts=4 sw=4
|
||||||
|
|
109
tests/Test--spider-r--no-content-disposition-trivial.px
Executable file
109
tests/Test--spider-r--no-content-disposition-trivial.px
Executable file
@ -0,0 +1,109 @@
|
|||||||
|
#!/usr/bin/perl -w
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
|
||||||
|
use HTTPTest;
|
||||||
|
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
my $mainpage = <<EOF;
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Main Page</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>
|
||||||
|
Some text and a link to a <a href="http://localhost:8080/secondpage.html">second page</a>.
|
||||||
|
Also, a <a href="http://localhost:8080/nonexistent">broken link</a>.
|
||||||
|
</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
EOF
|
||||||
|
|
||||||
|
my $secondpage = <<EOF;
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Second Page</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>
|
||||||
|
Some text and a link to a <a href="http://localhost:8080/thirdpage.html">third page</a>.
|
||||||
|
Also, a <a href="http://localhost:8080/nonexistent">broken link</a>.
|
||||||
|
</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
EOF
|
||||||
|
|
||||||
|
my $thirdpage = <<EOF;
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Third Page</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>
|
||||||
|
Some text and a link to a <a href="http://localhost:8080/dummy.txt">text file</a>.
|
||||||
|
Also, another <a href="http://localhost:8080/againnonexistent">broken link</a>.
|
||||||
|
</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
EOF
|
||||||
|
|
||||||
|
my $dummyfile = <<EOF;
|
||||||
|
Don't care.
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# code, msg, headers, content
|
||||||
|
my %urls = (
|
||||||
|
'/index.html' => {
|
||||||
|
code => "200",
|
||||||
|
msg => "Dontcare",
|
||||||
|
headers => {
|
||||||
|
"Content-type" => "text/html",
|
||||||
|
},
|
||||||
|
content => $mainpage,
|
||||||
|
},
|
||||||
|
'/secondpage.html' => {
|
||||||
|
code => "200",
|
||||||
|
msg => "Dontcare",
|
||||||
|
headers => {
|
||||||
|
"Content-type" => "text/html",
|
||||||
|
},
|
||||||
|
content => $secondpage,
|
||||||
|
},
|
||||||
|
'/thirdpage.html' => {
|
||||||
|
code => "200",
|
||||||
|
msg => "Dontcare",
|
||||||
|
headers => {
|
||||||
|
"Content-type" => "text/html",
|
||||||
|
},
|
||||||
|
content => $thirdpage,
|
||||||
|
},
|
||||||
|
'/dummy.txt' => {
|
||||||
|
code => "200",
|
||||||
|
msg => "Dontcare",
|
||||||
|
headers => {
|
||||||
|
"Content-type" => "text/plain",
|
||||||
|
},
|
||||||
|
content => $dummyfile
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
my $cmdline = $WgetTest::WGETPATH . " --spider -r --no-content-disposition http://localhost:8080/";
|
||||||
|
|
||||||
|
my $expected_error_code = 0;
|
||||||
|
|
||||||
|
my %expected_downloaded_files = (
|
||||||
|
);
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
my $the_test = HTTPTest->new (name => "Test--spider-r--no-content-disposition-trivial",
|
||||||
|
input => \%urls,
|
||||||
|
cmdline => $cmdline,
|
||||||
|
errcode => $expected_error_code,
|
||||||
|
output => \%expected_downloaded_files);
|
||||||
|
exit $the_test->run();
|
||||||
|
|
||||||
|
# vim: et ts=4 sw=4
|
||||||
|
|
110
tests/Test--spider-r--no-content-disposition.px
Executable file
110
tests/Test--spider-r--no-content-disposition.px
Executable file
@ -0,0 +1,110 @@
|
|||||||
|
#!/usr/bin/perl -w
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
|
||||||
|
use HTTPTest;
|
||||||
|
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
my $mainpage = <<EOF;
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Main Page</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>
|
||||||
|
Some text and a link to a <a href="http://localhost:8080/secondpage.html">second page</a>.
|
||||||
|
Also, a <a href="http://localhost:8080/nonexistent">broken link</a>.
|
||||||
|
</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
EOF
|
||||||
|
|
||||||
|
my $secondpage = <<EOF;
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Second Page</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>
|
||||||
|
Some text and a link to a <a href="http://localhost:8080/thirdpage.html">third page</a>.
|
||||||
|
Also, a <a href="http://localhost:8080/nonexistent">broken link</a>.
|
||||||
|
</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
EOF
|
||||||
|
|
||||||
|
my $thirdpage = <<EOF;
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Third Page</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>
|
||||||
|
Some text and a link to a <a href="http://localhost:8080/dummy.txt">text file</a>.
|
||||||
|
Also, another <a href="http://localhost:8080/againnonexistent">broken link</a>.
|
||||||
|
</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
EOF
|
||||||
|
|
||||||
|
my $dummyfile = <<EOF;
|
||||||
|
Don't care.
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# code, msg, headers, content
|
||||||
|
my %urls = (
|
||||||
|
'/index.html' => {
|
||||||
|
code => "200",
|
||||||
|
msg => "Dontcare",
|
||||||
|
headers => {
|
||||||
|
"Content-type" => "text/html",
|
||||||
|
},
|
||||||
|
content => $mainpage,
|
||||||
|
},
|
||||||
|
'/secondpage.html' => {
|
||||||
|
code => "200",
|
||||||
|
msg => "Dontcare",
|
||||||
|
headers => {
|
||||||
|
"Content-type" => "text/html",
|
||||||
|
"Content-Disposition" => "attachment; filename=\"filename.html\"",
|
||||||
|
},
|
||||||
|
content => $secondpage,
|
||||||
|
},
|
||||||
|
'/thirdpage.html' => {
|
||||||
|
code => "200",
|
||||||
|
msg => "Dontcare",
|
||||||
|
headers => {
|
||||||
|
"Content-type" => "text/html",
|
||||||
|
},
|
||||||
|
content => $thirdpage,
|
||||||
|
},
|
||||||
|
'/dummy.txt' => {
|
||||||
|
code => "200",
|
||||||
|
msg => "Dontcare",
|
||||||
|
headers => {
|
||||||
|
"Content-type" => "text/plain",
|
||||||
|
},
|
||||||
|
content => $dummyfile
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
my $cmdline = $WgetTest::WGETPATH . " --spider -r --no-content-disposition http://localhost:8080/";
|
||||||
|
|
||||||
|
my $expected_error_code = 0;
|
||||||
|
|
||||||
|
my %expected_downloaded_files = (
|
||||||
|
);
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
my $the_test = HTTPTest->new (name => "Test--spider-r--no-content-disposition",
|
||||||
|
input => \%urls,
|
||||||
|
cmdline => $cmdline,
|
||||||
|
errcode => $expected_error_code,
|
||||||
|
output => \%expected_downloaded_files);
|
||||||
|
exit $the_test->run();
|
||||||
|
|
||||||
|
# vim: et ts=4 sw=4
|
||||||
|
|
110
tests/Test--spider-r-HTTP-Content-Disposition.px
Executable file
110
tests/Test--spider-r-HTTP-Content-Disposition.px
Executable file
@ -0,0 +1,110 @@
|
|||||||
|
#!/usr/bin/perl -w
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
|
||||||
|
use HTTPTest;
|
||||||
|
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
my $mainpage = <<EOF;
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Main Page</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>
|
||||||
|
Some text and a link to a <a href="http://localhost:8080/secondpage.html">second page</a>.
|
||||||
|
Also, a <a href="http://localhost:8080/nonexistent">broken link</a>.
|
||||||
|
</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
EOF
|
||||||
|
|
||||||
|
my $secondpage = <<EOF;
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Second Page</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>
|
||||||
|
Some text and a link to a <a href="http://localhost:8080/thirdpage.html">third page</a>.
|
||||||
|
Also, a <a href="http://localhost:8080/nonexistent">broken link</a>.
|
||||||
|
</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
EOF
|
||||||
|
|
||||||
|
my $thirdpage = <<EOF;
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Third Page</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>
|
||||||
|
Some text and a link to a <a href="http://localhost:8080/dummy.txt">text file</a>.
|
||||||
|
Also, another <a href="http://localhost:8080/againnonexistent">broken link</a>.
|
||||||
|
</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
EOF
|
||||||
|
|
||||||
|
my $dummyfile = <<EOF;
|
||||||
|
Don't care.
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# code, msg, headers, content
|
||||||
|
my %urls = (
|
||||||
|
'/index.html' => {
|
||||||
|
code => "200",
|
||||||
|
msg => "Dontcare",
|
||||||
|
headers => {
|
||||||
|
"Content-type" => "text/html",
|
||||||
|
},
|
||||||
|
content => $mainpage,
|
||||||
|
},
|
||||||
|
'/secondpage.html' => {
|
||||||
|
code => "200",
|
||||||
|
msg => "Dontcare",
|
||||||
|
headers => {
|
||||||
|
"Content-type" => "text/html",
|
||||||
|
"Content-Disposition" => "attachment; filename=\"filename.html\"",
|
||||||
|
},
|
||||||
|
content => $secondpage,
|
||||||
|
},
|
||||||
|
'/thirdpage.html' => {
|
||||||
|
code => "200",
|
||||||
|
msg => "Dontcare",
|
||||||
|
headers => {
|
||||||
|
"Content-type" => "text/html",
|
||||||
|
},
|
||||||
|
content => $thirdpage,
|
||||||
|
},
|
||||||
|
'/dummy.txt' => {
|
||||||
|
code => "200",
|
||||||
|
msg => "Dontcare",
|
||||||
|
headers => {
|
||||||
|
"Content-type" => "text/plain",
|
||||||
|
},
|
||||||
|
content => $dummyfile
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
my $cmdline = $WgetTest::WGETPATH . " --spider -r http://localhost:8080/";
|
||||||
|
|
||||||
|
my $expected_error_code = 0;
|
||||||
|
|
||||||
|
my %expected_downloaded_files = (
|
||||||
|
);
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
my $the_test = HTTPTest->new (name => "Test--spider-r-HTTP-Content-Disposition",
|
||||||
|
input => \%urls,
|
||||||
|
cmdline => $cmdline,
|
||||||
|
errcode => $expected_error_code,
|
||||||
|
output => \%expected_downloaded_files);
|
||||||
|
exit $the_test->run();
|
||||||
|
|
||||||
|
# vim: et ts=4 sw=4
|
||||||
|
|
48
tests/Test-N--no-content-disposition-trivial.px
Executable file
48
tests/Test-N--no-content-disposition-trivial.px
Executable file
@ -0,0 +1,48 @@
|
|||||||
|
#!/usr/bin/perl -w
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
|
||||||
|
use HTTPTest;
|
||||||
|
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
my $dummyfile = <<EOF;
|
||||||
|
Content
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# code, msg, headers, content
|
||||||
|
my %urls = (
|
||||||
|
'/dummy.txt' => {
|
||||||
|
code => "200",
|
||||||
|
msg => "Dontcare",
|
||||||
|
headers => {
|
||||||
|
"Content-type" => "text/plain",
|
||||||
|
"Last-Modified" => "Sat, 09 Oct 2004 08:30:00 GMT",
|
||||||
|
},
|
||||||
|
content => $dummyfile
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
my $cmdline = $WgetTest::WGETPATH . " -N --no-content-disposition http://localhost:8080/dummy.txt";
|
||||||
|
|
||||||
|
my $expected_error_code = 0;
|
||||||
|
|
||||||
|
my %expected_downloaded_files = (
|
||||||
|
'dummy.txt' => {
|
||||||
|
content => $dummyfile,
|
||||||
|
timestamp => 1097310600, # "Sat, 09 Oct 2004 08:30:00 GMT"
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
my $the_test = HTTPTest->new (name => "Test-N--no-content-disposition-trivial",
|
||||||
|
input => \%urls,
|
||||||
|
cmdline => $cmdline,
|
||||||
|
errcode => $expected_error_code,
|
||||||
|
output => \%expected_downloaded_files);
|
||||||
|
exit $the_test->run();
|
||||||
|
|
||||||
|
# vim: et ts=4 sw=4
|
||||||
|
|
49
tests/Test-N--no-content-disposition.px
Executable file
49
tests/Test-N--no-content-disposition.px
Executable file
@ -0,0 +1,49 @@
|
|||||||
|
#!/usr/bin/perl -w
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
|
||||||
|
use HTTPTest;
|
||||||
|
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
my $dummyfile = <<EOF;
|
||||||
|
Content
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# code, msg, headers, content
|
||||||
|
my %urls = (
|
||||||
|
'/dummy.txt' => {
|
||||||
|
code => "200",
|
||||||
|
msg => "Dontcare",
|
||||||
|
headers => {
|
||||||
|
"Content-type" => "text/plain",
|
||||||
|
"Last-Modified" => "Sat, 09 Oct 2004 08:30:00 GMT",
|
||||||
|
"Content-Disposition" => "attachment; filename=\"filename.txt\"",
|
||||||
|
},
|
||||||
|
content => $dummyfile
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
my $cmdline = $WgetTest::WGETPATH . " -N --no-content-disposition http://localhost:8080/dummy.txt";
|
||||||
|
|
||||||
|
my $expected_error_code = 0;
|
||||||
|
|
||||||
|
my %expected_downloaded_files = (
|
||||||
|
'dummy.txt' => {
|
||||||
|
content => $dummyfile,
|
||||||
|
timestamp => 1097310600, # "Sat, 09 Oct 2004 08:30:00 GMT"
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
my $the_test = HTTPTest->new (name => "Test-N--no-content-disposition",
|
||||||
|
input => \%urls,
|
||||||
|
cmdline => $cmdline,
|
||||||
|
errcode => $expected_error_code,
|
||||||
|
output => \%expected_downloaded_files);
|
||||||
|
exit $the_test->run();
|
||||||
|
|
||||||
|
# vim: et ts=4 sw=4
|
||||||
|
|
49
tests/Test-N-HTTP-Content-Disposition.px
Executable file
49
tests/Test-N-HTTP-Content-Disposition.px
Executable file
@ -0,0 +1,49 @@
|
|||||||
|
#!/usr/bin/perl -w
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
|
||||||
|
use HTTPTest;
|
||||||
|
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
my $dummyfile = <<EOF;
|
||||||
|
Don't care.
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# code, msg, headers, content
|
||||||
|
my %urls = (
|
||||||
|
'/dummy.txt' => {
|
||||||
|
code => "200",
|
||||||
|
msg => "Dontcare",
|
||||||
|
headers => {
|
||||||
|
"Content-type" => "text/plain",
|
||||||
|
"Last-Modified" => "Sat, 09 Oct 2004 08:30:00 GMT",
|
||||||
|
"Content-Disposition" => "attachment; filename=\"filename.txt\"",
|
||||||
|
},
|
||||||
|
content => $dummyfile
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
my $cmdline = $WgetTest::WGETPATH . " -N http://localhost:8080/dummy.txt";
|
||||||
|
|
||||||
|
my $expected_error_code = 0;
|
||||||
|
|
||||||
|
my %expected_downloaded_files = (
|
||||||
|
'filename.txt' => {
|
||||||
|
content => $dummyfile,
|
||||||
|
timestamp => 1097310600, # "Sat, 09 Oct 2004 08:30:00 GMT"
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
my $the_test = HTTPTest->new (name => "Test-N-HTTP-Content-Disposition",
|
||||||
|
input => \%urls,
|
||||||
|
cmdline => $cmdline,
|
||||||
|
errcode => $expected_error_code,
|
||||||
|
output => \%expected_downloaded_files);
|
||||||
|
exit $the_test->run();
|
||||||
|
|
||||||
|
# vim: et ts=4 sw=4
|
||||||
|
|
46
tests/Test-O--no-content-disposition-trivial.px
Executable file
46
tests/Test-O--no-content-disposition-trivial.px
Executable file
@ -0,0 +1,46 @@
|
|||||||
|
#!/usr/bin/perl -w
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
|
||||||
|
use HTTPTest;
|
||||||
|
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
my $dummyfile = <<EOF;
|
||||||
|
Don't care.
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# code, msg, headers, content
|
||||||
|
my %urls = (
|
||||||
|
'/dummy.txt' => {
|
||||||
|
code => "200",
|
||||||
|
msg => "Dontcare",
|
||||||
|
headers => {
|
||||||
|
"Content-type" => "text/plain",
|
||||||
|
},
|
||||||
|
content => $dummyfile
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
my $cmdline = $WgetTest::WGETPATH . " -O out --no-content-disposition http://localhost:8080/dummy.txt";
|
||||||
|
|
||||||
|
my $expected_error_code = 0;
|
||||||
|
|
||||||
|
my %expected_downloaded_files = (
|
||||||
|
'out' => {
|
||||||
|
content => $dummyfile,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
my $the_test = HTTPTest->new (name => "Test-O--no-content-disposition-trivial",
|
||||||
|
input => \%urls,
|
||||||
|
cmdline => $cmdline,
|
||||||
|
errcode => $expected_error_code,
|
||||||
|
output => \%expected_downloaded_files);
|
||||||
|
exit $the_test->run();
|
||||||
|
|
||||||
|
# vim: et ts=4 sw=4
|
||||||
|
|
47
tests/Test-O--no-content-disposition.px
Executable file
47
tests/Test-O--no-content-disposition.px
Executable file
@ -0,0 +1,47 @@
|
|||||||
|
#!/usr/bin/perl -w
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
|
||||||
|
use HTTPTest;
|
||||||
|
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
my $dummyfile = <<EOF;
|
||||||
|
Don't care.
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# code, msg, headers, content
|
||||||
|
my %urls = (
|
||||||
|
'/dummy.txt' => {
|
||||||
|
code => "200",
|
||||||
|
msg => "Dontcare",
|
||||||
|
headers => {
|
||||||
|
"Content-type" => "text/plain",
|
||||||
|
"Content-Disposition" => "attachment; filename=\"filename.txt\"",
|
||||||
|
},
|
||||||
|
content => $dummyfile
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
my $cmdline = $WgetTest::WGETPATH . " -O out --no-content-disposition http://localhost:8080/dummy.txt";
|
||||||
|
|
||||||
|
my $expected_error_code = 0;
|
||||||
|
|
||||||
|
my %expected_downloaded_files = (
|
||||||
|
'out' => {
|
||||||
|
content => $dummyfile,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
my $the_test = HTTPTest->new (name => "Test-O--no-content-disposition",
|
||||||
|
input => \%urls,
|
||||||
|
cmdline => $cmdline,
|
||||||
|
errcode => $expected_error_code,
|
||||||
|
output => \%expected_downloaded_files);
|
||||||
|
exit $the_test->run();
|
||||||
|
|
||||||
|
# vim: et ts=4 sw=4
|
||||||
|
|
47
tests/Test-O-HTTP-Content-Disposition.px
Executable file
47
tests/Test-O-HTTP-Content-Disposition.px
Executable file
@ -0,0 +1,47 @@
|
|||||||
|
#!/usr/bin/perl -w
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
|
||||||
|
use HTTPTest;
|
||||||
|
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
my $dummyfile = <<EOF;
|
||||||
|
Don't care.
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# code, msg, headers, content
|
||||||
|
my %urls = (
|
||||||
|
'/dummy.txt' => {
|
||||||
|
code => "200",
|
||||||
|
msg => "Dontcare",
|
||||||
|
headers => {
|
||||||
|
"Content-type" => "text/plain",
|
||||||
|
"Content-Disposition" => "attachment; filename=\"filename.txt\"",
|
||||||
|
},
|
||||||
|
content => $dummyfile
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
my $cmdline = $WgetTest::WGETPATH . " -O out http://localhost:8080/dummy.txt";
|
||||||
|
|
||||||
|
my $expected_error_code = 0;
|
||||||
|
|
||||||
|
my %expected_downloaded_files = (
|
||||||
|
'out' => {
|
||||||
|
content => $dummyfile,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
my $the_test = HTTPTest->new (name => "Test-O-HTTP-Content-Disposition",
|
||||||
|
input => \%urls,
|
||||||
|
cmdline => $cmdline,
|
||||||
|
errcode => $expected_error_code,
|
||||||
|
output => \%expected_downloaded_files);
|
||||||
|
exit $the_test->run();
|
||||||
|
|
||||||
|
# vim: et ts=4 sw=4
|
||||||
|
|
Loading…
Reference in New Issue
Block a user