HTTPS broken by <lang_code>.res.axd

May 11, 2012 at 8:15 PM

Hi,

Love the work you are doing on BE - it's getting faster and smoother with every release.  Really like the script combining and reduced HTTP requests on 2.6.  Plus of course the file manager and so on. 

Just because I like to be able to post to my blog from random parts of the world and evade the corporate police I tend to use HTTPS connection.  I find that one item loads using a canonical url that assumes http - it is the <lang_code>.res.axd object.  

I recall that i previously had to track down the appropriate line in the source code, alter it and recompile, as it is not changeable in any of the aspx or code behind files.

Think you could take a look at this and try to use a relative reference that doesn't break HTTPS page loads?

Cheers

NB

May 11, 2012 at 8:58 PM
Edited May 11, 2012 at 9:05 PM

Should probably say: I took a look at the source, found resource handler for language references in ResourceHandler.cs.  The code snippets below seem to be the operable bits, but I'm not switched on enough with rewrite rule and url references to see where this might be going awry:

Lines 46 to 60

 

 public void ProcessRequest(HttpContext context)
        {
            var request = context.Request;
            var lang = request.FilePath;

            lang = lang.Replace(".res.axd", "");

            if (lang.IndexOf("/") >= 0)
                lang = lang.Substring(lang.LastIndexOf("/") + 1);

            if (string.IsNullOrEmpty(lang))
            {
                // Use the current Language if the lang query isn't set.
                lang = BlogSettings.Instance.Language;
            }

 

Lines 141 to 145

 

 public static string GetScriptPath(System.Globalization.CultureInfo cultureInfo)
        {
            return String.Format("{0}{1}.res.axd", Utils.AbsoluteWebRoot, cultureInfo.Name.ToLowerInvariant());
        }

 

 

Lines 111 to 119

 

                    // Although this handler is intended to output resource strings,
                    // also outputting other non-resource variables.
                    sb.AppendFormat("webRoot: '{0}',", Utils.RelativeWebRoot);
                    sb.AppendFormat("applicationWebRoot: '{0}',", Utils.ApplicationRelativeWebRoot);
                    sb.AppendFormat("blogInstanceId: '{0}',", Blog.CurrentInstance.Id);
                    sb.AppendFormat("i18n: {0}", jc.ToJsonString());
                    script = "BlogEngineRes = {" + sb + "};";
                }
            }

So any thoughts or help would be appreciated :o)

If you check out the page load info from https://www.linxs.net/geoblog/ you'll see the offending resource.  I have a vanilla BE 2.6 RC install with modded theme.

Coordinator
May 11, 2012 at 9:53 PM

I think to make it work you can change it in ResourceHandler.cs from:

return String.Format("{0}{1}.res.axd", Utils.AbsoluteWebRoot, cultureInfo.Name.ToLowerInvariant());

to:

return String.Format("{0}{1}.res.axd", Utils.ApplicationRelativeWebRoot, cultureInfo.Name.ToLowerInvariant());

Otherwise I'll need to install SSL locally and run it through debugger (local SSL may be good idea anyway...).

Coordinator
May 12, 2012 at 6:30 PM

That worked for me. Added change to the code so it will be in 2.6 release.

May 12, 2012 at 6:37 PM

Great news!

Was just trying to get a build to work - but seems to be struggling in Visual Web Developer Express 2010, missing references etc.  I'm a bit out of my depth here.

Thanks for confirming that as a fix.

Keep up the good work guys :)

 

NB

May 12, 2012 at 6:59 PM

Source for 2.6.0.5 compiled with no problem  \o/

Thanks again!