]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug #1504: misleading error message message for bad/unresolveable cache_peer name
authorserassio <>
Sun, 2 Apr 2006 20:32:35 +0000 (20:32 +0000)
committerserassio <>
Sun, 2 Apr 2006 20:32:35 +0000 (20:32 +0000)
Forward port of 2.5 changes.

errors/English/ERR_CONNECT_FAIL
errors/Italian/ERR_CONNECT_FAIL
src/errorpage.cc
src/forward.cc
src/gopher.cc
src/structs.h
src/tunnel.cc

index 30df94c71ae84615bd99c68c37978aa2e43e5ba9..43e04be4d35c02f0769208f54b80bc69f578411d 100644 (file)
@@ -14,7 +14,7 @@ The following error was encountered:
 <UL>
 <LI>
 <STRONG>
-Connection Failed
+Connection to %I Failed
 </STRONG>
 </UL>
 
index 42399469af573b3ffb28b4c3e7cb0a247ccfc98b..a1a73bf76414e529ae6d647ee352bc8e4ef0e09d 100644 (file)
@@ -14,7 +14,7 @@ Mentre si cercava di recuperare la URL:
 <UL>
 <LI>
 <STRONG>
-Collegamento fallito
+Collegamento a %I fallito
 </STRONG>
 </UL>
 
index 60ffc6fb7a47fd0287082cba84dc8fc8f0e7ea54..203d818fd93064993ae3382ee5710336f85acd8b 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: errorpage.cc,v 1.208 2006/02/17 20:15:35 wessels Exp $
+ * $Id: errorpage.cc,v 1.209 2006/04/02 14:32:35 serassio Exp $
  *
  * DEBUG: section 4     Error Generation
  * AUTHOR: Duane Wessels
@@ -463,7 +463,6 @@ errorStateFree(ErrorState * err)
     HTTPMSGUNLOCK(err->request);
     safe_free(err->redirect_url);
     safe_free(err->url);
-    safe_free(err->host);
     safe_free(err->dnsserver_msg);
     safe_free(err->request_hdrs);
     wordlistDestroy(&err->ftp.server_msg);
@@ -515,8 +514,8 @@ errorDump(ErrorState * err, MemBuf * mb)
     /* - IP stuff */
     str.Printf("ClientIP: %s\r\n", inet_ntoa(err->src_addr));
 
-    if (err->host) {
-        str.Printf("ServerIP: %s\r\n", err->host);
+    if (r && r->hier.host) {
+        str.Printf("ServerIP: %s\r\n", r->hier.host);
     }
 
     str.Printf("\r\n");
@@ -666,7 +665,13 @@ errorConvert(char token, ErrorState * err)
         break;
 
     case 'H':
-        p = r ? r->host : "[unknown host]";
+        if (r) {
+            if (r->hier.host)
+                p = r->hier.host;
+            else
+                p = r->host;
+        } else
+            p = "[unknown host]";
 
         break;
 
@@ -676,8 +681,8 @@ errorConvert(char token, ErrorState * err)
         break;
 
     case 'I':
-        if (err->host) {
-            mb.Printf("%s", err->host);
+        if (r && r->hier.host) {
+            mb.Printf("%s", r->hier.host);
         } else
             p = "[unknown]";
 
index 8078f42ecf32d88c06f6fc1c218a67552cd6a8bd..404de983b348676adcf157b8ebe3066c0bcd34db 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: forward.cc,v 1.136 2006/02/17 18:10:59 wessels Exp $
+ * $Id: forward.cc,v 1.137 2006/04/02 14:32:35 serassio Exp $
  *
  * DEBUG: section 17    Request Forwarding
  * AUTHOR: Duane Wessels
@@ -494,14 +494,6 @@ FwdState::negotiateSSL(int fd)
             anErr->xerrno = EACCES;
 #endif
 
-            if (fs->_peer) {
-                anErr->host = xstrdup(fs->_peer->host);
-                anErr->port = fs->_peer->http_port;
-            } else {
-                anErr->host = xstrdup(request->host);
-                anErr->port = request->port;
-            }
-
             anErr->request = HTTPMSGLOCK(request);
             fail(anErr);
 
@@ -591,6 +583,9 @@ FwdState::connectDone(int aServerFD, comm_err_t status, int xerrno)
     FwdServer *fs = servers;
     assert(server_fd == aServerFD);
 
+    if (Config.onoff.log_ip_on_direct && status != COMM_ERR_DNS && fs->code == HIER_DIRECT)
+        hierarchyNote(&request->hier, fs->code, fd_table[server_fd].ipaddr);
+
     if (status == COMM_ERR_DNS) {
         /*
          * Only set the dont_retry flag if the DNS lookup fails on
@@ -616,14 +611,6 @@ FwdState::connectDone(int aServerFD, comm_err_t status, int xerrno)
         ErrorState *anErr = errorCon(ERR_CONNECT_FAIL, HTTP_SERVICE_UNAVAILABLE);
         anErr->xerrno = xerrno;
 
-        if (fs->_peer) {
-            anErr->host = xstrdup(fs->_peer->host);
-            anErr->port = fs->_peer->http_port;
-        } else {
-            anErr->host = xstrdup(request->host);
-            anErr->port = request->port;
-        }
-
         fail(anErr);
 
         if (fs->_peer)
@@ -652,9 +639,14 @@ FwdState::connectDone(int aServerFD, comm_err_t status, int xerrno)
 void
 FwdState::connectTimeout(int fd)
 {
+    FwdServer *fs = servers;
+
     debug(17, 2) ("fwdConnectTimeout: FD %d: '%s'\n", fd, storeUrl(entry));
     assert(fd == server_fd);
 
+    if (Config.onoff.log_ip_on_direct && fs->code == HIER_DIRECT && fd_table[fd].ipaddr[0])
+        hierarchyNote(&request->hier, fs->code, fd_table[fd].ipaddr);
+
     if (entry->isEmpty()) {
         ErrorState *anErr = errorCon(ERR_CONNECT_FAIL, HTTP_GATEWAY_TIMEOUT);
         anErr->xerrno = ETIMEDOUT;
@@ -783,6 +775,11 @@ FwdState::connectStart()
 
     commSetTimeout(fd, ctimeout, fwdConnectTimeoutWrapper, this);
 
+    if (fs->_peer)
+        hierarchyNote(&request->hier, fs->code, fs->_peer->host);
+    else
+        hierarchyNote(&request->hier, fs->code, request->host);
+
     commConnectStart(fd, host, port, fwdConnectDoneWrapper, this);
 }
 
@@ -813,7 +810,6 @@ void
 FwdState::dispatch()
 {
     peer *p = NULL;
-    FwdServer *fs = servers;
     debug(17, 3) ("fwdDispatch: FD %d: Fetching '%s %s'\n",
                   client_fd,
                   RequestMethodStr[request->method],
@@ -825,13 +821,6 @@ FwdState::dispatch()
      */
     assert(server_fd > -1);
 
-    if (fs->_peer)
-        hierarchyNote(&request->hier, fs->code, fs->_peer->host);
-    else if (Config.onoff.log_ip_on_direct)
-        hierarchyNote(&request->hier, fs->code, fd_table[server_fd].ipaddr);
-    else
-        hierarchyNote(&request->hier, fs->code, request->host);
-
     fd_note(server_fd, storeUrl(entry));
 
     fd_table[server_fd].noteUse(fwdPconnPool);
index 50f4fd28f0c1ce6c214d6eb80d96ca228fa2d1b9..697a3a380393c87152015c80f95592e473dadee3 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: gopher.cc,v 1.193 2006/02/17 18:10:59 wessels Exp $
+ * $Id: gopher.cc,v 1.194 2006/04/02 14:32:35 serassio Exp $
  *
  * DEBUG: section 10    Gopher
  * AUTHOR: Harvest Derived
@@ -840,7 +840,6 @@ gopherSendComplete(int fd, char *buf, size_t size, comm_err_t errflag, int xerrn
         ErrorState *err;
         err = errorCon(ERR_WRITE_ERROR, HTTP_SERVICE_UNAVAILABLE);
         err->xerrno = errno;
-        err->host = xstrdup(gopherState->req->host);
         err->port = gopherState->req->port;
         err->url = xstrdup(storeUrl(entry));
         gopherState->fwd->fail(err);
index 08c4be3cecfb123f6bf9b51d55ff80606a5f2ce3..9fb3244539cddc05d382c7ac83570e4a3c47c468 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: structs.h,v 1.535 2006/04/02 10:15:24 serassio Exp $
+ * $Id: structs.h,v 1.536 2006/04/02 14:32:35 serassio Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -1603,7 +1603,6 @@ struct _ErrorState
     HttpRequest *request;
     char *url;
     int xerrno;
-    char *host;
     u_short port;
     char *dnsserver_msg;
     time_t ttl;
index 4983b6ae656e4fc37c24daae705e7f612e634545..15cb78d3a17040bcf1d36dd0880fbb3d6d577d5b 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: tunnel.cc,v 1.159 2006/02/17 18:10:59 wessels Exp $
+ * $Id: tunnel.cc,v 1.160 2006/04/02 14:32:35 serassio Exp $
  *
  * DEBUG: section 26    Secure Sockets Layer Proxy
  * AUTHOR: Duane Wessels
@@ -461,8 +461,6 @@ sslConnectTimeout(int fd, void *data)
 
     err->xerrno = ETIMEDOUT;
 
-    err->host = xstrdup(sslState->host);
-
     err->port = sslState->port;
 
     err->request = HTTPMSGLOCK(request);
@@ -557,7 +555,6 @@ sslConnectDone(int fdnotused, comm_err_t status, int xerrno, void *data)
         err = errorCon(ERR_CONNECT_FAIL, HTTP_SERVICE_UNAVAILABLE);
         *sslState->status_ptr = HTTP_SERVICE_UNAVAILABLE;
         err->xerrno = xerrno;
-        err->host = xstrdup(sslState->host);
         err->port = sslState->port;
         err->request = HTTPMSGLOCK(request);
         err->callback = sslErrorComplete;