www-apache-bugdb mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Hawthorne <hawth...@cs.ubc.ca>
Subject mod_negotiation/1452: Failure of binary file downloads
Date Fri, 21 Nov 1997 20:56:46 GMT

>Number:         1452
>Category:       mod_negotiation
>Synopsis:       Failure of binary file downloads
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    apache
>State:          open
>Class:          sw-bug
>Submitter-Id:   apache
>Arrival-Date:   Fri Nov 21 14:10:00 PST 1997
>Last-Modified:
>Originator:     hawthorn@cs.ubc.ca
>Organization:
apache
>Release:        1.3b2
>Environment:
WinNT, Netscape Navigator Gold 3.01
>Description:
I am using the following perl (5.0) code to cause a file to be downloaded
via a CGI script:

    print "Content-Type: application/unknown\n";
    print "Content-Disposition: attachment; filename=$file\n\n";

    open(DOWNLOAD, $file);
    while($bytes = <DOWNLOAD>) {
        print STDOUT $bytes;
    }
    close DOWNLOAD;
  
I have also tried using read() and sysread()/syswrite() versions of the code.
1. Text files lose a character for each CRLF.
2. Binary files abort/fail/finish when they encounter ^Z (ascii 26).
>How-To-Repeat:
Download any file using similar code.  
>Fix:
1. Text files: set DOWNLOAD to binary mode transfer and STDOUT to ascii mode transfer.
   i.e. use "binmode DOWNLOAD;" after the open() command.
2. Binary files: nothing works..
>Audit-Trail:
>Unformatted:
[In order for any reply to be added to the PR database, ]
[you need to include <apbugs@Apache.Org> in the Cc line ]
[and leave the subject line UNCHANGED.  This is not done]
[automatically because of the potential for mail loops. ]




Mime
View raw message