dfd69d02b4d35ccafd84a4d712086ef61a9db487
hiram
Mon Jun 21 14:12:34 2021 -0700
replacing hgBotDelay with earlyBotCheck refs #23217
diff --git src/hg/cartDump/cartDump.c src/hg/cartDump/cartDump.c
index 0933b10..2cfe27c 100644
--- src/hg/cartDump/cartDump.c
+++ src/hg/cartDump/cartDump.c
@@ -1,29 +1,32 @@
/* cartDump - Dump contents of cart. */
/* Copyright (C) 2014 The Regents of the University of California
* See README in this or parent directory for licensing information. */
#include "common.h"
#include "linefile.h"
#include "hash.h"
#include "cheapcgi.h"
#include "cart.h"
#include "hdb.h"
#include "jsHelper.h"
#include "hui.h"
#include "botDelay.h"
+/* for earlyBotCheck() function at the beginning of main() */
+#define delayFraction 1.0 /* standard penalty for most CGIs */
+static boolean issueBotWarning = FALSE;
#define CART_DUMP_REMOVE_VAR "n/a"
struct hash *oldVars = NULL;
void doMiddle(struct cart *cart)
/* cartDump - Dump contents of cart. */
{
#define MATCH_VAR "match"
char *vName = "cartDump.varName";
char *vVal = "cartDump.newValue";
char *wildcard;
boolean asTable = cartVarExists(cart,CART_DUMP_AS_TABLE);
if (cgiVarExists("submit"))
@@ -51,31 +54,39 @@
{
char *db = cartString(cart, "db");
struct trackDb *tdb = hTrackDbForTrack(db, trackName);
if (tdb != NULL && tdbIsComposite(tdb))
{
struct lm *lm = lmInit(0);
cartTdbTreeCleanupOverrides(tdb,cart,oldVars,lm);
lmCleanup(&lm);
}
}
return;
}
// To discourage hacking, call bottleneck
-hgBotDelay();
+/* used to have hgBotDelay() here, replaced with earlyBotCheck()
+ * at the beginning of main() to output message here if in delay time
+ * 2021-06-21 - Hiram
+ */
+if (issueBotWarning)
+ {
+ char *ip = getenv("REMOTE_ADDR");
+ botDelayMessage(ip, botDelayMillis);
+ }
if (asTable)
{
jsIncludeFile("jquery.js",NULL); // required by utils.js
jsIncludeFile("utils.js",NULL);
jsIncludeFile("ajax.js",NULL);
printf("Show as plain text.
",CART_DUMP_AS_TABLE);
printf("
Cookies passed to %s:
\n%s\n