示例#1
0
        public void ProcessRequest(HttpContext context)
        {
            if (context.Request.UserHostAddress != FirmwareGrant.GetFirmwareGrantAllowedIP())
            {
                context.Response.Redirect("/404");
                return;
            }



            var fileName = context.Request.Url.ToString().Split('/').Last();

            switch (fileName)
            {
            case "devices.tar.gz":
            case "style.tar.gz":
                context.Response.ContentType = "application/x-tar";
                context.Response.WriteFile("firmwarefiles".AsSetting() + fileName);
                break;

            case "version.htm":
                context.Response.ContentType = "text/html";
                context.Response.WriteFile("firmwarefiles".AsSetting() + fileName);
                break;

            case "image":     //symbolic link
            case "image.bin":
                //TODO filter by user agent   netflash/100  only in image.bin
                context.Response.ContentType = "application/octet-stream";
                context.Response.WriteFile("firmwarefiles".AsSetting() + "image.bin");
                FirmwareGrant.ClearFirmwareGrant();
                break;

            default:
                context.Response.Redirect("/404");
                break;
            }
        }
示例#2
0
        protected override StringBuilder Respond()
        {
            var sb = new StringBuilder();

            sb.AppendLineFormat("Allowed IP in {0}: {1}", "grantfilepath".AsSetting(), FirmwareGrant.GetFirmwareGrantAllowedIP());
            return(sb);
        }