Hello everyone,

Apache 2.0.40
PHP 4.2.2
Linux

I have a single php script for downloading requested files.  It works
beautifully on http over port 80.  It does NOT work at all over https on
port 443.  I am using the exact same script (the very same file) for both
http and https connections.  Apache has the +StdEnvVars enabled for all
files and dirs under the https site.  Forms and cookies are working
normally, as are redirect headers.  But for some reason, the headers for
file downlaods are not working at all over ssl.

I am really only testing this with IE 6 right now.

What am I missing? What else can I check for?

---- d.php ----
function d() {
        $fsp = '/mydir/myfile.exe';
        $mimetype='application/octect-stream'; $encoding='binary';
        
        //echo basename($fsp).filesize($fsp); return;

        //header('Location: https://my.site.com/');

        header('Content-Type: '.$mimetype);
        header('Content-Length: '.filesize($fsp));
        header('Content-Disposition: attachment;
filename="'.basename($fsp).'"');
        header('Content-Transfer-Encoding: '.$encoding);
        readfile($fsp);
        
        return;
} // end d()

d();
---- d.php ----


I call this only after a user clicks a link on a second page. Uncommenting
the line starting with echo out puts the expected basename and filesize.
Uncommenting the line starting with header successfully redirects to the
correct url.  Leaving both the above lines commented, the user is prompted
with a open / save dialog but the filename showing is now the script name,
the filesize is missing, and clicking open or save shows a file tansfer
window that does nothing.

I have also tried testing this script with curl on linux.  Here's the
output.  I noticed the Content-Length header is missing!


---- curl output ----
[EMAIL PROTECTED] curl https://my.site.com/d.php --head
HTTP/1.1 200 OK
Date: Wed, 18 Jun 2003 18:45:24 GMT
Server: Apache/2.0.40 (Red Hat Linux)
Accept-Ranges: bytes
X-Powered-By: PHP/4.2.2
Set-Cookie: PHPSESSID=ca805f9f0318a53e72abacf6db8fa677; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0,
pre-check=0
Pragma: no-cache
Content-Disposition: attachment; filename="myfile.exe"
Content-Transfer-Encoding: binary
Connection: close
Content-Type: application/octect-stream

---- curl output ----


What's going on here?  Thanks in advance for any help you can offer!!


Henning Sittler
www.inscriber.com


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to