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
Wrong format on Internet Explorer #104
Comments
@gotjosh Hello and thanks for reporting this problem. I'm going to investigate and decide what to do. It's a blurry line between Rack and Lotus::Controller 😸 |
@gotjosh I'm a confused. First of all, I've introduced a test to verify the failure that you've reported, but it's passing without changing a line in the production code (see 31e929b). From this perspective looks like a "non-bug". However, wrong You have referenced a Rack patch, are you using 1.6.0? Can you please share the stack trace? Thank you very much. |
@gotjosh There is one problem here: the build fails on Ruby 2.0+ (2.2 excluded). https://travis-ci.org/lotus/controller/builds/61126011 I suspect you're on 2.0 or 2.1, correct? |
Hi @jodosha! It's a quite blurry line if you ask me, that's why I wanted to ask first. Allow me to respond in order:
|
This is related to #59 |
Ohhh! I completely missed that rack patch inside lotus/controller 😢 |
However the patch states is only for Rack 1.5 or below, I'm currently on Rack 1.6. |
True, but I just discovered that That patch was always applied 😱 That means Rack 1.6 still has a bug in the MIME type handling. The last commit above should fix the build for all the supported Rubies. |
Fantastic! |
@gotjosh Can you please verify that |
The logic you've applied here is fragile and will probably break again in the future...because it is patching around differences in sort implementations. In jruby/jruby#3004, we have an issue caused by the way our sort implementation handles equivalent entries. A test case in Lotus uses an accept specification with two equivalently-weighed mime types, and then expects that they'll be ordered the same across all Ruby implementations. Unluckily for us, JRuby differs: jruby/jruby#3004 (comment) It's also interesting that prior to 19345cc, Rubinius was treated as an odd man out. There's a fundamental issue here with the way the weighted sorting is done; you're going to see sort implementations vary over time and across Ruby implementations, and the way they sort equivalent entries will cause this to break again and again. I would suggest that you add some additional weighting based on the position in the accept list, so equivalent entries won't be quite so equivalent. |
@headius THB, I'm not proud of that patch. Another poor quality indicator is the high churn in this area. That being said, we wanted to borrow from It suddenly broke and we had to reverse. 😢 It deserves a solid implementation, I'm gonna to rewrite it and send a PR to the Rack team. Thanks for having a look at our builds. 💯 |
Howdy fellow lotus lovers!
I noticed that two of my Lotus Production apps won't allow Internet Explorer access. They would immediately throw a 500 error when trying to access them. After some digging, these are my findings:
The
HTTP_ACCEPT
header that IE (short for Internet Explorer from now on) is coming with; istext/html, application/xhtml+xml, image/jxr, */*
when checkingself.format
inside an controller action we can see that this translates to:'123'
. Weird right?After digging around in
lotus/controller
I noticed this particular method inside mime.rbSince
accept
is equal toHTTP_HEADER
the result from Rack'sbest_q_match
is"application/vnd.lotus-1-2-3"
(more info on this here) which is what is ultimatetly determining the not-so-cool:'123'
format.SIDENOTE
I took a few side steps onto Rack to check out this function and this is the result from
q_values
for this particular string:[["text/html", 1.0], ["application/xhtml+xml", 1.0], ["image/jxr", 1.0], ["*/*", 1.0]]
Seems weird that the quality of all of them is 1.0 considering that
text/html
should be the one to be respected, in particular*/*
is the one being extrapolated to"application/vnd.lotus-1-2-3"
, I know that our very own @jodosha patched this function and added a test case that involves this particular string so I believe something broke in Rack along the way. You can take a look at @jodosha's patch hereI want to help out here, so my question is, is this something that should be patched/fixed in Lotus or completely delegate this to Rack? It's believe is quite bad for us (Lotus) that IE is broken out of the box.
The text was updated successfully, but these errors were encountered: