ForceSend() private method

private ForceSend ( ) : void
return void
Esempio n. 1
0
        private static async Task WriteHeader(string path, Server.RequestContext res, string description, string title, string imageUrl, string keyword, string header)
        {
            title += " Hypixel SkyBlock Auction house history tracker";
            // shrink to fit
            while (title.Length > 65)
            {
                title = title.Substring(0, title.LastIndexOf(' '));
            }
            if (path == "/index.html")
            {
                path = "";
            }


            await res.WriteAsync(header
                                 .Replace(defaultText, description)
                                 .Replace(defaultTitle, title)
                                 .Replace("</title>", $"</title><meta property=\"keywords\" content=\"{keyword},hypixel,skyblock,auction,history,bazaar,tracker\" />"
                                          + $"<meta property=\"og:image\" content=\"{imageUrl}\" />"
                                          + $"<meta property=\"og:url\" content=\"https://sky.coflnet.com{path}\" />"
                                          + $"<meta property=\"og:title\" content=\"{title}\" />"
                                          + $"<meta property=\"og:description\" content=\"{description}\" />"
                                          + $"<link rel=\"canonical\" href=\"https://sky.coflnet.com{path}\" />"
                                          )
                                 + "</head>");

            res.ForceSend();
        }
Esempio n. 2
0
        private static async Task WriteStart(Server.RequestContext res, string content)
        {
            await res.WriteAsync(content);

            // res.SendChunked = true;
            res.AddHeader("cache-control", "public,max-age=" + 1800);

            res.ForceSend();
        }