Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Firefox: all I get is XML page source code

1 view
Skip to first unread message

Gnarlodious

unread,
Apr 18, 2010, 4:50:20 PM4/18/10
to
Wit's end on this. I have a script outputting a stream with:
sys.stdout.buffer.write(("""\n<?xml version='1.0' encoding='utf-8'?>

The script works normally in 2 browsers, but in Firefox all I see is
source code.

Also, running the script in iPhone from my server shows the same
source code. Which is a little strange since iPhone and Safari both
use Webkit. This occurs also on my home dev server.

I attempted to validate the output but all I get is error:


Sorry, I am unable to validate this document because its content type
is text/plain, which is not currently supported by this service.
The Content-Type header is sent by your web server (or web browser if
you use the file upload interface) and depends on its configuration.
Commonly, web servers will have a mapping of filename extensions (such
as ".html") to MIME Content-Type values (such as text/html).
That you received this message can mean that your server is not
configured correctly, that your file does not have the correct
filename extension, or that you are attempting to validate a file type
that we do not support yet.


Is the output stream not recognized because of the
sys.stdout.buffer.write statement?

This is a Python3 script ending with .py. Server is Apache 2. Hope
someone can explain.

-- Gnarlie

Message has been deleted

Gnarlodious

unread,
Apr 18, 2010, 6:10:12 PM4/18/10
to
Thanks for that, for some reason I assumed sys.stdout.buffer.write
sent the http header but I was wrong.

Even so, Firefox still refused to render prperly, but this works/:

content-type: application/xhtml+xml; charset=utf-8\n\n

-- Gnarlie

MRAB

unread,
Apr 18, 2010, 7:12:58 PM4/18/10
to pytho...@python.org
Perhaps it's not so much that there's a problem with Firefox but that
the other browsers are guessing what the content type should be if it's
missing. (Refusing to guess is a Pythonic trait. :-))
Message has been deleted
0 new messages