mirror of
https://github.com/weiss/ngx_http_upload.git
synced 2026-02-22 10:37:49 +00:00
Add Content-Length header field
Clients might expect a Content-Length header field for HEAD responses. Including this header field also allows the use of byte ranges (and disables the use of chunked transfer encoding for the GET response).
This commit is contained in:
@@ -64,6 +64,7 @@ sub handle_get_or_head {
|
|||||||
my $file_path = safe_filename($r);
|
my $file_path = safe_filename($r);
|
||||||
|
|
||||||
if (-r $file_path and -f _) {
|
if (-r $file_path and -f _) {
|
||||||
|
$r->header_out('Content-Length', -s _);
|
||||||
$r->allow_ranges;
|
$r->allow_ranges;
|
||||||
$r->send_http_header;
|
$r->send_http_header;
|
||||||
$r->sendfile($file_path) unless $r->header_only;
|
$r->sendfile($file_path) unless $r->header_only;
|
||||||
|
|||||||
Reference in New Issue
Block a user