Open
Bug 1494932
Opened 7 years ago
Updated 3 years ago
Lack of Content-Type makes Firefox not treat content as HTML
Categories
(Core :: Networking: HTTP, defect, P3)
Core
Networking: HTTP
Tracking
()
UNCONFIRMED
People
(Reporter: rohit.beohar87, Unassigned)
Details
(Whiteboard: [necko-triaged])
User Agent: Mozilla/5.0 (Linux; Android 7.0; SAMSUNG SM-J730GM Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/7.4 Chrome/59.0.3071.125 Mobile Safari/537.36
Steps to reproduce:
Hi,
When i am trying to open web page from my local server with default http or https port 80 or 443 firefox is opening properly but when i change port to some different port firefox is not opening webpage it is opening soruce code.Can anynod has idea about this?
Actual results:
Source code display
Expected results:
Html page should open
Comment 1•7 years ago
|
||
It's very likely that your server sends the content with a text/plain content type instead of text/html.
Please check that with the included developer tools in Firefox -> F12
Flags: needinfo?(rohit.beohar87)
Hi,
Pageinfo is showing plain/text in other port but it is showing plain/html in port 80 or 443 .And also in other browser it is opening properly.
In tcpmdump also content type is html.Is there any defsult seting that i can set in firefox to decod page always as webpage?
Flags: needinfo?(rohit.beohar87)
Comment 3•7 years ago
|
||
You can't change the (correct) behavior of Firefox.
Other browser may incorrectly use browser-sniffing and override the text/plain with text/html or they get a different content-type delivered from your server.
>In tcpmdump also content type is html
Does that mean that your server sends text/html to Firefox but it still renders it as text/plain ?
To see the content type:
1)open a new, empty tab
2) press F12 to open the developer console
3) click on network at the top of the networking console
4) load your page that get rendered as text in that tab
5) the networking tools should show you loaded documents, click on the "Get" with the document that loaded as text
6) look at the response header at the right. This are the html headers send by the server to Firefox.
7) it should show "Content-Type text/html"
Hi,
When use default 80 http port or https 443 it open as html but if port is change it is not opening.
Component: Untriaged → File Handling
Comment 5•7 years ago
|
||
(In reply to R from comment #4)
> When use default 80 http port or https 443 it open as html but if port is
> change it is not opening.
Yes but it looks that this is no Firefox bug but rather a server bug or it's some stupid security/Anti virus software on your system.
Firefox doesn't care from which port you serve him content -> http://matti.port0.org:666
You can even serve Firefox https content on Port 80 if you specify the protocol.
Please do this:
1) open a new window in Firefox
2) press F12 to open the developer tools
3) click on Network on the top of the developer tools
4) load your page in that window with a port that is not "working"
5) click on the GET request with the file "/" in the developer tools section
6) click on "headers" at the right
7) click on "Raw headers" right of "status code"
8) mark and copy the whole content of "Response headers" box and paste it here as comment
Flags: needinfo?(rohit.beohar87)
Hi,
My problem is that in all other browser it is working.If it a server issue it should come in all browser.And also with port 80 it is working with firefox also.
So when data comes to 80 port will it treat it as html without checking any content type?
BR
ROHIT
Flags: needinfo?(rohit.beohar87)
Comment 7•7 years ago
|
||
>My problem is that in all other browser it is working.If it a server issue it should come in all browser
Other browser may do content sniffing and it may work with them. I do not exactly know what other browser do.
>So when data comes to 80 port will it treat it as html without checking any content type?
No, Firefox will always look at the content-type as far as I know.
http/0.9 is a different because it's specified without headers but I do not know if we still support that.
My guess why you get a different behavior depending on the port is that your server just sends different content-types based on the port.
That is the reason why I ask you that you post me the http headers that your server sends.
Easy question but I do not get an answer.
There is no content type for any acase.It just a raw data but port 80 decode it as html page.
Br
Rohit
Comment 9•7 years ago
|
||
no content-type means http/0.9
Component: File Handling → Networking: HTTP
Product: Firefox → Core
| Reporter | ||
Comment 10•7 years ago
|
||
Hi,
What this means ?
File handling?which you have mention in your comment?
Which version of firefox support http 0.9 as you mentioned in your comment?latest firefo version doesndoesnt support this?
Summary: Firefox not opening localweb page → HTTP/0.9 makes Firefox not treat content as HTML
Comment 11•7 years ago
|
||
HTTP/0.9 is very crude and bad way to do HTTP. I would strongly urge you to instead send a proper HTTP/1.1 (at least) response and tell the browser correctly about the type of the contents.
Priority: -- → P3
Whiteboard: [necko-triaged]
| Reporter | ||
Comment 12•7 years ago
|
||
Its not http 0.9 ,and also port 80 and any other port content type is same.But port 80 is decoding properly.Whether firefox have some handling that if there is no content type if data receive in port 80 it will be html.My problem is that why it is working in port 80.There is no firewall issue i tried as localhost.
Summary: HTTP/0.9 makes Firefox not treat content as HTML → Lack of Content-Type makes Firefox not treat content as HTML
Comment 13•7 years ago
|
||
I cannot reproduce this.
I tried Firefox 62 and Nightly 64 (on Linux) on localhost:8080 and localhost:8081 serving this exact response and it shows up as a rendered web page in all four of my test runs.
---- snip ----
HTTP/1.1 200 OK
Connection: close
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Silly test!</title>
</head>
<body>
HTML <b>yes</b>
</body>
</html>
---- snip ----
| Reporter | ||
Comment 14•7 years ago
|
||
Hi,
It seems there is some issue in firefox.
A html page send as a stream of data is able to decode html page and able to send get request if page contains js ,html etc.in case of port 80.
But when port is change firrfox is not able to send get request for page content.
You can simulate this issue by sending stream of html page in 80 port without seting content type and change port other than 80.
Comment 15•7 years ago
|
||
I don't understand. If you read comment 13 you see that I tried to repro this issue using two different Firefox versions on two different TCP ports (none on port 80). What do I need to modify in my setup to reproduce this problem?
| Reporter | ||
Comment 16•7 years ago
|
||
Dont set the header just stream the html page containing one more frame of html page.the check the difference in port 80 it will work but not in other port.
Comment 17•7 years ago
|
||
> Dont set the header
What header? My test case didn't set any content-type header, which is what you've said is the problem.
If we remove all headers we're back to HTTP/0.9 which you said you didn't use!
| Reporter | ||
Comment 18•7 years ago
|
||
It will work with port 80 without seting any header in all firefox version.you test you will come to know if you change port it will not work.
Comment 19•7 years ago
|
||
Please show me a full and complete HTTP response that reproduces this.
| Reporter | ||
Comment 20•7 years ago
|
||
Its a simple web page without header setting 80 port it is decoding it as html but other port it is decoding as 80.
I have attached snaphsot in mail.
Updated•3 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•