mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
Returh 416 for fully-retrieved resources.
This commit is contained in:
parent
e17633e99c
commit
26df273522
@ -1,12 +1,19 @@
|
||||
2008-05-31 Micah Cowan <micah@cowan.name>
|
||||
|
||||
* Test-N-current.px: Ensure we catch failures.
|
||||
|
||||
* Test-N-old.px: Make it test only the timestamp, and not the
|
||||
content length in addition.
|
||||
|
||||
* Test-N-smaller.px: added.
|
||||
|
||||
* Test-N-no-info.px: added.
|
||||
|
||||
* run-px: Added Test-N-smaller.px, Test-N-no-info.px.
|
||||
|
||||
* HTTPServer.pm: Return 416 for fully-retrieved content, rather
|
||||
than 206 with a zero content-length.
|
||||
|
||||
2008-05-23 Micah Cowan <micah@cowan.name>
|
||||
|
||||
* Test--spider.px: Make test expect 0 return code.
|
||||
|
@ -98,15 +98,25 @@ sub send_response {
|
||||
my $start = $1 ? $1 : 0;
|
||||
my $end = $2 ? $2 : ($content_len - 1);
|
||||
my $len = $2 ? ($2 - $start) : ($content_len - $start);
|
||||
$resp->header("Accept-Ranges" => "bytes");
|
||||
$resp->header("Content-Length" => $len);
|
||||
$resp->header("Content-Range" => "bytes $start-$end/$content_len");
|
||||
$resp->header("Keep-Alive" => "timeout=15, max=100");
|
||||
$resp->header("Connection" => "Keep-Alive");
|
||||
$con->send_basic_header(206, "Partial Content", $resp->protocol);
|
||||
print $con $resp->headers_as_string($CRLF);
|
||||
print $con $CRLF;
|
||||
print $con substr($content, $start, $len);
|
||||
if ($len) {
|
||||
$resp->header("Accept-Ranges" => "bytes");
|
||||
$resp->header("Content-Length" => $len);
|
||||
$resp->header("Content-Range"
|
||||
=> "bytes $start-$end/$content_len");
|
||||
$resp->header("Keep-Alive" => "timeout=15, max=100");
|
||||
$resp->header("Connection" => "Keep-Alive");
|
||||
$con->send_basic_header(206,
|
||||
"Partial Content", $resp->protocol);
|
||||
print $con $resp->headers_as_string($CRLF);
|
||||
print $con $CRLF;
|
||||
print $con substr($content, $start, $len);
|
||||
} else {
|
||||
$con->send_basic_header(416, "Range Not Satisfiable",
|
||||
$resp->protocol);
|
||||
$resp->header("Keep-Alive" => "timeout=15, max=100");
|
||||
$resp->header("Connection" => "Keep-Alive");
|
||||
print $con $CRLF;
|
||||
}
|
||||
next;
|
||||
}
|
||||
# fill in content
|
||||
|
Loading…
Reference in New Issue
Block a user