Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed the single space character for Safari #14883

Merged
merged 1 commit into from
Jul 10, 2014

Conversation

chancancode
Copy link
Member

I'm still cleaning up the tests, but I want to get this out so people can help me test it

Once upon a time, a single space character was added to render nothing: true (cb0f8fd, 807df4f) to fix a bug in Safari. (Thank you @matthewd for hunting this down.)

Since this bug has been fixed in Safari itself a long time ago (based on the timestamps it should be fixed in Safari 2.x or perhaps 1.x in ~2005), it's probably a good time to remove this.

I wrote a simplified version of the webkit test case which you can access here:

(The controller doesn't actually use render nothing, but it should have the same effect)

I tested this on a variety of browsers on [browser stack(http://www.browserstack.com/)], including Safari 4.0 and Firefox 3.0 and it seems to work fine.

Ideally, I'd like to see this test case fail on an older version of safari (you might need safari 2.0 or even 1.0). If you have access to one of those super old browser, please help run the test case and let me know what happens 😄

Otherwise, I am fairly confident that this should be okay.

cc @dhh @jeremy @sikachu @matthewd

Fixes #14336

@dhh
Copy link
Member

dhh commented Apr 27, 2014

Thanks for tackling this. Great to rid ourselves of cruft no longer needed.

On Apr 27, 2014, at 8:43 PM, Godfrey Chan notifications@github.com wrote:

I'm still cleaning up the tests, but I want to get this out so people can help me test it

Once upon a time, a single space character was added to render nothing: true (cb0f8fd, 807df4f) to fix a bug in Safari. (Thank you @matthewd for hunting this down.)

Since this bug has been fixed in Safari itself a long time ago (based on the timestamps it should be fixed in Safari 2.x or perhaps 1.x in ~2005), it's probably a good time to remove this.

I wrote a simplified version of the webkit test case which you can access here:

• xhr async version: http://lit-anchorage-8910.herokuapp.com/async (source)
• xhr sync version: http://lit-anchorage-8910.herokuapp.com/sync (source)
(The controller doesn't actually use render nothing, but it should have the same effect)

I tested this on a variety of browsers on [browser stack(http://www.browserstack.com/)], including Safari 4.0 and Firefox 3.0 and it seems to work fine.

Ideally, I'd like to see this test case fail on an older version of safari (you might need safari 2.0 or even 1.0). If you have access to one of those super old browser, please help run the test case and let me know what happens

Otherwise, I am fairly confident that this should be okay.

cc @dhh @jeremy @sikachu @matthewd

Fixes #14336

You can merge this Pull Request by running

git pull https://github.com/chancancode/rails rm-single-space
Or view, comment on, or merge it at:

#14883

Commit Summary

• Removed the single space character for Safari
File Changes

• M actionpack/lib/action_controller/metal/rendering.rb (2)
• M actionpack/test/controller/new_base/render_body_test.rb (14)
• M actionpack/test/controller/new_base/render_html_test.rb (14)
• M actionpack/test/controller/new_base/render_plain_test.rb (14)
• M actionpack/test/controller/new_base/render_text_test.rb (14)
Patch Links:

https://github.com/rails/rails/pull/14883.patch
https://github.com/rails/rails/pull/14883.diff

Reply to this email directly or view it on GitHub.

@jeremy
Copy link
Member

jeremy commented Apr 27, 2014

👍

Should update these tests rather than removing them. We expect these to return an empty (unpadded) body.

@arthurnn
Copy link
Member

should I close #14350 then? or should we go ahead with both?

@chancancode
Copy link
Member Author

I haven't dug too deep into the fix itself, I'll take a look at #14350 and pull it whatever we need 👍

Just want to get the test case up and have other people check it!

Sent from Mailbox for iPhone

On Sun, Apr 27, 2014 at 2:53 PM, Arthur Nogueira Neves
notifications@github.com wrote:

should I close #14350 then? or should we go ahead with both?

Reply to this email directly or view it on GitHub:
#14883 (comment)

@kaspth
Copy link
Contributor

kaspth commented Apr 28, 2014

I've been trying to judge how likely a Mac user is to still be using Safari 3.0 and 2.0.

The data:
OS X usage numbers from March 2014
Safari versions matched with their supporting OS'es

So...
Safari 2.0 was only on Tiger which has a market share of 1%.
Safari 3.0 was on Leopard which has a market share of 3%.
Safari 4.1.3 was the last version to support at least Tiger and was released in late 2010.

Also...
How many of those 1% and 3% even use Safari?
How likely is it these old browsers hit a Rails app, which uses renders nothing: true?

🎉 I think we can declare that bug fixed. 🎉

@chancancode
Copy link
Member Author

I agree that we don't really have to worry about safari < 5.

My motivation for testing this on a broken version of safari is to verify the correctness of the test cases and make sure it's testing against the right bug.

Now that I have a test case that passes everywhere it could either be that the bug is fixed everywhere, or the test case is completely wrong :)

I am betting on the former, but it would be nice to know for sure

`render nothing: true` or rendering a `nil` body no longer add a single
space to the response body.

The old behavior was added as a workaround for a bug in an early version of
Safari, where the HTTP headers are not returned correctly if the response
body has a 0-length. This is been fixed since and the workaround is no
longer necessary.

Use `render body: ' '` if the old behavior is desired.
@chancancode chancancode changed the title [WIP] Removed the single space character for Safari Removed the single space character for Safari Jul 10, 2014
@chancancode chancancode added this to the 4.2.0 milestone Jul 10, 2014
@chancancode chancancode self-assigned this Jul 10, 2014
guilleiguaran added a commit that referenced this pull request Jul 10, 2014
Removed the single space character for Safari
@guilleiguaran guilleiguaran merged commit 0d676d1 into rails:master Jul 10, 2014
prathamesh-sonpatki added a commit to prathamesh-sonpatki/rails that referenced this pull request Dec 30, 2014
- The single space response was added due to a bug in safari
  in rails@cb0f8fd
  and
  rails@807df4f.
- This was removed from the `render nothing: true` in
  rails#14883.
- Removing it from response of :head also. As :head is more obvious
  alternative to call `render nothing:
  true`(http://guides.rubyonrails.org/layouts_and_rendering.html#using-head-to-build-header-only-responses),
  removing it from head method also.
- Closes rails#18253.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"render nothing: true" does not render exactly nothing
9 participants