Skip to content

Instantly share code, notes, and snippets.

@ericlaw1979
Created March 2, 2020 20:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ericlaw1979/ece4afbbf4eb19e76482cc9465863582 to your computer and use it in GitHub Desktop.
Save ericlaw1979/ece4afbbf4eb19e76482cc9465863582 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
/*
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