You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Colm MacCarthaigh <co...@stdlib.net> on 2005/08/08 16:24:44 UTC

[PATCH] add User-Agent to dummy connection

Working on mpm stuff now, everytime I start apache with worker on trunk
, I get;

::1 - - [08/Aug/2005:11:56:58 +0100] "GET / HTTP/1.0" 200 3089 "-" "-" 1966
::1 - - [08/Aug/2005:11:56:59 +0100] "GET / HTTP/1.0" 200 3089 "-" "-" 3856
::1 - - [08/Aug/2005:11:57:00 +0100] "GET / HTTP/1.0" 200 3089 "-" "-" 2389
::1 - - [08/Aug/2005:11:57:01 +0100] "GET / HTTP/1.0" 200 3089 "-" "-" 2192
::1 - - [08/Aug/2005:11:57:02 +0100] "GET / HTTP/1.0" 200 3089 "-" "-" 2741
::1 - - [08/Aug/2005:11:57:03 +0100] "GET / HTTP/1.0" 200 3089 "-" "-" 2631
::1 - - [08/Aug/2005:11:57:04 +0100] "GET / HTTP/1.0" 200 3089 "-" "-" 2422
::1 - - [08/Aug/2005:11:57:05 +0100] "GET / HTTP/1.0" 200 3089 "-" "-" 2250
::1 - - [08/Aug/2005:11:57:06 +0100] "GET / HTTP/1.0" 200 3089 "-" "-" 1996

Which is pretty confusing imo for administrators (it was for me), patch
gives the dummy connections a User-Agent: header, so that the
administrator can determine that they don't have some errant local
process;

::1 - - [08/Aug/2005:14:12:56 +0100] "GET / HTTP/1.0" 200 3089 "-" "Apache/2.3.0-dev (Unix) (internal dummy connection)" 2591
::1 - - [08/Aug/2005:14:12:57 +0100] "GET / HTTP/1.0" 200 3089 "-" "Apache/2.3.0-dev (Unix) (internal dummy connection)" 2560
::1 - - [08/Aug/2005:14:12:58 +0100] "GET / HTTP/1.0" 200 3089 "-" "Apache/2.3.0-dev (Unix) (internal dummy connection)" 2951
::1 - - [08/Aug/2005:14:12:59 +0100] "GET / HTTP/1.0" 200 3089 "-" "Apache/2.3.0-dev (Unix) (internal dummy connection)" 4123
::1 - - [08/Aug/2005:14:13:00 +0100] "GET / HTTP/1.0" 200 3089 "-" "Apache/2.3.0-dev (Unix) (internal dummy connection)" 2020
::1 - - [08/Aug/2005:14:13:01 +0100] "GET / HTTP/1.0" 200 3089 "-" "Apache/2.3.0-dev (Unix) (internal dummy connection)" 2157
::1 - - [08/Aug/2005:14:13:02 +0100] "GET / HTTP/1.0" 200 3089 "-" "Apache/2.3.0-dev (Unix) (internal dummy connection)" 2296
::1 - - [08/Aug/2005:14:13:03 +0100] "GET / HTTP/1.0" 200 3089 "-" "Apache/2.3.0-dev (Unix) (internal dummy connection)" 5112
::1 - - [08/Aug/2005:14:13:04 +0100] "GET / HTTP/1.0" 200 3089 "-" "Apache/2.3.0-dev (Unix) (internal dummy connection)" 5426


-- 
Colm MacCárthaigh                        Public Key: colm+pgp@stdlib.net

Re: [PATCH] add User-Agent to dummy connection

Posted by Paul Querna <ch...@force-elite.com>.
Colm MacCarthaigh wrote:
> On Mon, Aug 08, 2005 at 03:24:44PM +0100, Colm MacCarthaigh wrote:
> 
>>Which is pretty confusing imo for administrators (it was for me), patch
>>gives the dummy connections a User-Agent: header, so that the
>>administrator can determine that they don't have some errant local
>>process;

Thanks, committed to trunk in r230808.

-Paul

Re: [PATCH] add User-Agent to dummy connection

Posted by Colm MacCarthaigh <co...@stdlib.net>.
On Mon, Aug 08, 2005 at 04:42:09PM +0100, Colm MacCarthaigh wrote:
> On Mon, Aug 08, 2005 at 11:29:59AM -0400, Brian Akins wrote:
> > maybe just make it static like:
> > 
> > static char *srequest = NULL;
> 
> or;
> 
> const char *srequest = "GET / HTTP/1.0\r\n"
>                        "User-Agent: " AP_SERVER_BASEVERSION
>                        " (dummy connection)\r\n\r\n";

Actually, I definitely think this is a better idea, since the pool is
destroyed at the end of the function, taking any guarantees about the
string contents with it.

-- 
Colm MacCárthaigh                        Public Key: colm+pgp@stdlib.net

Re: [PATCH] add User-Agent to dummy connection

Posted by Colm MacCarthaigh <co...@stdlib.net>.
On Mon, Aug 08, 2005 at 11:29:59AM -0400, Brian Akins wrote:
> Colm MacCarthaigh wrote:
> >On Mon, Aug 08, 2005 at 03:24:44PM +0100, Colm MacCarthaigh wrote:
> 
> >+    srequest = apr_pstrcat(p, "GET / HTTP/1.0\r\nUser-Agent: ", 
> >+                           ap_get_server_version(), 
> >+                           " (internal dummy connection)\r\n\r\n", NULL);
> 
> Shouldn't this string only be created once for the lifetime of the 
> server? 

I was worred about the output of ap_get_server_version changing over
time, but actually looking at the core, that now seems stupid (I'd
incorrectly assumed things like mod_security might touch it, like
they do the Signature). 

In fact, I'm not really sure if it's worth running at all.

AP_SERVER_BASEVERSION is probably good enough, the administrators are
going to know their component, and it gets rid of the double bracket
component.

>  It seems like a wast of cycles and memory to alloc it each time.
> 
> maybe just make it static like:
> 
> static char *srequest = NULL;

or;

const char *srequest = "GET / HTTP/1.0\r\n"
                       "User-Agent: " AP_SERVER_BASEVERSION
                       " (dummy connection)\r\n\r\n";

-- 
Colm MacCárthaigh                        Public Key: colm+pgp@stdlib.net

Re: [PATCH] add User-Agent to dummy connection

Posted by Brian Akins <ba...@web.turner.com>.
Colm MacCarthaigh wrote:
> On Mon, Aug 08, 2005 at 03:24:44PM +0100, Colm MacCarthaigh wrote:

> +    srequest = apr_pstrcat(p, "GET / HTTP/1.0\r\nUser-Agent: ", 
> +                           ap_get_server_version(), 
> +                           " (internal dummy connection)\r\n\r\n", NULL);

Shouldn't this string only be created once for the lifetime of the 
server?  It seems like a wast of cycles and memory to alloc it each time.

maybe just make it static like:

static char *srequest = NULL;

if(!srequest) {
	srequest = /*do strcat stuff*/
}

or something along the same lines.


-- 
Brian Akins
Lead Systems Engineer
CNN Internet Technologies

Re: [PATCH] add User-Agent to dummy connection

Posted by Colm MacCarthaigh <co...@stdlib.net>.
On Mon, Aug 08, 2005 at 03:24:44PM +0100, Colm MacCarthaigh wrote:
> Which is pretty confusing imo for administrators (it was for me), patch
> gives the dummy connections a User-Agent: header, so that the
> administrator can determine that they don't have some errant local
> process;

Of course it's actually attached this time.

-- 
Colm MacCárthaigh                        Public Key: colm+pgp@stdlib.net