From: Amos Jeffries Date: Fri, 7 Nov 2008 11:00:58 +0000 (+1300) Subject: Updates auto-save X-Git-Tag: SQUID_3_2_0_1~1255^2~42 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f8fae64c449ad000eee75086b37d0da4951d258e;p=thirdparty%2Fsquid.git Updates auto-save --- diff --git a/src/cache_cf.cc b/src/cache_cf.cc index 1034576d65..fb889c6245 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -2475,11 +2475,13 @@ free_time_t(time_t * var) *var = 0; } +#if UNUSED_CODE static void dump_size_t(StoreEntry * entry, const char *name, size_t var) { storeAppendPrintf(entry, "%s %d\n", name, (int) var); } +#endif static void dump_b_size_t(StoreEntry * entry, const char *name, size_t var) @@ -2507,6 +2509,7 @@ dump_kb_int64_t(StoreEntry * entry, const char *name, int64_t var) storeAppendPrintf(entry, "%s %"PRId64" %s\n", name, var, B_KBYTES_STR); } +#if UNUSED_CODE static void parse_size_t(size_t * var) { @@ -2514,6 +2517,7 @@ parse_size_t(size_t * var) i = GetInteger(); *var = (size_t) i; } +#endif static void parse_b_size_t(size_t * var) diff --git a/src/cf.data.pre b/src/cf.data.pre index 9b63091ff5..4c6a8ba5e4 100644 --- a/src/cf.data.pre +++ b/src/cf.data.pre @@ -2640,16 +2640,6 @@ DOC_START (for example perl.com). DOC_END -NAME: ftp_list_width -TYPE: size_t -DEFAULT: 32 -LOC: Config.Ftp.list_width -DOC_START - Sets the width of ftp listings. This should be set to fit in - the width of a standard browser. Setting this too small - can cut off long filenames when browsing ftp sites. -DOC_END - NAME: ftp_passive TYPE: onoff DEFAULT: on diff --git a/src/enums.h b/src/enums.h index 559c0ee8c4..4e453ecf33 100644 --- a/src/enums.h +++ b/src/enums.h @@ -98,6 +98,7 @@ typedef enum { ERR_ESI, /* Failure to perform ESI processing */ ERR_INVALID_RESP, ERR_ICAP_FAILURE, + ERR_FTP_LISTING, /* Display of FTP remote directory */ ERR_MAX } err_type; diff --git a/src/errorpage.cc b/src/errorpage.cc index 0ba9f5d0b8..b3b5c9881c 100644 --- a/src/errorpage.cc +++ b/src/errorpage.cc @@ -812,7 +812,7 @@ ErrorState::Convert(char token) if (dnsserver_msg) p = dnsserver_msg; else if (ftp.cwd_msg) - p = ftp.cwd_msg; + wordlistCat(ftp.cwd_msg, &mb); else p = "[unknown]"; diff --git a/src/ftp.cc b/src/ftp.cc index 3001318d2f..d1fa22e442 100644 --- a/src/ftp.cc +++ b/src/ftp.cc @@ -107,13 +107,12 @@ struct _ftp_flags bool dir_slash; bool root_dir; bool no_dotdot; - bool html_header_sent; bool binary; bool try_slash_hack; bool put; bool put_mkdir; bool listformat_unknown; - bool listing_started; + bool listing; bool completed_forwarding; }; @@ -567,9 +566,6 @@ FtpStateData::ftpTimeout(const CommTimeoutCbParams &io) void FtpStateData::listingFinish() { - debugs(9,3,HERE); - entry->buffer(); -/* // TODO: figure out what this means and how to show it ... @@ -580,7 +576,6 @@ FtpStateData::listingFinish() const char *path = flags.dir_slash ? filepath : "."; printfReplyBody("[As extended directory]\n", rfc1738_escape_part(path)); } -*/ } #endif /* DEAD_CODE */ @@ -852,28 +847,6 @@ found: return p; } -/// \ingroup ServerProtocolFTPInternal -static const char * -dots_fill(size_t len) -{ - static char buf[256]; - size_t i = 0; - - if (len > Config.Ftp.list_width) { - memset(buf, ' ', 256); - buf[0] = '\n'; - buf[Config.Ftp.list_width + 4] = '\0'; - return buf; - } - - for (i = len; i < Config.Ftp.list_width; i++) - buf[i - len] = (i % 2) ? '.' : ' '; - - buf[i - len] = '\0'; - - return buf; -} - MemBuf * FtpStateData::htmlifyListEntry(const char *line) { @@ -1207,7 +1180,7 @@ FtpStateData::dataRead(const CommIoCbParams &io) maybeReadVirginBody(); } else { - if (!flags.http_header_sent && !fwd->ftpPasvFailed() && flags.pasv_supported) { + if (!flags.http_header_sent && !fwd->ftpPasvFailed() && flags.pasv_supported && !flags.listing) { fwd->dontRetry(false); /* this is a retryable error */ fwd->ftpPasvFailed(true); } @@ -1267,28 +1240,12 @@ FtpStateData::processReplyBody() if (flags.isdir) { -/* -// TODO: do we still need this in header? - if (flags.need_base_href) - printfReplyBody("\n", html_quote(base_href.buf())); -*/ - - if (cwd_message) { - String tmp; - for (wordlist *w = cwd_message; w; w = w->next) { - tmp.append(html_quote(w->key)); - tmp.append("\n"); - } - err_message = xstrdup(tmp.buf()); - } - - flags.html_header_sent = 1; - + flags.listing = 1; + safe_delete(listing); parseListing(); return; - } else - if (const int csize = data.readBuf->contentSize()) { + } else if (const int csize = data.readBuf->contentSize()) { writeReplyBody(data.readBuf->content(), csize); debugs(9, 5, HERE << "consuming " << csize << " bytes of readBuf"); data.readBuf->consume(csize); @@ -3190,7 +3147,7 @@ ftpReadTransferDone(FtpStateData * ftpState) if (code == 226 || code == 250) { /* Connection closed; retrieval done. */ - if (ftpState->flags.html_header_sent) + if (ftpState->flags.listing) ftpState->failed(ERR_FTP_LISTING, 0); ftpSendQuit(ftpState); } else { /* != 226 */ @@ -3421,13 +3378,13 @@ FtpStateData::failedErrorMessage(err_type error, int xerrno) if(error == ERR_FTP_LISTING) { err->ftp.listing = &listing; + err->ftp.cwd_msg = cwd_message; } else { err->ftp.server_msg = ctrl.message; ctrl.message = NULL; } - if (old_request) command = old_request; else