Squid-2.2.STABLE2: Change log_mime_hrds output to be human readable Don't encode more than what is needed to be able to parse the line without ambiguity, and encode \r and \n as "\n" and "\r". Index: squid/src/access_log.c diff -u squid/src/access_log.c:1.1.1.24 squid/src/access_log.c:1.1.1.24.4.1 --- squid/src/access_log.c:1.1.1.24 Tue Apr 20 17:26:00 1999 +++ squid/src/access_log.c Thu Apr 29 23:36:51 1999 @@ -135,8 +135,18 @@ * more readable. */ while ((c = *(const unsigned char *) header++) != '\0') { +#if !OLD_LOG_MIME + if (c == '\r') { + *buf_cursor++ = '\\'; + *buf_cursor++ = 'r'; + } else if (c == '\n') { + *buf_cursor++ = '\\'; + *buf_cursor++ = 'n'; + } else +#endif if (c <= 0x1F || c >= 0x7F +#if OLD_LOG_MIME || c == '"' || c == '#' || c == '%' @@ -151,12 +161,18 @@ || c == '^' || c == '~' || c == '`' +#endif || c == '[' || c == ']') { *buf_cursor++ = '%'; i = c * 2; *buf_cursor++ = c2x[i]; *buf_cursor++ = c2x[i + 1]; +#if !OLD_LOG_MIME + } else if (c == '\\') { + *buf_cursor++ = '\\'; + *buf_cursor++ = '\\'; +#endif } else { *buf_cursor++ = (char) c; }