Last resort connection patch

From: Dancer <dancer@dont-contact.us>
Date: Mon, 09 Mar 1998 20:30:53 +1000

Yeah, I know I've been a bit lax about getting a proper
patch done up for it. I'm also not sure I've got all the
addresses of people that were asking. Nevertheless, here's
the patch. Remember to edit src/Makefile and uncomment
-DLAST_RESORT to enable the modification.

Then, anytime no parents are available, squid will make a
direct connection, rather than printing the message
about 'no blah..blah..blah, and the host is beyond your firewall'.

Thankfully, it's only a rather little patch.

----CUT--HERE--------------
diff -rc squid-1.1.20-dist/src/Makefile.in squid-1.1.20/src/Makefile.in
*** squid-1.1.20-dist/src/Makefile.in Sat Oct 25 03:57:11 1997
--- squid-1.1.20/src/Makefile.in Mon Mar 9 20:10:24 1998
***************
*** 18,29 ****
  USE_BIN_TREE = # -DUSE_BIN_TREE
  RELOAD_INTO_IMS = # -DRELOAD_INTO_IMS
  UNDERSCORES_OPT = # -DALLOW_HOSTNAME_UNDERSCORES
  
  DEFINES = $(HOST_OPT) $(AUTH_OPT) $(LOG_HDRS_OPT) \
                    $(ICMP_OPT) $(DELAY_HACK) $(USERAGENT_OPT) \
                    $(KILL_PARENT_OPT) $(USE_POLL_OPT) \
                    $(USE_SPLAY_TREE) $(USE_BIN_TREE) \
! $(RELOAD_INTO_IMS) $(UNDERSCORES_OPT)
  
  prefix = @prefix@
  exec_prefix = @exec_prefix@
--- 18,30 ----
  USE_BIN_TREE = # -DUSE_BIN_TREE
  RELOAD_INTO_IMS = # -DRELOAD_INTO_IMS
  UNDERSCORES_OPT = # -DALLOW_HOSTNAME_UNDERSCORES
+ LAST_RESORT = # -DLAST_RESORT
  
  DEFINES = $(HOST_OPT) $(AUTH_OPT) $(LOG_HDRS_OPT) \
                    $(ICMP_OPT) $(DELAY_HACK) $(USERAGENT_OPT) \
                    $(KILL_PARENT_OPT) $(USE_POLL_OPT) \
                    $(USE_SPLAY_TREE) $(USE_BIN_TREE) \
! $(RELOAD_INTO_IMS) $(UNDERSCORES_OPT) $(LAST_RESORT)
  
  prefix = @prefix@
  exec_prefix = @exec_prefix@
diff -rc squid-1.1.20-dist/src/neighbors.c squid-1.1.20/src/neighbors.c
*** squid-1.1.20-dist/src/neighbors.c Sat Nov 1 11:34:19 1997
--- squid-1.1.20/src/neighbors.c Mon Mar 9 20:07:44 1998
***************
*** 163,168 ****
--- 163,171 ----
      "PASSTHROUGH_PARENT",
      "SSL_PARENT_MISS",
      "ROUNDROBIN_PARENT",
+ #ifdef LAST_RESORT
+ "LAST_RESORT",
+ #endif
      "INVALID CODE"
  };
  
diff -rc squid-1.1.20-dist/src/neighbors.h squid-1.1.20/src/neighbors.h
*** squid-1.1.20-dist/src/neighbors.h Sat Nov 1 01:41:28 1997
--- squid-1.1.20/src/neighbors.h Mon Mar 9 20:08:02 1998
***************
*** 131,136 ****
--- 131,139 ----
      HIER_PASS_PARENT,
      HIER_SSL_PARENT,
      HIER_ROUNDROBIN_PARENT,
+ #ifdef LAST_RESORT
+ HIER_LASTRESORT,
+ #endif
      HIER_MAX
  } hier_code;
  
diff -rc squid-1.1.20-dist/src/proto.c squid-1.1.20/src/proto.c
*** squid-1.1.20-dist/src/proto.c Wed Dec 10 08:24:57 1997
--- squid-1.1.20/src/proto.c Mon Mar 9 20:11:54 1998
***************
*** 243,253 ****
--- 243,259 ----
              hierarchyNote(req, HIER_FIRSTUP_PARENT, 0, e->host);
              protoStart(protoData->fd, entry, e, req);
          } else {
+ #ifdef LAST_RESORT
+ hierarchyNote(req, HIER_LASTRESORT, 0, req->host);
+ protoStart(protoData->fd, entry, NULL, req);
+ return;
+ #else
              hierarchyNote(req, HIER_NO_DIRECT_FAIL, 0, req->host);
              protoCantFetchObject(protoData->fd,
                  entry,
                  "No peers to query "
                  "and the host is beyond your firewall.");
+ #endif
          }
          return;
      }
***************
*** 287,296 ****
--- 293,308 ----
          hierarchyNote(req, HIER_ROUNDROBIN_PARENT, 0, e->host);
          protoStart(protoData->fd, entry, e, req);
      } else if (protoData->direct_fetch == DIRECT_NO) {
+ #ifdef LAST_RESORT
+ hierarchyNote(req, HIER_LASTRESORT, 0, req->host);
+ protoStart(protoData->fd, entry, NULL, req);
+ return;
+ #else
          hierarchyNote(req, HIER_NO_DIRECT_FAIL, 0, req->host);
          protoCantFetchObject(protoData->fd, entry,
              "No neighbors or parents were queried "
              "and the host is beyond your firewall.");
+ #endif
      } else if (ia == NULL) {
          protoDNSError(protoData->fd, entry);
      } else {
***************
*** 555,565 ****
--- 567,582 ----
          hierarchyNote(request, HIER_FIRSTUP_PARENT, fd, e->host);
          return protoStart(fd, entry, e, request);
      }
+ #ifdef LAST_RESORT
+ hierarchyNote(request, HIER_LASTRESORT, fd, request->host);
+ return protoStart(fd, entry, NULL, request);
+ #else
      hierarchyNote(request, HIER_NO_DIRECT_FAIL, fd, request->host);
      protoCancelTimeout(fd, entry);
      protoCantFetchObject(fd, entry,
          "No ICP replies received and the host is beyond the firewall.");
      return 0;
+ #endif
  }
  
  int
Received on Mon Mar 09 1998 - 02:45:32 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:39:12 MST