Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Feb 2010 23:05:18 -0600
From:      Dan Nelson <dnelson@allantgroup.com>
To:        Kurt Buff <kurt.buff@gmail.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: curl question - not exactly on-topic
Message-ID:  <20100210050518.GA64193@dan.emsphone.com>
In-Reply-To: <a9f4a3861002091721h6b38e3beu5e55f0bbf4bff9e5@mail.gmail.com>
References:  <a9f4a3861002091721h6b38e3beu5e55f0bbf4bff9e5@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Feb 09), Kurt Buff said:
> Actually, it's not merely a curl question, it's a "curl and squid"
> question.
> 
> I'm trying to determine the cause of a major slowdown in web browsing on
> our network, so I've put curl on the squid box, and am using the following
> incantations to see if I can determine the cause of the slowdown:
> 
>   curl -s -w "%{time_total}\n" "%{time_namelookup}\n" -o /dev/null http://www.example.com
> 
> and
> 
>   curl -s -w "%{time_total}\n" "%{time_namelookup}\n" -o /dev/null -x 192.168.1.72 http://www.example.com
> 
> The problem arises with the second version, which uses the proxy. The
> first incantation just returns the times, which is exactly what I want.
> 
> However, when I use the -x parameter, to use the proxy, I get html
> returned as well as the times, which is a pain to separate out.

Your problem is what's after -w.  You want one argument:
"%{time_total}\n%{time_namelookup}\n", not two.  With your original command,
"%{time_namelookup}\n" is treated as another URL to fetch.  With no proxy
option, curl realizes it's not an url immediately and skips to the next
argument on the commandline - http://www.example.com.  With a proxy, curl
has to send each url to the proxy for processing.  The proxy probably
returns a "400 Bad Request" error on the first (invalid) url, which is
redirected to /dev/null.  The next url doesn't have another -o so it falls
back to printing to stdout.

Adding -v to the curl commandline will help you diagnose problems like this.

-- 
	Dan Nelson
	dnelson@allantgroup.com



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100210050518.GA64193>