You could deliver the file's content "dynamically", and do explicit line endings conversions yourself as required. For example, you could have a generic CGI script, which takes the file name as parameter (e.g. deliver_plain_text.pl?file=123.inp). The CGI would read the file, convert the line endings (s/\n/\r\n/), and write the result to stdout (which apache sends to the browser, as usual). If you don't want to have deliver_plain_text.pl appear in the URL, you could use mod_rewrite to do some rewriting magic for you... Also, you might want to apply some heuristics to detect whether the client actually is a Windows machine (e.g. by inspecting the User-Agent header), and only do line ending translations in that case.
Alternatively, you could try to add an Apache output filter for the appropriate type of files, using mod_mime's AddOutputFilter. I'm not aware of a ready-to-use apache filter for just that purpose, but - if performance is not a primary issue - you could use mod_ext_filter to pipe the content through a simple external program, which does s/\n/\r\n/ ...
In reply to Re: Downloading a Text file from a Unix server (Apace) using CGI
by almut
in thread Downloading a Text file from a Unix server (Apace) using CGI
by stumbler
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |