Created
March 2, 2020 20:07
-
-
Save ericlaw1979/d11683f5771feefb5b0feabfe3de2b1b to your computer and use it in GitHub Desktop.
Only IE and Edge 18 and below support META cache-control and META pragma https://crbug.com/2763 https://html.spec.whatwg.org/multipage/semantics.html#pragma-directives
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Only IE and Edge 18 and below support META cache-control and META pragma | |
https://crbug.com/2763 | |
https://html.spec.whatwg.org/multipage/semantics.html#pragma-directives | |
*/ | |
import Meddler; | |
import System; | |
import System.Net.Sockets; | |
import System.Windows.Forms; | |
class Handlers | |
{ | |
static function OnConnection(oSession: Session) | |
{ | |
if (oSession.ReadRequest()){ | |
var oHeaders: ResponseHeaders = new ResponseHeaders(); | |
oHeaders["Connection"] = "close"; | |
if (!oSession.urlContains("sub")){ | |
oHeaders.Status = "200 OK"; | |
oHeaders["Content-Type"] = "text/html"; | |
oSession.WriteString(oHeaders); | |
oSession.WriteString("<HTML><BODY>Here is your file, random: " + Fuzz.NewGUID() + " <a href=\".\">Renavigate to this page</a><br /><hr /><IFRAME width=1000 height=300 SRC='sub.cgi'></IFRAME></BODY></HTML>"); | |
} | |
else | |
{ | |
// | |
oHeaders.Status = "200 ok"; | |
oHeaders["content-type"] = "text/html"; | |
// oHeaders["date"] = "Tue, 14 Jan 2020 06:07:05 GMT"; | |
oHeaders["last-modified"] = "Tue, 14 Jan 2020 04:05:01 GMT"; | |
oHeaders["etag"] = '"'+ Fuzz.NewGUID() + '"'; | |
// oHeaders["cache-control"] = "private, max-age=604800"; | |
oSession.WriteString(oHeaders); | |
oSession.WriteString("<html><head>" + | |
"<meta http-equiv=\"expires\" content=\"Wed, 23 Dec 1980 00:30:00 GMT\"> \r\n <meta http-equiv=\"cache-control\" content=\"private,public,max-age=0\"> \r\n <meta http-equiv=\"date\" content=\"Wed, " | |
+ "18 Dec 2019 09:03:46 GMT\"> \r\n <meta http-equiv=\"pragma\" content=\"no-cache\">"+ | |
"</head><body><h1>wtaf</h1>Here is your file with NO-CACHE meta tags, random: " + Fuzz.NewGUID() + "</body></html>"); | |
} | |
} | |
oSession.socket.Shutdown(SocketShutdown.Send); | |
oSession.socket.Close(); | |
} | |
static function Main() | |
{ | |
var today: Date = new Date(); | |
MeddlerObject.StatusText = " Rules.js was loaded at: " + today; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment