From owner-freebsd-questions@FreeBSD.ORG Wed Feb 10 17:35:10 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 38D33106568B for ; Wed, 10 Feb 2010 17:35:10 +0000 (UTC) (envelope-from kurt.buff@gmail.com) Received: from mail-qy0-f189.google.com (mail-qy0-f189.google.com [209.85.221.189]) by mx1.freebsd.org (Postfix) with ESMTP id E67ED8FC14 for ; Wed, 10 Feb 2010 17:35:09 +0000 (UTC) Received: by qyk27 with SMTP id 27so238133qyk.3 for ; Wed, 10 Feb 2010 09:35:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=lRtuFGyE1bIHCkTK0m5tX7fzqd/nSXbqW5P4vZ6FyDM=; b=RZNaZMOqU8wMXsebq9c/ki8pU76Y2/tdQ7RjdwWxVpSC3x79MqpLtOapXlZ25rn9Mo LvqWulp2A9vYya8RYOo6pRbxCiZlrtXLigMNt/E4twR4DZEuDre+8aq/fghxEbX/sgIW EH5qP48CG7cJto24P2CFbBEaWxscDQ5We6wNI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=fq7AA+dQJ7NPJlWbXelrKqUGTVRbCp+WbWG9/iA7hVLHB6yRBzhLU3VAqhbMp0O8ge cmg9qwP+cApzfnVT3hGzlhAmehZoQrkg4+/oOKKQSfuIPVXoL1Cb7hPYpUg27Kq14DM2 NLoZiE/mY/VWQv0PdrpcW4s/sVcTJTmWObWq8= MIME-Version: 1.0 Received: by 10.224.71.14 with SMTP id f14mr315875qaj.154.1265823308637; Wed, 10 Feb 2010 09:35:08 -0800 (PST) In-Reply-To: <20100210050518.GA64193@dan.emsphone.com> References: <20100210050518.GA64193@dan.emsphone.com> Date: Wed, 10 Feb 2010 09:35:08 -0800 Message-ID: From: Kurt Buff To: freebsd-questions@freebsd.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: curl question - not exactly on-topic X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Feb 2010 17:35:10 -0000 On Tue, Feb 9, 2010 at 21:05, Dan Nelson wrote: > 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 followi= ng >> incantations to see if I can determine the cause of the slowdown: >> >> =C2=A0 curl -s -w "%{time_total}\n" "%{time_namelookup}\n" -o /dev/null = http://www.example.com >> >> and >> >> =C2=A0 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. =C2=A0You want one argument: > "%{time_total}\n%{time_namelookup}\n", not two. =C2=A0With your original = command, > "%{time_namelookup}\n" is treated as another URL to fetch. =C2=A0With no = proxy > option, curl realizes it's not an url immediately and skips to the next > argument on the commandline - http://www.example.com. =C2=A0With a proxy,= curl > has to send each url to the proxy for processing. =C2=A0The proxy probabl= y > returns a "400 Bad Request" error on the first (invalid) url, which is > redirected to /dev/null. =C2=A0The 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 th= is. Thanks for that, though it's unfortunate. I would really like a better understanding of the times, to help further diagnose the problem, and 'man curl' says that multiple invocations of '-w' will result in the last one winning, which I've verified. Do you have any suggestions for a way to get the timing of these operations without resorting to tcpdump? Kurt