You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by sf...@apache.org on 2011/10/17 14:16:59 UTC

svn commit: r1185119 - /httpd/httpd/trunk/support/logresolve.c

Author: sf
Date: Mon Oct 17 12:16:59 2011
New Revision: 1185119

URL: http://svn.apache.org/viewvc?rev=1185119&view=rev
Log:
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.

Modified:
    httpd/httpd/trunk/support/logresolve.c

Modified: httpd/httpd/trunk/support/logresolve.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/support/logresolve.c?rev=1185119&r1=1185118&r2=1185119&view=diff
==============================================================================
--- httpd/httpd/trunk/support/logresolve.c (original)
+++ httpd/httpd/trunk/support/logresolve.c Mon Oct 17 12:16:59 2011
@@ -68,9 +68,9 @@
 #include <stdlib.h>
 #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 ar
     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 ar
     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 ar
         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;