From: Stefan Fritsch Date: Mon, 17 Oct 2011 12:16:59 +0000 (+0000) Subject: Increase the max line length from 2k to 128k and allocate the buffer on the X-Git-Tag: 2.3.15~117 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4e0a7dc320c17087adac46cff1c6ff32d21b3447;p=thirdparty%2Fapache%2Fhttpd.git Increase the max line length from 2k to 128k and allocate the buffer on the heap. Every log line has an URL and one or more HTTP headers. Each can be 8k long. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1185119 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/support/logresolve.c b/support/logresolve.c index c746bb5f372..b0ba6ec1d15 100644 --- a/support/logresolve.c +++ b/support/logresolve.c @@ -68,9 +68,9 @@ #include #endif -#define READ_BUF_SIZE 10240 -#define WRITE_BUF_SIZE 10240 -#define LINE_BUF_SIZE 2048 +#define READ_BUF_SIZE 128*1024 +#define WRITE_BUF_SIZE 128*1024 +#define LINE_BUF_SIZE 128*1024 static apr_file_t *errfile; static const char *shortname = "logresolve"; @@ -140,7 +140,7 @@ int main(int argc, const char * const argv[]) char * stats = NULL; char * inbuffer; char * outbuffer; - char line[LINE_BUF_SIZE]; + char * line; int doublelookups = 0; if (apr_app_initialize(&argc, &argv, NULL) != APR_SUCCESS) { @@ -189,8 +189,9 @@ int main(int argc, const char * const argv[]) apr_file_open_stdin(&infile, pool); /* Allocate two new 10k file buffers */ - if ((outbuffer = apr_palloc(pool, WRITE_BUF_SIZE)) == NULL || - (inbuffer = apr_palloc(pool, READ_BUF_SIZE)) == NULL) { + if ( (outbuffer = apr_palloc(pool, WRITE_BUF_SIZE)) == NULL + || (inbuffer = apr_palloc(pool, READ_BUF_SIZE)) == NULL + || (line = apr_palloc(pool, LINE_BUF_SIZE)) == NULL) { return 1; } @@ -203,7 +204,7 @@ int main(int argc, const char * const argv[]) return 1; } - while (apr_file_gets(line, sizeof(line), infile) == APR_SUCCESS) { + while (apr_file_gets(line, LINE_BUF_SIZE, infile) == APR_SUCCESS) { char *hostname; char *space; apr_sockaddr_t *ip;