]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
From: Andy Powell <lisap@ukoln.ac.uk>
authorwessels <>
Sat, 2 May 1998 04:13:32 +0000 (04:13 +0000)
committerwessels <>
Sat, 2 May 1998 04:13:32 +0000 (04:13 +0000)
Here is a suggested patch for urn.c in Squid 1.2 beta 20.  This patch
causes Squid's URN code to always return an HTTP redirect (by adding a
Location:  header to the reply) if the called N2L script only returns a
single URL. (It seems pointless offering the end-user a choice of only one
URL?).

src/urn.cc

index ea3f20450167319410069d86d302d4fe31c87f2d..00bfcd17298f88ed0cff67b7b00f31da475b9264 100644 (file)
@@ -1,7 +1,7 @@
 
 /*
  *
- * $Id: urn.cc,v 1.27 1998/04/09 17:54:23 wessels Exp $
+ * $Id: urn.cc,v 1.28 1998/05/01 22:13:32 wessels Exp $
  *
  * DEBUG: section 52    URN Parsing
  * AUTHOR: Kostas Anagnostakis
@@ -56,8 +56,15 @@ urnFindMinRtt(wordlist * urls, method_t m, int *rtt_ret)
     int rtt;
     wordlist *w;
     wordlist *min_w = NULL;
+    int urlcnt = 0;
     debug(52, 3) ("urnFindMinRtt\n");
     assert(urls != NULL);
+    for (w = urls; w; w = w->next)
+       urlcnt++;
+    if (urlcnt == 1) {
+       debug(52, 3) ("Only one URL - return it!\n");
+       return(urls);
+    }
     for (w = urls; w; w = w->next) {
        r = urlParse(m, w->key);
        if (r == NULL)