/*
- * $Id: ftp.cc,v 1.207 1998/03/16 18:21:41 wessels Exp $
+ * $Id: ftp.cc,v 1.208 1998/03/16 21:59:58 wessels Exp $
*
* DEBUG: section 9 File Transfer Protocol (FTP)
* AUTHOR: Harvest Derived
}
/* check .. as special case */
if (!strcmp(parts->name, "..")) {
- snprintf(icon, 2048, "<IMG BORDER=0 SRC=\"%s%s\" ALT=\"%-6s\">",
- "http://internal.squid/icons/",
- ICON_DIRUP,
- "[DIR]");
+ snprintf(icon, 2048, "<IMG BORDER=0 SRC=\"%s\" ALT=\"%-6s\">",
+ mimeGetIconURL("internal-dirup"),
+ "[DIRUP]");
if (!EBIT_TEST(flags, FTP_NO_DOTDOT) && !EBIT_TEST(flags, FTP_ROOT_DIR)) {
/* Normal directory */
snprintf(link, 2048, "<A HREF=\"%s\">%s</A>",
}
switch (parts->type) {
case 'd':
- snprintf(icon, 2048, "<IMG SRC=\"%s%s\" ALT=\"%-6s\">",
- "http://internal.squid/icons/",
- ICON_MENU,
+ snprintf(icon, 2048, "<IMG SRC=\"%s\" ALT=\"%-6s\">",
+ mimeGetIconURL("internal-dir"),
"[DIR]");
snprintf(link, 2048, "<A HREF=\"%s/\">%s</A>%s",
rfc1738_escape(parts->name),
parts->date);
break;
case 'l':
- snprintf(icon, 2048, "<IMG SRC=\"%s%s\" ALT=\"%-6s\">",
- "http://internal.squid/icons/",
- ICON_LINK,
+ snprintf(icon, 2048, "<IMG SRC=\"%s\" ALT=\"%-6s\">",
+ mimeGetIconURL("internal-link"),
"[LINK]");
snprintf(link, 2048, "<A HREF=\"%s\">%s</A>%s",
rfc1738_escape(parts->name),
link2);
break;
case '\0':
- snprintf(icon, 2048, "<IMG SRC=\"%s%s\" ALT=\"%-6s\">",
- "http://internal.squid/icons/",
- mimeGetIcon(parts->name),
+ snprintf(icon, 2048, "<IMG SRC=\"%s\" ALT=\"%-6s\">",
+ mimeGetIconURL(parts->name),
"[UNKNOWN]");
snprintf(link, 2048, "<A HREF=\"%s\">%s</A>",
rfc1738_escape(parts->name),
break;
case '-':
default:
- snprintf(icon, 2048, "<IMG SRC=\"%s%s\" ALT=\"%-6s\">",
- "http://internal.squid/icons/",
- mimeGetIcon(parts->name),
+ snprintf(icon, 2048, "<IMG SRC=\"%s\" ALT=\"%-6s\">",
+ mimeGetIconURL(parts->name),
"[FILE]");
snprintf(link, 2048, "<A HREF=\"%s\">%s</A>%s",
rfc1738_escape(parts->name),
if (EBIT_TEST(ftpState->flags, FTP_HTML_HEADER_SENT))
ftpListingFinish(ftpState);
if (!EBIT_TEST(ftpState->flags, FTP_PUT)) {
- storeTimestampsSet(ftpState->entry);
- storeComplete(ftpState->entry);
+ storeTimestampsSet(ftpState->entry);
+ storeComplete(ftpState->entry);
}
/* expect the "transfer complete" message on the control socket */
commSetSelect(ftpState->ctrl.fd,
EBIT_SET(ftpState->flags, FTP_PASV_SUPPORTED);
EBIT_SET(ftpState->flags, FTP_REST_SUPPORTED);
if (ftpState->request->method == METHOD_PUT)
- EBIT_SET(ftpState->flags, FTP_PUT);
+ EBIT_SET(ftpState->flags, FTP_PUT);
if (!ftpCheckAuth(ftpState, request->headers)) {
/* This request is not fully authenticated */
if (request->port == 21) {
ftpState->ctrl.last_reply = (*W)->key;
safe_free(*W);
ftpState->ctrl.offset = 0;
- debug(9,8)("ftpReadControlReply: state=%d\n",ftpState->state);
+ debug(9, 8) ("ftpReadControlReply: state=%d\n", ftpState->state);
FTP_SM_FUNCS[ftpState->state] (ftpState);
}
ftpTraverseDirectory(ftpState);
} else {
/* CWD FAILED */
- if (!EBIT_TEST(ftpState->flags, FTP_PUT))
- ftpFail(ftpState);
+ if (!EBIT_TEST(ftpState->flags, FTP_PUT))
+ ftpFail(ftpState);
else
- ftpTryMkdir(ftpState);
+ ftpTryMkdir(ftpState);
}
}
static void
-ftpTryMkdir(FtpStateData *ftpState)
+ftpTryMkdir(FtpStateData * ftpState)
{
- char *path=ftpState->filepath;
- debug(9,3)("ftpTryMkdir: with path=%s\n",path);
- snprintf(cbuf, 1024, "MKD %s\r\n", path);
- ftpWriteCommand(cbuf, ftpState);
- ftpState->state = SENT_MKDIR;
+ char *path = ftpState->filepath;
+ debug(9, 3) ("ftpTryMkdir: with path=%s\n", path);
+ snprintf(cbuf, 1024, "MKD %s\r\n", path);
+ ftpWriteCommand(cbuf, ftpState);
+ ftpState->state = SENT_MKDIR;
}
static void
-ftpReadMkdir(FtpStateData *ftpState)
-{
- char *path=ftpState->filepath;
- int code = ftpState->ctrl.replycode;
-
- debug(9,3)("Here, with code %d\n",path,code);
- if (code==257) { /* success */
- ftpSendCwd(ftpState);
- } else if (code==550) { /* dir exists */
- if (EBIT_TEST(ftpState->flags, FTP_PUT_MKDIR)) {
- EBIT_SET(ftpState->flags, FTP_PUT_MKDIR);
- ftpSendCwd(ftpState);
- } else
- ftpSendReply(ftpState);
- } else ftpSendReply(ftpState);
+ftpReadMkdir(FtpStateData * ftpState)
+{
+ char *path = ftpState->filepath;
+ int code = ftpState->ctrl.replycode;
+
+ debug(9, 3) ("Here, with code %d\n", path, code);
+ if (code == 257) { /* success */
+ ftpSendCwd(ftpState);
+ } else if (code == 550) { /* dir exists */
+ if (EBIT_TEST(ftpState->flags, FTP_PUT_MKDIR)) {
+ EBIT_SET(ftpState->flags, FTP_PUT_MKDIR);
+ ftpSendCwd(ftpState);
+ } else
+ ftpSendReply(ftpState);
+ } else
+ ftpSendReply(ftpState);
}
static void
debug(9, 3) ("This is ftpRestOrList\n");
if (EBIT_TEST(ftpState->flags, FTP_PUT)) {
- debug(9,3)("ftpRestOrList: Sending STOR request...\n");
+ debug(9, 3) ("ftpRestOrList: Sending STOR request...\n");
ftpSendStor(ftpState);
} else if (ftpState->typecode == 'D') {
/* XXX This should NOT be here */
ftpPutStart(FtpStateData * ftpState)
{
debug(9, 3) ("ftpPutStart\n");
- pumpStart(ftpState->data.fd, ftpState->entry ,
- ftpState->request, ftpPutTransferDone, ftpState);
+ pumpStart(ftpState->data.fd, ftpState->entry,
+ ftpState->request, ftpPutTransferDone, ftpState);
}
-static void
+static void
ftpPutTransferDone(int fd, char *bufnotused, size_t size, int errflag, void *data)
{
- FtpStateData * ftpState=(FtpStateData *)data;
+ FtpStateData *ftpState = (FtpStateData *) data;
if (ftpState->data.fd >= 0) {
- comm_close(ftpState->data.fd);
- ftpState->data.fd = -1;
+ comm_close(ftpState->data.fd);
+ ftpState->data.fd = -1;
}
ftpReadComplete(ftpState);
}
/*
- * $Id: gopher.cc,v 1.122 1998/03/05 00:42:53 wessels Exp $
+ * $Id: gopher.cc,v 1.123 1998/03/16 21:59:58 wessels Exp $
*
* DEBUG: section 10 Gopher
* AUTHOR: Harvest Derived
char *host = NULL;
char *port = NULL;
char *escaped_selector = NULL;
- char *icon_type = NULL;
+ char *icon_url = NULL;
char gtype;
StoreEntry *entry = NULL;
switch (gtype) {
case GOPHER_DIRECTORY:
- icon_type = "internal-gopher-menu";
+ icon_url = mimeGetIconURL("internal-menu");
break;
case GOPHER_FILE:
- icon_type = "internal-gopher-text";
+ icon_url = mimeGetIconURL("internal-text");
break;
case GOPHER_INDEX:
case GOPHER_CSO:
- icon_type = "internal-gopher-index";
+ icon_url = mimeGetIconURL("internal-index");
break;
case GOPHER_IMAGE:
case GOPHER_GIF:
case GOPHER_PLUS_IMAGE:
- icon_type = "internal-gopher-image";
+ icon_url = mimeGetIconURL("internal-image");
break;
case GOPHER_SOUND:
case GOPHER_PLUS_SOUND:
- icon_type = "internal-gopher-sound";
+ icon_url = mimeGetIconURL("internal-sound");
break;
case GOPHER_PLUS_MOVIE:
- icon_type = "internal-gopher-movie";
+ icon_url = mimeGetIconURL("internal-movie");
break;
case GOPHER_TELNET:
case GOPHER_3270:
- icon_type = "internal-gopher-telnet";
+ icon_url = mimeGetIconURL("internal-telnet");
break;
case GOPHER_BIN:
case GOPHER_MACBINHEX:
case GOPHER_DOSBIN:
case GOPHER_UUENCODED:
- icon_type = "internal-gopher-binary";
+ icon_url = mimeGetIconURL("internal-binary");
break;
default:
- icon_type = "internal-gopher-unknown";
+ icon_url = mimeGetIconURL("internal-unknown");
break;
}
if ((gtype == GOPHER_TELNET) || (gtype == GOPHER_3270)) {
if (strlen(escaped_selector) != 0)
snprintf(tmpbuf, TEMP_BUF_SIZE, "<IMG BORDER=0 SRC=\"%s\"> <A HREF=\"telnet://%s@%s/\">%s</A>\n",
- icon_type, escaped_selector, host, name);
+ icon_url, escaped_selector, host, name);
else
snprintf(tmpbuf, TEMP_BUF_SIZE, "<IMG BORDER=0 SRC=\"%s\"> <A HREF=\"telnet://%s/\">%s</A>\n",
- icon_type, host, name);
+ icon_url, host, name);
} else {
snprintf(tmpbuf, TEMP_BUF_SIZE, "<IMG BORDER=0 SRC=\"%s\"> <A HREF=\"gopher://%s/%c%s\">%s</A>\n",
- icon_type, host, gtype, escaped_selector, name);
+ icon_url, host, gtype, escaped_selector, name);
}
safe_free(escaped_selector);
strcat(outbuf, tmpbuf);