Skip to content

webrepl: send Content-Type: text/html for index#1076

Open
allisonkarlitskaya wants to merge 1 commit intomicropython:masterfrom
allisonkarlitskaya:webrepl-content-type
Open

webrepl: send Content-Type: text/html for index#1076
allisonkarlitskaya wants to merge 1 commit intomicropython:masterfrom
allisonkarlitskaya:webrepl-content-type

Conversation

@allisonkarlitskaya
Copy link
Copy Markdown

If we don't do this then Firefox incorrectly guesses text/plain and just shows the source. Adding the Content-Type: fixes the issue.

@allisonkarlitskaya allisonkarlitskaya force-pushed the webrepl-content-type branch 2 times, most recently from 40bd13f to fa45c55 Compare January 21, 2026 18:55
@allisonkarlitskaya
Copy link
Copy Markdown
Author

friendly nudge

Copy link
Copy Markdown
Contributor

@Josverl Josverl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I support adding the header as IAFAIK it is actually required according the the current HTML specs , but other browsers have implemented content sniffing when it is absent.

cl.send(
b"""\
HTTP/1.0 200 OK\r
Content-Type: text/html\r
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be requirement based on Firefox's strict MIME compliance
If we are adding this tt would make sense to also explicitly add the encoding
Content-Type: text/html; charset=utf-8
Possible in a separate commit.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed as requested!

If we don't do this then Firefox incorrectly guesses text/plain and
just shows the source.  Adding the Content-Type: fixes the issue.

Signed-off-by: Allison Karlitskaya <allison.karlitskaya@redhat.com>
@allisonkarlitskaya
Copy link
Copy Markdown
Author

allisonkarlitskaya commented Mar 30, 2026

Thanks for the review! I'm unable to merge this for myself

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants