aaron-em / shellinabox

Automatically exported from code.google.com/p/shellinabox
Other
0 stars 0 forks source link

IE 11 - Can't connect with default compatibility mode. #262

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
* What steps will reproduce the problem?

Try to connect to shellinabox from IE 11, browser shows message: "This page 
can’t be displayed" with no other indication of what went wrong.  Network 
transfer logs show a single page request with no data.

Enable IE 11 "compatibility mode" in the browser and it connects ok.

* What is the expected output? What do you see instead?

Should be able to connect to shellinabox without setting compatibility mode.

* What version of the product are you using? On what operating system?

Customized shellinabox based on 2.14 code, IE 11 on Windows 8.1.

* Please provide any additional information below.

The problem appears to be with the ieBug detection code in 
libhttp/httpconnection.c.  The code takes some actions based on finding "MSIE" 
in the user-agent string.  IE 11 no longer has "MSIE" in the user-agent string, 
so the ieBug mitigation steps do not run.  Putting IE 11 into "compatibility 
mode" changes the user-agent string back to one that contains "MSIE", so the 
ieBug code is triggered, and the connection works in that case.

It's probably not a good idea to have different code paths based on the content 
of the user-agent string.  A better solution might be to figure out what the 
shellinabox httpd is doing that IE doesn't like, and fix that for all of the 
connections.  Until then, here is a change that adds detection for the IE 11 
user-agent string "rv:11" to enable ieBug mode.

In file libhttp/httpconnection.c:

@@ -569,7 +593,8 @@
   int ieBug                 = 0;
   const char *userAgent     = getFromHashMap(&http->header, "user-agent");
   const char *msie          = userAgent ? strstr(userAgent, "MSIE ") : NULL;
-  if (msie) {
+  const char *ie1          = userAgent ? strstr(userAgent, "rv:1") : NULL;
+  if (msie || ie1) {
     ieBug++;
   }

Original issue reported on code.google.com by mala...@jeffrika.com on 22 Aug 2014 at 7:40

GoogleCodeExporter commented 9 years ago
Instead of "rv:1", "Trident" or "Trident/7.0" may be better choices.

"In rare cases, it may be necessary to uniquely identify IE11. Use the Trident 
token to do so.", mentioned by Microsoft ( 
http://msdn.microsoft.com/en-us/library/ie/hh869301%28v=vs.85%29.aspx#ie11 )

Original comment by willycho...@gmail.com on 25 Dec 2014 at 9:03

GoogleCodeExporter commented 9 years ago
Instead of making the browser sniffing more complicated, would it not be better 
to drop it completely and use code that works for all current browsers?

The attached patch does this:
 * switch to gzip encoding (which is consistently implemented by everyone) instead of deflate;
 * drop all the browser sniffing code.

With this patch, shellinabox works in IE11 (tested), and should work in every 
version of IE since IE7 (not tested).  It won't work any more in IE6 but even 
Microsoft has been telling everyone to please stop using IE6.

Original comment by lfourqu...@gmail.com on 27 Feb 2015 at 11:27

Attachments: