Bug #1970

mod_fastcgi.c x-send-file sets incorrect Content-Length on 2GB+ files

Added by DaGoodBoy over 5 years ago. Updated over 5 years ago.

Status:FixedStart date:2009-04-28
Priority:NormalDue date:
Assignee:-% Done:

100%

Category:mod_fastcgi
Target version:1.4.23
Missing in 1.5.x:

Description

Running Debian Lenny and the stock lighttpd 1.4.19.

When transferring large files (>2GB) using x-send-file, the Content-Length header sends the incorrect file size that results in truncated files. In mod_fastcgi.c at around line 2558 you will see this:

buffer_copy_long(dcls->value, sce->st.st_size);

Changing this line to something like this fixes the issue:

char len_str[BUFSIZ];
sprintf(len_str,"%llu",sce->st.st_size);
buffer_copy_string(dcls->value, len_str);

Thanks for writing lighttpd!

Associated revisions

Revision 2494
Added by stbuehler over 5 years ago

Fix x-sendfile 2gb limiting (fixes #1970)

History

#1 Updated by icy over 5 years ago

  • Target version changed from 1.4.19 to 1.4.23

Target version != affected version. That being said: it should probably be changed to buffer_copy_off_t().
Thanks for reporting.

#2 Updated by stbuehler over 5 years ago

  • Status changed from New to Fixed
  • % Done changed from 0 to 100

Applied in changeset r2494.

Also available in: Atom