* to the client socket.
*
* Note: If there is a callback, the callback is responsible for
- * closeing the FD, otherwise we do it ourseves.
+ * closing the FD, otherwise we do it ourseves.
*/
static void
errorSendComplete(int fd, char *bufnotused, size_t size, comm_err_t errflag, int xerrno, void *data)
/* - IP stuff */
str.Printf("ClientIP: %s\r\n", inet_ntoa(err->src_addr));
- if (r && r->hier.host) {
+ if (r && r->hier.host[0] != '\0') {
str.Printf("ServerIP: %s\r\n", r->hier.host);
}
case 'h':
mb.Printf("%s", getMyHostname());
-
break;
case 'H':
if (r) {
- if (r->hier.host)
+ if (r->hier.host[0] != '\0') // if non-empty string.
p = r->hier.host;
else
p = r->host;
break;
case 'I':
- if (r && r->hier.host) {
+ if (r && r->hier.host[0] != '\0') // if non-empty string
mb.Printf("%s", r->hier.host);
} else
p = "[unknown]";
break;
case 'U':
- p = r ? urlCanonicalClean(r) : err->url ? err->url : "[no URL]";
+ /* Using the fake-https version of canonical so error pages see https:// */
+ /* even when the url-path cannot be shown as more than '*' */
+ p = r ? urlCanonicalFakeHttps(r) : err->url ? err->url : "[no URL]";
break;
case 'u':
SQUIDCEXTERN void urlInitialize(void);
SQUIDCEXTERN HttpRequest *urlParse(method_t, char *, HttpRequest *request = NULL);
SQUIDCEXTERN const char *urlCanonical(HttpRequest *);
+SQUIDCEXTERN char *urlCanonicalClean(const HttpRequest *);
+SQUIDCEXTERN const char *urlCanonicalFakeHttps(const HttpRequest * request);
SQUIDCEXTERN char *urlRInternal(const char *host, u_short port, const char *dir, const char *name);
SQUIDCEXTERN char *urlInternal(const char *dir, const char *name);
SQUIDCEXTERN int matchDomainName(const char *host, const char *domain);
SQUIDCEXTERN int urlCheckRequest(const HttpRequest *);
SQUIDCEXTERN int urlDefaultPort(protocol_t p);
-SQUIDCEXTERN char *urlCanonicalClean(const HttpRequest *);
SQUIDCEXTERN char *urlHostname(const char *url);
SQUIDCEXTERN void urlExtMethodConfigure(void);
return buf;
}
+/**
+ * Yet another alternative to urlCanonical.
+ * This one addes the https:// parts to METHOD_CONNECT URL
+ * for use in error page outputs.
+ * Luckily we can leverage the others instead of duplicating.
+ */
+const char *
+urlCanonicalFakeHttps(const HttpRequest * request)
+{
+ LOCAL_ARRAY(char, buf, MAX_URL);
+
+ // method CONNECT and port HTTPS
+ if(request->method == METHOD_CONNECT && request->port == 443) {
+ snprintf(buf, MAX_URL, "https://%s/*", request->GetHost());
+ return buf;
+ }
+
+ // else do the normal complete canonical thing.
+ return urlCanonicalClean(request);
+}
+
+
/*
* matchDomainName() compares a hostname with a domainname according
* to the following rules: