You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Jonathon Veencamp <jd...@gmail.com> on 2010/02/09 20:31:59 UTC

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

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

and that didn't do it.  Then I tried
AddHandler type-map .log
AddHandler type-map .properties

and that was a no go.

I tried adding these to the mime.types file.

About all I can think of now is to process these files via a CGI script to
output them line by line with a <BR> if necessary, but that seems like
complete overkill.

Can anyone help?

TIA

Jon

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

Posted by Jeff Trawick <tr...@gmail.com>.
On Tue, Feb 9, 2010 at 3:29 PM, Jonathon Veencamp <jd...@gmail.com> wrote:
>
> Sorry about that.  1.1 doesn't work, but 1.0 did.
>
> beta1linux:/opt/local/logs/Websphere_7.0_logs/w70edu1 # telnet 127.0.0.1 80
> Trying 127.0.0.1...
> Connected to 127.0.0.1.
> Escape character is '^]'.
> GET
> /links/@_View_AppServer_Logs/@DEV_BETA_server_logs/Websphere_7.0_logs/w70edu1/test.log
> HTTP/1.0
> HTTP/1.1 200 OK
> Date: Tue, 09 Feb 2010 20:27:49 GMT
> Server: IBM_HTTP_Server/6.1 Apache/2.0.47 (Unix)
> Last-Modified: Tue, 09 Feb 2010 19:57:59 GMT
> Accept-Ranges: bytes
> Content-Length: 8
> Connection: close
> Content-Type: text/plain

The server is doing the right thing.  I believe the follow-up post
about the browser's mime configuration is on the right track.

---------------------------------------------------------------------
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>.
Sorry about that.  1.1 doesn't work, but 1.0 did.

beta1linux:/opt/local/logs/Websphere_7.0_logs/w70edu1 # telnet 127.0.0.1 80
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
GET
/links/@_View_AppServer_Logs/@DEV_BETA_server_logs/Websphere_7.0_logs/w70edu1/test.logHTTP/1.0
HTTP/1.1 200 OK
Date: Tue, 09 Feb 2010 20:27:49 GMT
Server: IBM_HTTP_Server/6.1 Apache/2.0.47 (Unix)
Last-Modified: Tue, 09 Feb 2010 19:57:59 GMT
Accept-Ranges: bytes
Content-Length: 8
Connection: close
Content-Type: text/plain
one
two
Connection closed by foreign host.



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

>
>
> You need to send a HTTP 1.0 or 1.1 request to see the Content-Type
> response header.
>
> ---------------------------------------------------------------------
> 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 Jeff Trawick <tr...@gmail.com>.
On Tue, Feb 9, 2010 at 3:16 PM, Jonathon Veencamp <jd...@gmail.com> wrote:
> Good suggestion Jeff, but it won't be instructive as the local end of line
> delimiter will be linux vs Windows
>
> beta1linux:/opt/local/logs/Websphere_7.0_logs/w70edu1 # telnet 127.0.0.1 80
> Trying 127.0.0.1...
> Connected to 127.0.0.1.
> Escape character is '^]'.
> GET
> /links/@_View_AppServer_Logs/@DEV_BETA_server_logs/Websphere_7.0_logs/w70edu1/test.log.txt
> one
> two
> Connection closed by foreign host.

You need to send a HTTP 1.0 or 1.1 request to see the Content-Type
response header.

---------------------------------------------------------------------
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>.
Good suggestion Jeff, but it won't be instructive as the local end of line
delimiter will be linux vs Windows

beta1linux:/opt/local/logs/Websphere_7.0_logs/w70edu1 # telnet 127.0.0.1 80
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
GET
/links/@_View_AppServer_Logs/@DEV_BETA_server_logs/Websphere_7.0_logs/w70edu1/test.log.txt
one
two
Connection closed by foreign host.
beta1linux:/opt/local/logs/Websphere_7.0_logs/w70edu1 # telnet 127.0.0.1 80
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
GET
/links/@_View_AppServer_Logs/@DEV_BETA_server_logs/Websphere_7.0_logs/w70edu1/test.log
one
two
Connection closed by foreign host.

So at least you can see how it displays on linux.  But what is more
significant is if it is sending a hex 0D 0A  (CR/LF) after each line, or
just a 0A.  In the case of .log files, the HTTP server is only sending a 0A
(LF).

Gosh, I can't be the only one that has ever tried to solve this problem!

Thanks for the replies and suggestions, I do appreciate your guys time.




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

> On Tue, Feb 9, 2010 at 2:51 PM, Jonathon Veencamp <jd...@gmail.com>
> wrote:
> > I don't think it's a poor editting thing.  I think this is the difference
> > between Unix and Windows and CR/LF on Windows versus LF on Linux.  The
> HTTP
> > server is adding CR/LF to .txt files to display them correctly in the
> > browser.
>
> no, Apache doesn't do that
>
> >                  But I can't get it to display .log files in the same
> manner.
>
> I dunno if because of some misunderstood config the "text/plain" isn't
> getting to the browser, or if the browser thinks its smarter than the
> server.
>
> Try this:
>
> create a very small .log file
>
> replace /example/small.log with the real request URI; if you're using
> name-based vhosts, replace 127.0.0.1 with your hostname
>
> C:\> telnet 127.0.0.1 80
> GET /example/small.log HTTP/1.1<enter>
> Host: 127.0.0.1<enter>
> <enter>
>
> See what is displayed for "Content-Type:" just prior to the contents
> of the log file.
>
> ---------------------------------------------------------------------
> 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 Jeff Trawick <tr...@gmail.com>.
On Tue, Feb 9, 2010 at 2:51 PM, Jonathon Veencamp <jd...@gmail.com> wrote:
> I don't think it's a poor editting thing.  I think this is the difference
> between Unix and Windows and CR/LF on Windows versus LF on Linux.  The HTTP
> server is adding CR/LF to .txt files to display them correctly in the
> browser.

no, Apache doesn't do that

>                  But I can't get it to display .log files in the same manner.

I dunno if because of some misunderstood config the "text/plain" isn't
getting to the browser, or if the browser thinks its smarter than the
server.

Try this:

create a very small .log file

replace /example/small.log with the real request URI; if you're using
name-based vhosts, replace 127.0.0.1 with your hostname

C:\> telnet 127.0.0.1 80
GET /example/small.log HTTP/1.1<enter>
Host: 127.0.0.1<enter>
<enter>

See what is displayed for "Content-Type:" just prior to the contents
of the log file.

---------------------------------------------------------------------
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 Daniel Reinhardt <cr...@cryptodan.net>.
--------------------------------------------------
From: "Jonathon Veencamp" <jd...@gmail.com>
Sent: 09 February, 2010 20:03
To: <us...@httpd.apache.org>
Subject: Re: [users@httpd] How to force CRLF on non .txt files when directory 
browsing?

> I'll quantify the problem a little better.  If I go on linux to the
> directory I am browsing via the HTTP server and issue these commands:
> # touch test.log
> # echo one >> test.log
> # echo two >> test.log
> # cp test.log test.log.txt
>
> If I use my brower to open test.log, it launches notepad on Windows which
> contains a single line:
> one two
>
> and this has a square character after each of the words.  Undisplayable
> character.  If I view this in a hex editor, it's just a LF.
>
> If I use my browser to open test.log.txt, then the browser displays
> one
> two
>
> And if I do a view source in the browser, then it is simple text with no
> tags. If I view this in a hex editor, it has a CR/LF.    So obviously the
> HTTP server is processing it differently.  What I want is for the server to
> treat .log files the same as it does .txt files.  But I'll be darned if I
> can find anyone else that tried to solve this same problem.  I've googled
> for hours on this.  Though maybe I'm a poor googler.  ;-)
>
> TIA
> Jon
> On Tue, Feb 9, 2010 at 1:51 PM, Jonathon Veencamp <jd...@gmail.com>wrote:
>
>> I don't think it's a poor editting thing.  I think this is the difference
>> between Unix and Windows and CR/LF on Windows versus LF on Linux.  The HTTP
>> server is adding CR/LF to .txt files to display them correctly in the
>> browser.  But I can't get it to display .log files in the same manner.
>>
>> Thanks both of you for the very quick replies.  This is my first question
>> via this list, and it was suprisingly fast response!
>>
>> Jon
>>   On Tue, Feb 9, 2010 at 1:40 PM, Daniel Reinhardt <
>> cryptodan@cryptodan.net> wrote:
>>
>>>
>>> --------------------------------------------------
>>> From: "Jonathon Veencamp" <jd...@gmail.com>
>>> Sent: 09 February, 2010 19:31
>>> To: <us...@httpd.apache.org>
>>> Subject: [users@httpd] How to force CRLF on non .txt files when directory
>>> browsing?
>>>
>>>
>>> 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
>>>>
>>>> and that didn't do it.  Then I tried
>>>> AddHandler type-map .log
>>>> AddHandler type-map .properties
>>>>
>>>> and that was a no go.
>>>>
>>>> I tried adding these to the mime.types file.
>>>>
>>>> About all I can think of now is to process these files via a CGI script
>>>> to
>>>> output them line by line with a <BR> if necessary, but that seems like
>>>> complete overkill.
>>>>
>>>> Can anyone help?
>>>>
>>>> TIA
>>>>
>>>> Jon
>>>>
>>>>
>>> Jon,
>>>
>>> I think what you are experiencing is poor editing or formatting of the log
>>> files when they were saved, are these log files created and then placed in a
>>> file?  Or are they stored in the directory you currently have them?
>>>
>>> Thanks,
>>> Dan
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>>
>>>
>>
>

Jon,

Then move the log files to a txt document.  It is asking you to open notepad, 
because your browser doesn't know how to handle *.log extensions.  Its something 
to do with how the browser sees the octet stream and application type via 
mime.types I think.  I am no expert, but I am only speculating on why this 
happens.

Thanks,
Daniel 


---------------------------------------------------------------------
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>.
I'll quantify the problem a little better.  If I go on linux to the
directory I am browsing via the HTTP server and issue these commands:
# touch test.log
# echo one >> test.log
# echo two >> test.log
# cp test.log test.log.txt

If I use my brower to open test.log, it launches notepad on Windows which
contains a single line:
one two

and this has a square character after each of the words.  Undisplayable
character.  If I view this in a hex editor, it's just a LF.

If I use my browser to open test.log.txt, then the browser displays
one
two

And if I do a view source in the browser, then it is simple text with no
tags. If I view this in a hex editor, it has a CR/LF.    So obviously the
HTTP server is processing it differently.  What I want is for the server to
treat .log files the same as it does .txt files.  But I'll be darned if I
can find anyone else that tried to solve this same problem.  I've googled
for hours on this.  Though maybe I'm a poor googler.  ;-)

TIA
Jon
On Tue, Feb 9, 2010 at 1:51 PM, Jonathon Veencamp <jd...@gmail.com>wrote:

> I don't think it's a poor editting thing.  I think this is the difference
> between Unix and Windows and CR/LF on Windows versus LF on Linux.  The HTTP
> server is adding CR/LF to .txt files to display them correctly in the
> browser.  But I can't get it to display .log files in the same manner.
>
> Thanks both of you for the very quick replies.  This is my first question
> via this list, and it was suprisingly fast response!
>
> Jon
>   On Tue, Feb 9, 2010 at 1:40 PM, Daniel Reinhardt <
> cryptodan@cryptodan.net> wrote:
>
>>
>> --------------------------------------------------
>> From: "Jonathon Veencamp" <jd...@gmail.com>
>> Sent: 09 February, 2010 19:31
>> To: <us...@httpd.apache.org>
>> Subject: [users@httpd] How to force CRLF on non .txt files when directory
>> browsing?
>>
>>
>> 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
>>>
>>> and that didn't do it.  Then I tried
>>> AddHandler type-map .log
>>> AddHandler type-map .properties
>>>
>>> and that was a no go.
>>>
>>> I tried adding these to the mime.types file.
>>>
>>> About all I can think of now is to process these files via a CGI script
>>> to
>>> output them line by line with a <BR> if necessary, but that seems like
>>> complete overkill.
>>>
>>> Can anyone help?
>>>
>>> TIA
>>>
>>> Jon
>>>
>>>
>> Jon,
>>
>> I think what you are experiencing is poor editing or formatting of the log
>> files when they were saved, are these log files created and then placed in a
>> file?  Or are they stored in the directory you currently have them?
>>
>> Thanks,
>> Dan
>>
>> ---------------------------------------------------------------------
>> 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 Eric Covener <co...@gmail.com>.
On Fri, Feb 12, 2010 at 4:48 AM, Philip Wigg <ph...@philipwigg.co.uk> wrote:
> I think this is probably a Windows thing and not to do with the web
> server configuration at all. Internet Explorer seems to go through
> quite a complex process to decide what to do with specific file
> extensions that doesn't just rely on the Content-type header sent by
> the server.

> http://msdn.microsoft.com/en-us/library/ms775148(VS.85).aspx

Setting a Content-Disposition with an alt filename (and who knows what
else) is probably a good thing to try.

-- 
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
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 Philip Wigg <ph...@philipwigg.co.uk>.
On 9 February 2010 19:51, Jonathon Veencamp <jd...@gmail.com> wrote:
> I don't think it's a poor editting thing.  I think this is the difference
> between Unix and Windows and CR/LF on Windows versus LF on Linux.  The HTTP
> server is adding CR/LF to .txt files to display them correctly in the
> browser.  But I can't get it to display .log files in the same manner.

I think this is probably a Windows thing and not to do with the web
server configuration at all. Internet Explorer seems to go through
quite a complex process to decide what to do with specific file
extensions that doesn't just rely on the Content-type header sent by
the server.

http://msdn.microsoft.com/en-us/library/ms775148(VS.85).aspx

You could always do some horrendous hack like so...

# Externally rewrite .log files to .log.txt
RewriteEngine On
RewriteCond %{REQUEST_URI} \.log$
RewriteRule (.*) $1.txt [L,R]

# And internally rewrite them back again, thus fooling IE.
RewriteCond %{REQUEST_URI} \.log\.txt$
RewriteRule (.*)\.txt$ $1 [L]

Cheers,
Phil.

---------------------------------------------------------------------
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>.
I don't think it's a poor editting thing.  I think this is the difference
between Unix and Windows and CR/LF on Windows versus LF on Linux.  The HTTP
server is adding CR/LF to .txt files to display them correctly in the
browser.  But I can't get it to display .log files in the same manner.

Thanks both of you for the very quick replies.  This is my first question
via this list, and it was suprisingly fast response!

Jon
On Tue, Feb 9, 2010 at 1:40 PM, Daniel Reinhardt <cr...@cryptodan.net>wrote:

>
> --------------------------------------------------
> From: "Jonathon Veencamp" <jd...@gmail.com>
> Sent: 09 February, 2010 19:31
> To: <us...@httpd.apache.org>
> Subject: [users@httpd] How to force CRLF on non .txt files when directory
> browsing?
>
>
> 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
>>
>> and that didn't do it.  Then I tried
>> AddHandler type-map .log
>> AddHandler type-map .properties
>>
>> and that was a no go.
>>
>> I tried adding these to the mime.types file.
>>
>> About all I can think of now is to process these files via a CGI script to
>> output them line by line with a <BR> if necessary, but that seems like
>> complete overkill.
>>
>> Can anyone help?
>>
>> TIA
>>
>> Jon
>>
>>
> Jon,
>
> I think what you are experiencing is poor editing or formatting of the log
> files when they were saved, are these log files created and then placed in a
> file?  Or are they stored in the directory you currently have them?
>
> Thanks,
> Dan
>
> ---------------------------------------------------------------------
> 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 Daniel Reinhardt <cr...@cryptodan.net>.
--------------------------------------------------
From: "Jonathon Veencamp" <jd...@gmail.com>
Sent: 09 February, 2010 19:31
To: <us...@httpd.apache.org>
Subject: [users@httpd] How to force CRLF on non .txt files when directory 
browsing?

> 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
>
> and that didn't do it.  Then I tried
> AddHandler type-map .log
> AddHandler type-map .properties
>
> and that was a no go.
>
> I tried adding these to the mime.types file.
>
> About all I can think of now is to process these files via a CGI script to
> output them line by line with a <BR> if necessary, but that seems like
> complete overkill.
>
> Can anyone help?
>
> TIA
>
> Jon
>

Jon,

I think what you are experiencing is poor editing or formatting of the log files 
when they were saved, are these log files created and then placed in a file?  Or 
are they stored in the directory you currently have them?

Thanks,
Dan 


---------------------------------------------------------------------
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
>
>

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

Posted by Jeff Trawick <tr...@gmail.com>.
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