Howto force text type of dir/subdir/file?

Patrick Lists nginx-list at puzzled.xs4all.nl
Thu May 30 00:27:00 UTC 2013


Hi Francis,

On 05/30/2013 12:37 AM, Francis Daly wrote:
> On Wed, May 29, 2013 at 04:35:03PM +0200, Patrick Lists wrote:
>
> Hi there,
[snip]
>
> What does
>
>    curl -I https://<domain>/doc/postfix-2.6.6/README_FILES/AAAREADME
>
> show as the Content-Type?
>
> If it is "text/plain", your nginx is doing what you told it to do.

Yup seems so:

HTTP/1.1 200 OK
Server: nginx
Date: Thu, 30 May 2013 00:23:22 GMT
Content-Type: text/plain
Content-Length: 2768
Last-Modified: Sat, 03 Dec 2011 05:00:55 GMT
Connection: keep-alive
Keep-Alive: timeout=10
ETag: "4ed9ad07-ad0"
X-Frame-Options: SAMEORIGIN
Accept-Ranges: bytes


> Strictly, I suspect that the file is not text/plain, since the control
> characters are not normally printable.
>
> So Firefox is probably right to indicate that it is unable to present
> the file contents correctly, since they do not match the declared type.
>
>> # file AAAREADME
>> AAAREADME: ASCII text, with overstriking
>
> I've just tested on a different server, using a file which "file"
> identifies in that same way. The Content-Type: header is text/plain.
>
>> Anyone have a hint what I am doing wrong?
>
> My guess is: claiming that a non-text/plain file is text/plain. nginx
> doesn't care; it just does what it is told. Firefox does care.
>
> The simplest thing is probably for you to edit the file to make it be
> text/plain. And do the same for any other similar file.
>
> "overstriking" is usually having the three character sequence X ^H X
> instead of the single X. So remove the ^H and one X each time, and you
> should have a real text/plain file.
>
> And perhaps invite whoever put the file there to only use plain text in
> the next version of the package.

Understand now, thanks. To me it was just a text file like the other 
real ones. It's the postfix documentation that has the overstrike 
thingy. I doubt Wietse is going to change that anytime soon. No biggie 
though. The postfix website has all the docs too.

Cheers,
Patrick



More information about the nginx mailing list