Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Apache: Dev

[PATCH] add User-Agent to dummy connection

 

 

Apache dev RSS feed   Index | Next | Previous | View Threaded


colm at stdlib

Aug 8, 2005, 7:24 AM

Post #1 of 6 (1682 views)
Permalink
[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 [at] stdlib


colm at stdlib

Aug 8, 2005, 7:26 AM

Post #2 of 6 (1605 views)
Permalink
Re: [PATCH] add User-Agent to dummy connection [In reply to]

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 [at] stdlib
Attachments: dummy-uagent.patch (1.06 KB)


chip at force-elite

Aug 8, 2005, 7:38 AM

Post #3 of 6 (1611 views)
Permalink
Re: [PATCH] add User-Agent to dummy connection [In reply to]

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


bakins at web

Aug 8, 2005, 8:29 AM

Post #4 of 6 (1597 views)
Permalink
Re: [PATCH] add User-Agent to dummy connection [In reply to]

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


colm at stdlib

Aug 8, 2005, 8:42 AM

Post #5 of 6 (1613 views)
Permalink
Re: [PATCH] add User-Agent to dummy connection [In reply to]

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 [at] stdlib


colm at stdlib

Aug 8, 2005, 10:19 AM

Post #6 of 6 (1596 views)
Permalink
Re: [PATCH] add User-Agent to dummy connection [In reply to]

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 [at] stdlib

Apache dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.