Open
Bug 979822
Opened 12 years ago
Updated 3 years ago
Unexpected behaviour with mailto URI in Location header
Categories
(Core :: Networking: HTTP, defect, P5)
Tracking
()
NEW
People
(Reporter: lars, Unassigned)
Details
(Whiteboard: [bugday-20140310][necko-would-take])
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.117 Safari/537.36
Steps to reproduce:
1. I setup a webserver with the following two responses:
$ curl http://example.com/
<html><body><a href="/mailto/joe">email joe</a></body></html>
$ curl -i -X GET http://example.com/mailto/joe
HTTP/1.0 303 See Other
Location: mailto:joe@example.com
Content-Length: 0
Server: Werkzeug/0.9.4 Python/2.7.5
Date: Wed, 05 Mar 2014 09:19:05 GMT
2. And click the link "email joe" to go to http://example.com/mailto/joe
When I clicked the link "email joe" my email application opens with a new email, which is good, but Firefox renders the 303 response and I'm left with a blank page.
Actual results:
Firefox renders the 303 response and I'm left with a blank page.
Expected results:
Firefox should not render the response and leave me with the original page.
| Reporter | ||
Comment 1•12 years ago
|
||
Both Chrome and Safari have expected results.
Hardware: x86 → x86_64
Updated•12 years ago
|
Component: Untriaged → Networking: HTTP
Product: Firefox → Core
Whiteboard: [bugday-20140310]
Updated•12 years ago
|
Component: Networking: HTTP → Document Navigation
Comment 2•12 years ago
|
||
It's not clear where the right place to handle this is, actually. Why exactly is HTTP handing back a successful load here at all? Or is it not? If you send an actual response body with the 303, is that rendered?
Flags: needinfo?(lars)
| Reporter | ||
Comment 3•12 years ago
|
||
In Firefox the body response is rendered, in Safari and Chrome it is not.
When I add the following body response to the 303, Firefox will not only show the text "This should not be rendered" but fetch and parse the included stylesheet:
$ curl -i http://example.com/mailto/joe
HTTP/1.0 303 See Other
Location: mailto:joe@example.com
Content-Type: text/html; charset=utf-8
Content-Length: 27
Server: Werkzeug/0.9.4 Python/2.7.5
Date: Thu, 20 Mar 2014 07:47:20 GMT
<html><header><link rel="stylesheet" href="/style.css"></header><body><p>This should not be rendered</p></body></html>
I've tried other schemes in the Location header, like tel or itms, and they result in the same behaviour.
Flags: needinfo?(lars)
Comment 4•12 years ago
|
||
Yeah, that's an HTTP issue, then. It shouldn't be falling through to passing the response body to the consumer in this case.
Status: UNCONFIRMED → NEW
Component: Document Navigation → Networking: HTTP
Ever confirmed: true
Updated•12 years ago
|
Flags: needinfo?(mcmanus)
So this is pretty easy to patch over by forcing doNotRender to true for a mailto: redirect in nsHttpChannel::ContinueProcessResponse. However, it seems nasty to keep a list of blacklisted schemes, especially when external handlers can be added willy-nilly for schemes we don't know about. We could consider only whitelisting a few well-known schemes (http, https, ftp, file, probably one or two others I'm missing right now) and forcing doNotRender on all others.
Patrick, thoughts?
Flags: needinfo?(mcmanus)
Comment 7•12 years ago
|
||
Would just adding NS_ERROR_NO_CONTENT to the list in DoNotRender3xxBody() not do the right thing? That's what you should get for any protocol we hand off to the OS.
Thanks, Boris, that certainly satisfies my test case. Let me throw it at try and see if it breaks anything :)
Updated•12 years ago
|
Flags: needinfo?(mcmanus)
Quick update - the try build has an ASAN make check failure that I (so far) can't make heads or tails of.
Comment 10•12 years ago
|
||
For my own reference (ie, before I lose the link) here's the try push with ASAN issues https://tbpl.mozilla.org/?tree=Try&rev=b4d211f5b81b
Updated•10 years ago
|
Whiteboard: [bugday-20140310] → [bugday-20140310][necko-would-take]
Comment 11•9 years ago
|
||
Bulk change to priority: https://bugzilla.mozilla.org/show_bug.cgi?id=1399258
Priority: -- → P5
Updated•3 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•