This is a multi-part message in MIME format.
--------------2BED0C2439DBAC80210B6803
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Duane Wessels wrote:
> >Could we have another sub release please? :) What other bug fixes are
> >lurking in there??
>
> As you wish.
Here is my b11 patches that is missing from b12:
Squid-1.2.beta11: Support for NLST listings
Format NLST listings, and inform the user that the NLST
(plain) format is available when we find a LIST listing
that we don't understand.
Squid-1.2.beta11: SIZE on binary FTP transfers
Use SIZE on Binary transfers, and not ASCII. The condition
was inversed, making squid use SIZE on ASCII transfers.
Squid-1.2.beta11: Enable virtual and Host: based acceleration in
order to be able to use Squid as a transparent proxy without
breaking either virtual servers or clients not sending Host:
header the order of the virtual and Host: based acceleration
needs to be swapped, giving Host: a higher precendence than
virtual host.
Squid-1.2.beta11: Use memmove/bcopy as detected by configure
Some systems does not have memmove, but have the older bcopy
implementation.
--------------2BED0C2439DBAC80210B6803
Content-Type: text/plain; charset=us-ascii; name="squid-1.2.beta11.ftp_nlst_listings.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="squid-1.2.beta11.ftp_nlst_listings.patch"
Index: squid/src/ftp.c
diff -u squid/src/ftp.c:1.1.1.8.4.2 squid/src/ftp.c:1.1.1.8.4.3
--- squid/src/ftp.c:1.1.1.8.4.2 Sat Jan 10 21:42:19 1998
+++ squid/src/ftp.c Sun Jan 11 17:58:55 1998
@@ -45,7 +44,8 @@
FTP_NO_DOTDOT,
FTP_HTML_HEADER_SENT,
FTP_BINARY,
- FTP_TRY_SLASH_HACK
+ FTP_TRY_SLASH_HACK,
+ FTP_LISTFORMAT_UNKNOWN
};
static const char *const crlf = "\r\n";
@@ -129,7 +129,7 @@
/* Local functions */
static CNCB ftpConnectDone;
static CNCB ftpPasvCallback;
-static PF ftpReadData;
+static PF ftpDataRead;
static PF ftpStateFree;
static PF ftpTimeout;
static PF ftpReadControlReply;
@@ -137,8 +137,6 @@
static char *ftpGetBasicAuth(const char *);
static void ftpLoginParser(const char *, FtpStateData *);
static wordlist *ftpParseControlReply(char *buf, size_t len, int *code);
-static void ftpRestOrList(FtpStateData * ftpState);
-static void ftpDataTransferDone(FtpStateData * ftpState);
static void ftpAppendSuccessHeader(FtpStateData * ftpState);
static char *ftpAuthRequired(const request_t *, const char *);
static STABH ftpAbort;
@@ -147,6 +145,7 @@
/* State machine functions
* send == state transition
* read == wait for response, and select next state transition
+ * other == Transition logic
*/
static FTPSM ftpReadWelcome;
static FTPSM ftpSendUser;
@@ -163,7 +162,9 @@
static FTPSM ftpReadPort;
static FTPSM ftpSendPasv;
static FTPSM ftpReadPasv;
-static FTPSM ftpTraverseDirectory; /* Selects CWD or RETR */
+static FTPSM ftpTraverseDirectory;
+static FTPSM ftpListDir;
+static FTPSM ftpGetFile;
static FTPSM ftpSendCwd;
static FTPSM ftpReadCwd;
static FTPSM ftpSendList;
@@ -177,6 +178,33 @@
static FTPSM ftpSendQuit;
static FTPSM ftpReadQuit;
static FTPSM ftpFail;
+static FTPSM ftpDataTransferDone;
+static FTPSM ftpRestOrList;
+
+/************************************************
+** State Machine Description (excluding hacks) **
+*************************************************
+From To
+---------------------------------------
+Welcome User
+User Pass
+Pass Type
+Type TraverseDirectory / GetFile
+TraverseDirectory Cwd / GetFile / ListDir
+Cwd TraverseDirectory
+GetFile Mdtm
+Mdtm Size
+Size Pasv
+ListDir Pasv
+Pasv RestOrList
+RestOrList Rest / Retr / Nlst / List
+Rest Retr
+Retr / Nlst / List (ftpDataRead on datachannel)
+(ftpDataRead) ReadTransferDone
+ReadTransferDone DataTransferDone
+DataTransferDone Quit
+Quit -
+************************************************/
FTPSM *FTP_SM_FUNCS[] =
{
@@ -315,6 +343,11 @@
StoreEntry *e = ftpState->entry;
storeBuffer(e);
storeAppendPrintf(e, "</PRE>\n");
+ if (EBIT_TEST(ftpState->flags, FTP_LISTFORMAT_UNKNOWN) && !EBIT_TEST(ftpState->flags, FTP_TRIED_NLST)) {
+ storeAppendPrintf(e, "<A HREF=\"./;type=d\">[As plain directory]</A>\n");
+ } else if (ftpState->typecode=='D') {
+ storeAppendPrintf(e, "<A HREF=\"./\">[As extended directory]</A>\n");
+ }
storeAppendPrintf(e, "<HR>\n");
storeAppendPrintf(e, "<ADDRESS>\n");
storeAppendPrintf(e, "Generated %s, by %s/%s@%s\n",
@@ -380,6 +413,12 @@
for (i = 0; i < MAX_TOKENS; i++)
tokens[i] = (char *) NULL;
xbuf = xstrdup(buf);
+ if (EBIT_TEST(flags, FTP_TRIED_NLST)) {
+ /* Machine readable format, one name per line */
+ p->name=xbuf;
+ p->type='\0';
+ return p;
+ }
for (t = strtok(xbuf, w_space); t && n_tokens < MAX_TOKENS; t = strtok(NULL, w_space))
tokens[n_tokens++] = xstrdup(t);
xfree(xbuf);
@@ -499,7 +538,7 @@
}
static char *
-ftpHtmlifyListEntry(char *line, int flags)
+ftpHtmlifyListEntry(char *line, FtpStateData * ftpState)
{
LOCAL_ARRAY(char, link, 2048 + 40);
LOCAL_ARRAY(char, link2, 2048 + 40);
@@ -507,12 +546,17 @@
LOCAL_ARRAY(char, html, 8192);
size_t width = Config.Ftp.list_width;
ftpListParts *parts;
+ int flags = ftpState->flags;
if (strlen(line) > 1024) {
snprintf(html, 8192, "%s\n", line);
return html;
}
if ((parts = ftpListParseParts(line, flags)) == NULL) {
+ char *p;
snprintf(html, 8192, "%s\n", line);
+ for(p=line;*p && isspace(*p);p++);
+ if (*p && !isspace(*p))
+ EBIT_SET(ftpState->flags, FTP_LISTFORMAT_UNKNOWN);
return html;
}
/* check .. as special case */
@@ -598,6 +642,21 @@
parts->date,
link2);
break;
+ case '\0':
+ snprintf(icon, 2048, "<IMG SRC=\"%s%s\" ALT=\"%-6s\">",
+ "http://internal.squid/icons/",
+ mimeGetIcon(parts->name),
+ "[UNKNOWN]");
+ snprintf(link, 2048, "<A HREF=\"%s\">%s</A>",
+ rfc1738_escape(parts->name),
+ parts->name);
+ snprintf(link2, 2048, "(<A HREF=\"%s/;type=d\">chdir</A>)",
+ rfc1738_escape(parts->name));
+ snprintf(html, 8192, "%s %s %s\n",
+ icon,
+ link,
+ link2);
+ break;
case '-':
default:
snprintf(icon, 2048, "<IMG SRC=\"%s%s\" ALT=\"%-6s\">",
@@ -652,7 +711,7 @@
debug(9, 7) ("%s\n", line);
if (!strncmp(line, "total", 5))
continue;
- t = ftpHtmlifyListEntry(line, ftpState->flags);
+ t = ftpHtmlifyListEntry(line, ftpState);
assert(t != NULL);
storeAppend(e, t, strlen(t));
}
@@ -688,7 +747,7 @@
}
static void
-ftpReadData(int fd, void *data)
+ftpDataRead(int fd, void *data)
{
FtpStateData *ftpState = data;
int len;
@@ -709,7 +768,7 @@
ftpState->data.buf + ftpState->data.offset,
ftpState->data.size - ftpState->data.offset);
fd_bytes(fd, len, FD_READ);
- debug(9, 5) ("ftpReadData: FD %d, Read %d bytes\n", fd, len);
+ debug(9, 5) ("ftpDataRead: FD %d, Read %d bytes\n", fd, len);
if (len > 0) {
IOStats.Ftp.reads++;
for (j = len - 1, bin = 0; j; bin++)
@@ -717,11 +776,11 @@
IOStats.Ftp.read_hist[bin]++;
}
if (len < 0) {
- debug(50, 1) ("ftpReadData: read error: %s\n", xstrerror());
+ debug(50, 1) ("ftpDataRead: read error: %s\n", xstrerror());
if (ignoreErrno(errno)) {
commSetSelect(fd,
COMM_SELECT_READ,
- ftpReadData,
+ ftpDataRead,
data,
Config.Timeout.read);
} else {
@@ -745,7 +804,7 @@
else
commSetSelect(fd,
COMM_SELECT_READ,
- ftpReadData,
+ ftpDataRead,
data,
Config.Timeout.read);
}
@@ -807,6 +866,12 @@
request_t *request = ftpState->request;
int l;
char *t;
+ if ((t = strrchr(request->urlpath, ';')) != NULL) {
+ if (strncasecmp(t + 1, "type=", 5) == 0) {
+ ftpState->typecode = (char) toupper((int) *(t + 6));
+ *t = '\0';
+ }
+ }
l = strlen(request->urlpath);
EBIT_SET(ftpState->flags, FTP_USE_BASE);
/* check for null path */
@@ -823,12 +888,6 @@
if (l == 1)
EBIT_SET(ftpState->flags, FTP_ROOT_DIR);
}
- if ((t = strrchr(request->urlpath, ';')) != NULL) {
- if (strncasecmp(t + 1, "type=", 5) == 0) {
- ftpState->typecode = (char) toupper((int) *(t + 6));
- *t = '\0';
- }
- }
}
static void
@@ -1195,9 +1254,13 @@
case 'I':
break;
default:
- t = strrchr(ftpState->request->urlpath, '/');
- filename = t ? t + 1 : ftpState->request->urlpath;
- mode = mimeGetTransferMode(filename);
+ if (EBIT_TEST(ftpState->flags, FTP_ISDIR)) {
+ mode = 'A';
+ } else {
+ t = strrchr(ftpState->request->urlpath, '/');
+ filename = t ? t + 1 : ftpState->request->urlpath;
+ mode = mimeGetTransferMode(filename);
+ }
break;
}
if (mode == 'I')
@@ -1230,7 +1293,7 @@
if (ftpState->pathcomps)
ftpTraverseDirectory(ftpState);
else
- ftpSendPasv(ftpState);
+ ftpListDir(ftpState);
} else {
ftpFail(ftpState);
}
@@ -1246,13 +1309,7 @@
/* Done? */
if (ftpState->pathcomps == NULL) {
debug(9, 3) ("the final component was a directory\n");
- if (!EBIT_TEST(ftpState->flags, FTP_ISDIR)) {
- debug(9, 3) ("and path did not end in /\n");
- strcat(ftpState->title_url, "/");
- EBIT_SET(ftpState->flags, FTP_ISDIR);
- EBIT_SET(ftpState->flags, FTP_USE_BASE);
- }
- ftpSendPasv(ftpState);
+ ftpListDir(ftpState);
return;
}
/* Go to next path component */
@@ -1265,7 +1322,7 @@
ftpSendCwd(ftpState);
} else {
debug(9, 3) ("final component is probably a file\n");
- ftpSendMdtm(ftpState);
+ ftpGetFile(ftpState);
return;
}
}
@@ -1305,6 +1362,26 @@
}
static void
+ftpGetFile(FtpStateData * ftpState)
+{
+ assert(*ftpState->filepath != '\0');
+ EBIT_CLR(ftpState->flags, FTP_ISDIR);
+ ftpSendMdtm(ftpState);
+}
+
+static void
+ftpListDir(FtpStateData * ftpState)
+{
+ if (!EBIT_TEST(ftpState->flags, FTP_ISDIR)) {
+ debug(9, 3) ("Directory path did not end in /\n");
+ strcat(ftpState->title_url, "/");
+ EBIT_SET(ftpState->flags, FTP_ISDIR);
+ EBIT_SET(ftpState->flags, FTP_USE_BASE);
+ }
+ ftpSendPasv(ftpState);
+}
+
+static void
ftpSendMdtm(FtpStateData * ftpState)
{
assert(*ftpState->filepath != '\0');
@@ -1479,8 +1556,10 @@
{
debug(9, 3) ("This is ftpRestOrList\n");
if (ftpState->typecode == 'D') {
+ /* XXX This should NOT be here */
ftpSendNlst(ftpState); /* sec 3.2.2 of RFC 1738 */
EBIT_SET(ftpState->flags, FTP_ISDIR);
+ EBIT_SET(ftpState->flags, FTP_USE_BASE);
} else if (EBIT_TEST(ftpState->flags, FTP_ISDIR))
ftpSendList(ftpState);
else if (ftpState->restart_offset > 0)
@@ -1516,12 +1595,31 @@
static void
ftpSendList(FtpStateData * ftpState)
{
- snprintf(cbuf, 1024, "LIST\r\n");
+ if (ftpState->filepath) {
+ EBIT_SET(ftpState->flags, FTP_USE_BASE);
+ snprintf(cbuf, 1024, "LIST %s\r\n", ftpState->filepath);
+ } else {
+ snprintf(cbuf, 1024, "LIST\r\n");
+ }
ftpWriteCommand(cbuf, ftpState);
ftpState->state = SENT_LIST;
}
static void
+ftpSendNlst(FtpStateData * ftpState)
+{
+ EBIT_SET(ftpState->flags, FTP_TRIED_NLST);
+ if (ftpState->filepath) {
+ EBIT_SET(ftpState->flags, FTP_USE_BASE);
+ snprintf(cbuf, 1024, "NLST %s\r\n", ftpState->filepath);
+ } else {
+ snprintf(cbuf, 1024, "NLST\r\n");
+ }
+ ftpWriteCommand(cbuf, ftpState);
+ ftpState->state = SENT_NLST;
+}
+
+static void
ftpReadList(FtpStateData * ftpState)
{
int code = ftpState->ctrl.replycode;
@@ -1530,7 +1628,7 @@
ftpAppendSuccessHeader(ftpState);
commSetSelect(ftpState->data.fd,
COMM_SELECT_READ,
- ftpReadData,
+ ftpDataRead,
ftpState,
Config.Timeout.read);
commSetDefer(ftpState->data.fd, protoCheckDeferRead, ftpState->entry);
@@ -1549,18 +1647,6 @@
}
static void
-ftpSendNlst(FtpStateData * ftpState)
-{
- EBIT_SET(ftpState->flags, FTP_TRIED_NLST);
- if (ftpState->filepath)
- snprintf(cbuf, 1024, "NLST %s\r\n", ftpState->filepath);
- else
- snprintf(cbuf, 1024, "NLST\r\n");
- ftpWriteCommand(cbuf, ftpState);
- ftpState->state = SENT_NLST;
-}
-
-static void
ftpSendRetr(FtpStateData * ftpState)
{
assert(ftpState->filepath != NULL);
@@ -1579,7 +1665,7 @@
ftpAppendSuccessHeader(ftpState);
commSetSelect(ftpState->data.fd,
COMM_SELECT_READ,
- ftpReadData,
+ ftpDataRead,
ftpState,
Config.Timeout.read);
commSetDefer(ftpState->data.fd, protoCheckDeferRead, ftpState->entry);
@@ -1651,7 +1737,7 @@
rfc1738_unescape(path);
ftpState->filepath = path;
/* And off we go */
- ftpSendMdtm(ftpState);
+ ftpGetFile(ftpState);
}
static void
@@ -1672,8 +1758,7 @@
{
ErrorState *err;
debug(9, 3) ("ftpFail\n");
- /* Try the / hack to support "Netscape" FTP URL's
- * only if we failed on CWD or RETR, !IS_DIR */
+ /* Try the / hack to support "Netscape" FTP URL's for retreiving files */
if (!EBIT_TEST(ftpState->flags, FTP_ISDIR) &&
!EBIT_TEST(ftpState->flags, FTP_TRY_SLASH_HACK)) {
switch (ftpState->state) {
--------------2BED0C2439DBAC80210B6803
Content-Type: text/plain; charset=us-ascii; name="squid-1.2.beta11.ftp_size.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="squid-1.2.beta11.ftp_size.patch"
Index: squid/src/ftp.c
diff -u squid/src/ftp.c:1.1.1.8.4.1 squid/src/ftp.c:1.1.1.8.4.2
--- squid/src/ftp.c:1.1.1.8.4.1 Wed Jan 7 04:48:02 1998
+++ squid/src/ftp.c Sat Jan 10 21:42:19 1998
@@ -1331,7 +1331,7 @@
{
/* Only send SIZE for binary transfers. The returned size
* is useless on ASCII transfers */
- if (!EBIT_TEST(ftpState->flags, FTP_BINARY)) {
+ if (EBIT_TEST(ftpState->flags, FTP_BINARY)) {
assert(ftpState->filepath != NULL);
assert(*ftpState->filepath != '\0');
snprintf(cbuf, 1024, "SIZE %s\r\n", ftpState->filepath);
--------------2BED0C2439DBAC80210B6803
Content-Type: text/plain; charset=us-ascii; name="squid-1.2.beta11.memmove.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="squid-1.2.beta11.memmove.patch"
Index: squid/makefile.in
diff -u squid/makefile.in:1.1.1.5 squid/makefile.in:1.1.1.5.4.1
--- squid/makefile.in:1.1.1.5 Wed Jan 7 03:51:14 1998
+++ squid/makefile.in Thu Jan 8 06:02:17 1998
@@ -45,7 +45,7 @@
distclean: almostclean
rm -f config.status config.cache
-makefile: makefile.in configure config.status
+makefile: configure config.status makefile.in lib/Makefile.in include/config.h.in src/Makefile.in include/version.h
@echo "Package configuration updated. Cleaning and reconfiguring" ;\
./config.status --recheck;\
./config.status ;\
Index: squid/include/config.h.in
diff -u squid/include/config.h.in:1.1.1.6 squid/include/config.h.in:1.1.1.6.4.1
--- squid/include/config.h.in:1.1.1.6 Wed Jan 7 03:51:18 1998
+++ squid/include/config.h.in Thu Jan 8 05:51:04 1998
@@ -124,8 +124,14 @@
#define xmemcpy(d,s,n) memcpy((d),(s),(n))
#elif HAVE_BCOPY
#define xmemcpy(d,s,n) bcopy((s),(d),(n))
-#else
+#elif HAVE_MEMMOVE
#define xmemcpy(d,s,n) memmove((d),(s),(n))
+#endif
+
+#ifdef HAVE_MEMMOVE
+#define xmemmove(d,s,n) memmove((d),(s),(n))
+#elif HAVE_BCOPY
+#define xmemmove(d,s,n) bcopy((s),(d),(n))
#endif
#if defined(O_NONBLOCK) && !defined(_SQUID_SUNOS_) && !defined(_SQUID_SOLARIS_)
Index: squid/src/client_side.c
diff -u squid/src/client_side.c:1.1.1.9 squid/src/client_side.c:1.1.1.9.4.1
--- squid/src/client_side.c:1.1.1.9 Wed Jan 7 03:51:30 1998
+++ squid/src/client_side.c Thu Jan 8 05:51:10 1998
@@ -1587,7 +1587,7 @@
* data to the beginning
*/
if (conn->in.offset > 0)
- memmove(conn->in.buf, conn->in.buf + http->req_sz, conn->in.offset);
+ xmemmove(conn->in.buf, conn->in.buf + http->req_sz, conn->in.offset);
/* add to the client request queue */
for (H = &conn->chr; *H; H = &(*H)->next);
*H = http;
Index: squid/src/stat.c
diff -u squid/src/stat.c:1.1.1.7 squid/src/stat.c:1.1.1.7.4.1
--- squid/src/stat.c:1.1.1.7 Wed Jan 7 03:51:38 1998
+++ squid/src/stat.c Thu Jan 8 05:51:10 1998
@@ -928,7 +928,7 @@
c->page_faults = rusage_pagefaults(&rusage);
c->cputime = rusage_cputime(&rusage);
c->timestamp = current_time;
- memmove(p, t, (N_COUNT_HIST - 1) * sizeof(StatCounters));
+ xmemmove(p, t, (N_COUNT_HIST - 1) * sizeof(StatCounters));
memcpy(t, c, sizeof(StatCounters));
NCountHist++;
}
Index: squid/test-suite/pconn-banger.c
diff -u squid/test-suite/pconn-banger.c:1.1.1.4 squid/test-suite/pconn-banger.c:1.1.1.4.6.1
--- squid/test-suite/pconn-banger.c:1.1.1.4 Fri Jan 2 11:58:14 1998
+++ squid/test-suite/pconn-banger.c Thu Jan 8 05:51:13 1998
@@ -279,7 +279,7 @@
}
if (len) {
assert(bytes_used > 0);
- memmove(buf, buf + bytes_used, len);
+ xmemmove(buf, buf + bytes_used, len);
return handle_read(buf, len);
}
}
--------------2BED0C2439DBAC80210B6803
Content-Type: text/plain; charset=us-ascii; name="squid-1.2.beta11.vhost_acceleration.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="squid-1.2.beta11.vhost_acceleration.patch"
Index: squid/src/client_side.c
diff -u squid/src/client_side.c:1.1.1.9.4.1 squid/src/client_side.c:1.1.1.9.4.2
--- squid/src/client_side.c:1.1.1.9.4.1 Thu Jan 8 05:51:10 1998
+++ squid/src/client_side.c Sat Jan 10 01:29:13 1998
@@ -1454,16 +1454,7 @@
/* see if we running in Config2.Accel.on, if so got to convert it to URL */
if (Config2.Accel.on && *url == '/') {
/* prepend the accel prefix */
- if (vhost_mode) {
- /* Put the local socket IP address as the hostname */
- url_sz = strlen(url) + 32 + Config.appendDomainLen;
- http->uri = xcalloc(url_sz, 1);
- snprintf(http->uri, url_sz, "http://%s:%d%s",
- inet_ntoa(http->conn->me.sin_addr),
- (int) Config.Accel.port,
- url);
- debug(12, 5) ("VHOST REWRITE: '%s'\n", http->uri);
- } else if (opt_accel_uses_host && (t = mime_get_header(req_hdr, "Host"))) {
+ if (opt_accel_uses_host && (t = mime_get_header(req_hdr, "Host"))) {
/* If a Host: header was specified, use it to build the URL
* instead of the one in the Config file. */
/*
@@ -1478,6 +1469,15 @@
http->uri = xcalloc(url_sz, 1);
snprintf(http->uri, url_sz, "http://%s:%d%s",
t, (int) Config.Accel.port, url);
+ } else if (vhost_mode) {
+ /* Put the local socket IP address as the hostname */
+ url_sz = strlen(url) + 32 + Config.appendDomainLen;
+ http->uri = xcalloc(url_sz, 1);
+ snprintf(http->uri, url_sz, "http://%s:%d%s",
+ inet_ntoa(http->conn->me.sin_addr),
+ (int) Config.Accel.port,
+ url);
+ debug(12, 5) ("VHOST REWRITE: '%s'\n", http->uri);
} else {
url_sz = strlen(Config2.Accel.prefix) + strlen(url) +
Config.appendDomainLen + 1;
--------------2BED0C2439DBAC80210B6803--
Received on Tue Jul 29 2003 - 13:15:45 MDT
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:11:34 MST