cURL / Mailing Lists / curl-users / Single Mail

curl-users

cutting down the user-agent

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 8 May 2012 19:31:19 +0200 (CEST)

Hi friends,

I'm considering restricting the User-agent: header that curl sends by default
to something much less verbose and I'm interested in your opinions!

A default 'curl localhost' on Debian Linux makes 170 bytes get sent in that
single request:

GET / HTTP/1.1
User-Agent: curl/7.24.0 (i486-pc-linux-gnu) libcurl/7.24.0 OpenSSL/1.0.0g zlib/1.2.6 libidn/1.23 libssh2/1.2.8 librtmp/2.3
Host: localhost
Accept: */*

As you can see, the user-agent description takes up a large portion of that
request, and this for really no good reason at all. Without sacrificing any
functionality I shrunk the same request down to 71 bytes:

GET / HTTP/1.1
User-Agent: curl/7.24.0
Host: localhost
Accept: */*

That means we shrunk it down to 41% of the original size. I'll admit the
example is a bit extreme and most other normal use cases will use longer host
names and longer paths, but even for a URL like
"http://daniel.haxx.se/docs/curl-vs-wget.html" we're down to 50% of the
original request size (100 vs 199).

"curl -V" will still show the version info as usual.

So, is there any downsides with this that I haven't thought about or just a
reason for not doing this? Anyone thinks this is a good idea?

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ:        http://curl.haxx.se/docs/faq.html
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2012-05-08