You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Jeff Trawick <tr...@gmail.com> on 2010/02/09 20:39:56 UTC

Re: [users@httpd] How to force CRLF on non .txt files when directory browsing?

On Tue, Feb 9, 2010 at 2:31 PM, Jonathon Veencamp <jd...@gmail.com> wrote:
> Hello,
>
> I've beat my head on this wall far too long, and googled the heck out of it,
> so I'll ask the mailing list on what should be a simple problem.
>
> I have some text files on a linux host with .log and .properties
> extensions.  When these are sent to a windows browser, they do not have
> CR/LF and so each line wraps to the next and they don't format well in the
> browser.  I would like to have the Apache HTTP server treat these the same
> as .txt files, but I've been unable to find the configuration I need to
> change.
>
> I tried adding
> AddType text/html .log
> AddType text/html .properties

text/plain

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] How to force CRLF on non .txt files when directory browsing?

Posted by Nick Kew <ni...@webthing.com>.
On Tue, 9 Feb 2010 13:47:25 -0600
Jonathon Veencamp <jd...@gmail.com> wrote:


> But if I rename the file to *.log.txt, then the HTTP server and browser
> handles it correctly.  So the HTTP server is doing something different
> natively with .txt files

No, the server does nothing with the files, unless you (actively)
configure it to do something.  There's no FTP-style text-vs-binary
in HTTP.

Sounds more like IE is doing something different based on name.
This is probably the same bug that let in a generation of Outlook
viruses, as described in the MIME RFCs going back to 1992.
Offering them at a .txt URL may be the best fix for broken
so-called browsers.

You could also use mod_txt with apache to convert to HTML
formatted to appear as your original text.

-- 
Nick Kew

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] How to force CRLF on non .txt files when directory browsing?

Posted by Jonathon Veencamp <jd...@gmail.com>.
Tried that in my conf/httpd.conf file.  And restarted the server.
AddType text/plain .log
AddType text/plain .properties

As I understand, it informs the browser what to do with it.  And that's
good.  But I think this is a server side problem.  It still isn't using the
Windows convention of CR/LF.  It's like FTPing the file using binary versus
as text.  When I FTP it with text, I get the CR/LF.  Binary and it wraps.
In this case, the HTTP server seems to be doing a binary transfer of the
file.  I want it to treat it as text.

But if I rename the file to *.log.txt, then the HTTP server and browser
handles it correctly.  So the HTTP server is doing something different
natively with .txt files

Thanks.

On Tue, Feb 9, 2010 at 1:39 PM, Jeff Trawick <tr...@gmail.com> wrote:

> On Tue, Feb 9, 2010 at 2:31 PM, Jonathon Veencamp <jd...@gmail.com>
> wrote:
> > Hello,
> >
> > I've beat my head on this wall far too long, and googled the heck out of
> it,
> > so I'll ask the mailing list on what should be a simple problem.
> >
> > I have some text files on a linux host with .log and .properties
> > extensions.  When these are sent to a windows browser, they do not have
> > CR/LF and so each line wraps to the next and they don't format well in
> the
> > browser.  I would like to have the Apache HTTP server treat these the
> same
> > as .txt files, but I've been unable to find the configuration I need to
> > change.
> >
> > I tried adding
> > AddType text/html .log
> > AddType text/html .properties
>
> text/plain
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>