Package: gnump3d
Version: 3.0-4
Severity: important


GnuMP3d reports a bad content-length to the http client. That makes some
clients try to resume the download.

Example:

   $ ls -l music.mp3
=> -rw-r--r-- 1 glenux glenux 6257859 aoĆ»  1  2005   music.mp3
a 
   $ wget http://localhost:8888/music.mp3
   --2008-05-16 16:06:17--  http://localhost:8888/music.mp3
   Resolving localhost... 127.0.0.1
   Connecting to localhost|127.0.0.1|:8888... connected.
   HTTP request sent, awaiting response... 200 OK
=> Length: 6257860 (6.0M) [audio/mpeg]
b   Saving to: `music.mp3'

   99% [=========================================================> ] 6,257,859  
  111K/s   in 57s

=> 2008-05-16 16:07:16 (107 KB/s) - Connection closed at byte 6257859. Retrying.
c 
   --2008-05-16 16:07:17--  (try: 2)  http://localhost:8888/music.mp3
   Connecting to localhost|127.0.0.1|:8888... connected.
   HTTP request sent, awaiting response... 206 OK
   Length: 6257860 (6.0M), 1 remaining [audio/mpeg]
   Saving to: `music.mp3'

   99% [++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ] 6,257,859  
 --.-K/s   in 0s

   [...]

We clearly see the differences between the reported file length
in a), b) and c).


See attached patch for the fix.

Best regards,
Glenn.

-- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (500, 'stable'), (1, 
'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.22.19-vs2.2.0.7 (PREEMPT)
Locale: [EMAIL PROTECTED], [EMAIL PROTECTED] (charmap=UTF-8) (ignored: LC_ALL 
set to fr_FR.UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages gnump3d depends on:
ii  adduser                       3.107      add and remove users and groups
ii  debconf                       1.5.21     Debian configuration management sy
ii  logrotate                     3.7.1-3    Log rotation utility
ii  netbase                       4.32       Basic TCP/IP networking system
ii  perl                          5.8.8-12   Larry Wall's Practical Extraction 
ii  perl-modules                  5.8.8-12   Core Perl modules

gnump3d recommends no packages.

-- debconf information:
  gnump3d/user: gnump3d
  gnump3d/root: /var/music
  gnump3d/port: 8888
diff -Nur gnump3d-3.0/bin/gnump3d2 gnump3d-3.0.fix/bin/gnump3d2
--- gnump3d-3.0/bin/gnump3d2    2008-05-16 15:57:31.000000000 +0200
+++ gnump3d-3.0.fix/bin/gnump3d2        2008-05-16 16:36:57.000000000 +0200
@@ -1319,11 +1319,12 @@
        $mtime = gmtime $mtime;
        my ($day, $mon, $dm, $tm, $yr) =
            ($mtime =~ m/(...) (...) (..) (..:..:..) (....)/);
+       my $last_byte_pos = $length - 1;
 
        # matt: handle partial content
        if (!$extra->{NoContentLength}) {
-           $header .= "Content-Range: bytes $range-$length/$length\n";
-           $length -= $range;
+           $header .= "Content-Range: bytes $range-$last_byte_pos/$length\n";
+           $length -= ($range + 1);
            $header .= "Content-length: $length\n";
        }
        $header .= "Last-Modified: $day, $dm $mon $yr $tm GMT\n";

Reply via email to