Domanda

I am serving a website from a fedora 17 server. This website allows the user to click and download from a list of files. When the user clicks to download a file however, a newline character (0A) is being appended. This changes the md5sum of the file.

HTML

<a href="download.psp?id={{obj.Id}}"/>

PSP

<%
import shared

filePath = shared.getFileFromId(req, form['id'])

req.sendfile(filePath)
%>

Using a redirect and direct apache download fixes this issue. But I need to be able to set the content-disposition filename.

This happens with windows and linux as the client. Also with firefox and chrome. The server is always fedora 17. This happens with text files and with binary files. Setting HTTP headers (so far) has not helped.

Any help is appreciated.

mod_python version 3.3.1-18
python version: 2.7.3
httpd version: 2.2.22-4

È stato utile?

Soluzione

Your PSP page is being evaluated, and the newline after your closing '>' is being sent after the results of sendfile. You could edit the file so the '>' is the last character or rewrite this as a plain Python script.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top