1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00

fixed 204 response handling, added new Test-204.px

This commit is contained in:
Tim Ruehsen 2014-04-22 13:06:00 +02:00 committed by Giuseppe Scrivano
parent 6c572cbc33
commit 848d7537e1
6 changed files with 63 additions and 0 deletions

View File

@ -1,3 +1,7 @@
2014-04-22 Tim Ruehsen <tim.ruehsen@gmx.de>
* http.c (gethttp): Fix 204 response handling
2014-03-26 Darshit Shah <darnir@gmail.com>
* ftp.c (getftp): Rearrange parameters to fix compiler warning

View File

@ -2618,6 +2618,22 @@ read_header:
if (H_20X (statcode))
*dt |= RETROKF;
if (statcode == HTTP_STATUS_NO_CONTENT)
{
/* 204 response has no body (RFC 2616, 4.3) */
/* In case the caller cares to look... */
hs->len = 0;
hs->res = 0;
hs->restval = 0;
CLOSE_FINISH (sock);
xfree_null (type);
xfree (head);
return RETRFINISHED;
}
/* Return if redirected. */
if (H_REDIRECTED (statcode) || statcode == HTTP_STATUS_MULTIPLE_CHOICES)
{

View File

@ -1,3 +1,9 @@
2014-40-22 Tim Ruehsen <tim.ruehsen@gmx.de>
* Test-204.px: added file
* run-px: added Test-204.px
* Makefile.am: added Test-204.px
2014-04-22 Giuseppe Scrivano <gscrivan@redhat.com>
* Makefile.am (EXTRA_DIST): Add missing Test--start-pos.px,

View File

@ -142,6 +142,7 @@ EXTRA_DIST = FTPServer.pm FTPTest.pm HTTPServer.pm HTTPTest.pm \
Test--start-pos.px \
Test--start-pos--continue.px \
Test--httpsonly-r.px \
Test-204.px \
run-px certs
check_PROGRAMS = unit-tests

35
tests/Test-204.px Normal file
View File

@ -0,0 +1,35 @@
#!/usr/bin/env perl
use strict;
use warnings;
use HTTPTest;
###############################################################################
# code, msg, headers, content
my %urls = (
'/dummy' => {
code => "204",
msg => "Dontcare",
},
);
my $cmdline = $WgetTest::WGETPATH . " http://localhost:{{port}}/dummy";
my $expected_error_code = 0;
my %expected_downloaded_files = (
);
###############################################################################
my $the_test = HTTPTest->new (name => "Test-204",
input => \%urls,
cmdline => $cmdline,
errcode => $expected_error_code,
output => \%expected_downloaded_files);
exit $the_test->run();
# vim: et ts=4 sw=4

View File

@ -91,6 +91,7 @@ my @tests = (
'Test--start-pos.px',
'Test-ftp--start-pos.px',
'Test--start-pos--continue.px',
'Test-204.px',
);
foreach my $var (qw(SYSTEM_WGETRC WGETRC)) {