/*
- * $Id: errorpage.cc,v 1.105 1997/11/24 18:27:15 wessels Exp $
+ * $Id: errorpage.cc,v 1.106 1997/11/30 03:08:37 wessels Exp $
*
* DEBUG: section 4 Error Generation
* AUTHOR: Duane Wessels
#define CVT_BUF_SZ 512
/*
+ * B - URL with FTP %2f hack x
* c - Squid error code
* d - seconds elapsed since request received
* e - errno x
static char buf[CVT_BUF_SZ];
const char *p = buf;
switch (token) {
+ case 'B':
+ p = r ? ftpUrlWith2f(r) : "[no URL]";
+ break;
case 'e':
snprintf(buf, CVT_BUF_SZ, "%d", err->xerrno);
break;
/*
- * $Id: ftp.cc,v 1.174 1997/11/24 18:27:16 wessels Exp $
+ * $Id: ftp.cc,v 1.175 1997/11/30 03:08:38 wessels Exp $
*
* DEBUG: section 9 File Transfer Protocol (FTP)
* AUTHOR: Harvest Derived
l += snprintf(buf + l, s - l, "\r\n%s", content);
return buf;
}
+
+char *
+ftpUrlWith2f(const request_t * request)
+{
+ LOCAL_ARRAY(char, buf, MAX_URL);
+ LOCAL_ARRAY(char, loginbuf, MAX_LOGIN_SZ + 1);
+ LOCAL_ARRAY(char, portbuf, 32);
+ char *t;
+ portbuf[0] = '\0';
+ if (request->port != urlDefaultPort(request->protocol))
+ snprintf(portbuf, 32, ":%d", request->port);
+ loginbuf[0] = '\0';
+ if (strlen(request->login) > 0) {
+ strcpy(loginbuf, request->login);
+ if ((t = strchr(loginbuf, ':')))
+ *t = '\0';
+ strcat(loginbuf, "@");
+ }
+ snprintf(buf, MAX_URL, "%s://%s%s%s%s%s",
+ ProtocolStr[request->protocol],
+ loginbuf,
+ request->host,
+ portbuf,
+ "/%2f",
+ request->urlpath);
+ if ((t = strchr(buf, '?')))
+ *t = '\0';
+ return buf;
+}
extern void fqdncache_restart(void);
extern void ftpStart(request_t * req, StoreEntry * entry);
+extern char *ftpUrlWith2f(const request_t *);
extern void gopherStart(StoreEntry *);
extern int gopherCachable(const char *);