This project is archived and is in readonly mode.
Content Negotiation Regression
-
Paul Sadauskas (Rando)
Looks like LH swallowed my markdown. Here's the links referenced above:
1: http://github.com/rails/rails/commit/1310231c15742bf7d99e2f143d88b3...
2: http://gist.github.com/237075 -
Paul Sadauskas (Rando)
And here's a patch that hacks around the hack. It pretty much is just a better was to detect browsers without also catching web-service clients.
Commit: http://github.com/paul/rails/commit/680762155921bbc42b0030807f34cb0...
Topic branch, for merging: http://github.com/paul/rails/commits/accepts -
Repository
- State changed from new to resolved
(from [dc5300adb6d46252c26e239ac67e3ca6e5e2d77b]) Slightly less annoying check for acceptable mime_types. This allows Accept: application/json, application/jsonp (and the like), but still blacklists browsers. Essentially, we use normal content negotiation unless you include / in your list, in which case we assume you're a browser and send HTML [#3541 state:resolved] http://github.com/rails/rails/commit/dc5300adb6d46252c26e239ac67e3c...
-
Dan Pickett
- Tag changed from content_type, rails3 to bugmash, content_type, rails3
Can a bugmasher add some tests?
-
Patrik Stenmark
I've created a patched which add tests which I think tests the right thing. My first patch ever, so I hope it's useful.
-
José Valim
- Importance changed from to Low
Patrik, could you please create a patch using the guidelines specified here:
http://rails.lighthouseapp.com/projects/8994/sending-patches
This way it will preserve you as the author! Thanks!
-
Santiago Pastorino
- Tag changed from bugmash, content_type, rails3 to content_type, rails3
- State changed from incomplete to verified
- Assigned user changed from Yehuda Katz (wycats) to José Valim
José, Patrik patch applies clean for me, and all the tests pass
-
Santiago Pastorino
- State changed from verified to committed
Applied tests here http://github.com/rails/rails/commit/7f7480f6fc1e88ce19bee8ac7f6fb2...
-
Russell Garner
Hi,
Have opened a ticket at https://rails.lighthouseapp.com/projects/8994/tickets/5991-406-unac... - I'm still not sure this is behaving in a way which is reasonable HTTP (or whether or not I've opened a duplicate ticket ;)). If we have an HTML form which POSTs to an action which can only return
application/atom+xmlwe end up with a 406, even though the browser has said it will accept*/*. A patch which demonstrates this is attached at the link above.This 406 happens whether or not
respond_withor the old-stylerespond_tois used.I'm not sure I understand the line from Paul's commit message above "Essentially, we use normal content negotiation unless you include / in your list, in which case we assume you're a browser and send HTML" - that seems to say that we're assuming that browsers can only handle HTML?
-
Fjan
I'm also not convinced this is how we want this to behave. Here are a few Accept Headers I found in my production log over the last few days that get served a "Missing Template" error:
- HTTP_ACCEPT: text/*
- HTTP_ACCEPT: /, auth/sicily
- HTTP_ACCEPT: /, application/youtube-client
As far as I can tell those should have been served an HTML page. If I set my browser header to "/" it works as expected, but if I add garbage to the header it won't work. perhaps we should have an option somewhere that says "when in doubt serve HTML" that you could switch on when you are certain you are not serving web services? Should I put in a new ticket for this?
-
Fjan
Sorry, LH ate the asterisks on the posting above, wherever it says "/" please read star / star
-
José Valim
Fjan, your case indeed seems to be a regression. Whenever rails sees "star / star", it should deliver HTML if available. Feel free to open a new ticket. A patch with tests (or even a fix) is extremely welcome.
