From: Amos Jeffries Date: Fri, 7 Nov 2008 05:00:30 +0000 (+1300) Subject: Updates auto-save X-Git-Tag: SQUID_3_2_0_1~1255^2~43 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=144bfdf954b4d3bc7b362bf0e8d0aa5af6276bc9;p=thirdparty%2Fsquid.git Updates auto-save --- diff --git a/src/errorpage.cc b/src/errorpage.cc index 9e333a7f2a..0ba9f5d0b8 100644 --- a/src/errorpage.cc +++ b/src/errorpage.cc @@ -660,7 +660,7 @@ ErrorState::Convert(char token) if(ftp.server_msg) wordlistCat(ftp.server_msg, &mb); else if(ftp.listing) - mb.append(ftp.listing); + mb.append(ftp.listing->content(), ftp.listing->contentSize()); break; diff --git a/src/ftp.cc b/src/ftp.cc index a452b881ee..3001318d2f 100644 --- a/src/ftp.cc +++ b/src/ftp.cc @@ -176,7 +176,7 @@ public: char *old_reply; char *old_filepath; char typecode; - MemBuf listing; + MemBuf listing; ///< FTP directory listing in HTML format. // \todo: optimize ctrl and data structs member order, to minimize size /// FTP control channel info; the channel is opened once per transaction @@ -218,8 +218,8 @@ public: void scheduleReadControlReply(int); void handleControlReply(); void readStor(); - char *htmlifyListEntry(const char *line); void parseListing(); + MemBuf *htmlifyListEntry(const char *line); void dataComplete(); void dataRead(const CommIoCbParams &io); int checkAuth(const HttpHeader * req_hdr); @@ -563,11 +563,6 @@ FtpStateData::ftpTimeout(const CommTimeoutCbParams &io) /* failed() closes ctrl.fd and frees ftpState */ } -void -FtpStateData::listingStart() -{ -} - #if DEAD_CODE // obsoleted by ERR_FTP_LISTING template. void FtpStateData::listingFinish() @@ -893,10 +888,11 @@ FtpStateData::htmlifyListEntry(const char *line) MemBuf *html; char prefix[2048]; ftpListParts *parts; - *icon = *href = *text = *size = *chdir = *view = *download = *link = *html = '\0'; + *icon = *href = *text = *size = *chdir = *view = *download = *link = '\0'; if (strlen(line) > 1024) { - html->Printf("%s\n", line); + html = new MemBuf(); + html->Printf("%s\n", line); return html; } @@ -926,13 +922,6 @@ FtpStateData::htmlifyListEntry(const char *line) parts->size >>= 10; parts->showname = xstrdup(parts->name); - if (!Config.Ftp.list_wrap) { - if (strlen(parts->showname) > width - 1) { - *(parts->showname + width - 1) = '>'; - *(parts->showname + width - 0) = '\0'; - } - } - /* {icon} {text} . . . {date}{size}{chdir}{view}{download}{link}\n */ xstrncpy(href, rfc1738_escape_part(parts->name), 2048); @@ -1002,8 +991,8 @@ FtpStateData::htmlifyListEntry(const char *line) html->Printf("" "%s" "%s" - "%s" - "%s" + "%s" + "%s" "%s%s%s%s" "\n", prefix, href, icon, @@ -1024,7 +1013,7 @@ FtpStateData::parseListing() char *end; char *line; char *s; - char *t; + MemBuf *t; size_t linelen; size_t usable; StoreEntry *e = entry;