From owner-svn-src-head@freebsd.org Sun Mar 12 04:46:18 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E1DE5D09C5A; Sun, 12 Mar 2017 04:46:18 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pf0-x241.google.com (mail-pf0-x241.google.com [IPv6:2607:f8b0:400e:c00::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A42ED1892; Sun, 12 Mar 2017 04:46:18 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pf0-x241.google.com with SMTP id o126so15357710pfb.1; Sat, 11 Mar 2017 20:46:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:mime-version:from:in-reply-to:date:cc:message-id:references :to; bh=sOPMdydurtUWTYRfkdW1S24IA3FbStDkhZ3l3bt56yo=; b=thKGU37cTW/EyR/eURdBEB+1FRbmUjk9VsZ7DDBsUUHBsrXkzOohfZLdsdtXFtR6I+ QcEjRBZX5MGuE/z63+SEwBXweumMBULJN8GQ2JY4HyHdOHXaOQNjI49i7MrM9ZA0rtoP /KO+kPtWbd9k015pVKbAL4hnBcrQpVUNprMm2EBsx14PiSKDvmlMGwEXenYug23CpZHQ U2B1ji3O+uhB4VXgMJCbRr5eOmFKAjydwPuKFzWyfKA+Xt52WTy2JPTzOkOeR/XQ20XJ hdBThbYele6QJqR7oA3qGzx1SxMThvwk7ZjK/Rsqa7yjMZldpxPVndofFrr5gpAnGWLB 2VUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:mime-version:from:in-reply-to:date:cc :message-id:references:to; bh=sOPMdydurtUWTYRfkdW1S24IA3FbStDkhZ3l3bt56yo=; b=PF3SoUOSA6mlyc40CsG2uU9torFZG7/uUtaat5+naVekU7pS7W7KRHyRIvbcCbirGD vbBFUecSL/n0uI/h0dr9UIEVdN/Aa8/odUzpkSWeag6g9C/pMhK+bvUee0ig5jFMORSF h6vjBohy4QTflYxRUSZet5v4WmUyLQh5/+G3o5j2VjjxixtoeG6NjRLiyNfJXnGFx0C0 Sh2MdumkFHbhnC6d/9Es52WSKajen2gf3BFL+2LB1eDYl1CPGUeZEvSmFT0S5rW07v2i 1Y2Jb738chQBNq6ZTJ/pepXpePE27AVMO53OzHRbC7JFa/63nmcb6Th4lJ5GIdtv7Hxl En+Q== X-Gm-Message-State: AMke39l3vXKSRsafQdQ94oVCE8Tnrr6H+NJ7F5s6COg9lJRniZ09SoZIOpBSUjYnj1i89Q== X-Received: by 10.99.225.5 with SMTP id z5mr28966171pgh.145.1489293978052; Sat, 11 Mar 2017 20:46:18 -0800 (PST) Received: from pinklady.local (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id d3sm26579782pfc.51.2017.03.11.20.46.17 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 11 Mar 2017 20:46:17 -0800 (PST) Subject: Re: svn commit: r308996 - head/lib/libfetch Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: multipart/signed; boundary="Apple-Mail=_D5E517D9-231F-4316-98E0-B939EF01E241"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail From: "Ngie Cooper (yaneurabeya)" In-Reply-To: <201611221330.uAMDU7fg052989@repo.freebsd.org> Date: Sat, 11 Mar 2017 20:46:16 -0800 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-Id: <93505FD7-FB42-4BD5-834C-6F73EFD9B1CF@gmail.com> References: <201611221330.uAMDU7fg052989@repo.freebsd.org> To: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Mar 2017 04:46:19 -0000 --Apple-Mail=_D5E517D9-231F-4316-98E0-B939EF01E241 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Nov 22, 2016, at 05:30, Dag-Erling Sm=C3=B8rgrav = wrote: >=20 > Author: des > Date: Tue Nov 22 13:30:07 2016 > New Revision: 308996 > URL: https://svnweb.freebsd.org/changeset/base/308996 >=20 > Log: > Refactor fetch_connect() and fetch_bind() to improve readability and = avoid > repeating the same DNS lookups. >=20 > MFC after: 3 weeks >=20 > Modified: > head/lib/libfetch/common.c > head/lib/libfetch/common.h > head/lib/libfetch/ftp.c >=20 > Modified: head/lib/libfetch/common.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/lib/libfetch/common.c Tue Nov 22 13:24:57 2016 = (r308995) > +++ head/lib/libfetch/common.c Tue Nov 22 13:30:07 2016 = (r308996) > @@ -1,5 +1,5 @@ > /*- > - * Copyright (c) 1998-2014 Dag-Erling Sm=C3=B8rgrav > + * Copyright (c) 1998-2016 Dag-Erling Sm=C3=B8rgrav > * Copyright (c) 2013 Michael Gmelin > * All rights reserved. > * > @@ -241,27 +241,83 @@ fetch_ref(conn_t *conn) >=20 >=20 > /* > + * Resolve an address > + */ > +struct addrinfo * > +fetch_resolve(const char *addr, int port, int af) > +{ > + char hbuf[256], sbuf[8]; > + struct addrinfo hints, *res; > + const char *sep, *host, *service; > + int err, len; > + > + /* split address if necessary */ > + err =3D EAI_SYSTEM; > + if ((sep =3D strchr(addr, ':')) !=3D NULL) { Hi Bjoern, Shouldn=E2=80=99t this be strrchr instead of strchr since = you=E2=80=99re scanning for the service from the right side of the host, = e.g. =E2=80=9Cfoo:service=E2=80=9D or =E2=80=9C[::1]:service=E2=80=9D? = This code would match index 3 in the first example, but it would match = index 2 in the second example. Thanks, -Ngie --Apple-Mail=_D5E517D9-231F-4316-98E0-B939EF01E241 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJYxNKYAAoJEPWDqSZpMIYV3J0QALZxTlr5dYE2gmWTfsURk/Py nUPfo5voDiFEZPDtkQZ1uXL5cydYirByBZxRDTFLqOxzSfaro5xLC512w4aOD5Fv LL4GyH+nVYLfEi4Wo3j7JxR81QMCDpVgGFCuk5cA1c3yvV7v0F8hAfDhNekMEY6k nkO7gUmAL3pOW7NSjeotI8/kVal0nKRVvkg3+QlLbHZixNhThXuhLgIZSaYOjEan 1fUmEyHdGRuzCp7DELjXEvElCaycZe7jSEWHDJydw2VJvVYb3RQQv8nHuGmA3yq9 tvUagd5wd+sCy4l9hXanrzuZs7D8O5MHvQXCUoH/rMUKtjfOs7l9AZdpWf9wFmz9 NmHL0BMxrbRJ+UN/N6eH+dqK8j9YuV8G+b+5C0S2e3llY+pnyGNnAcv2h/ouWgUy H6zrrJJHU/ZNP28QtEvgYVedWHQprTLVmfah5I9evQ723kL6mNtmRCZVTgx+IfoB VvwVITru8DcYs63B5IU4B09bnguIg4MtnHpMIIu5f36CibfBGFV+kUzvsgiVqZGY 4IgXqByjDFUL8DwGlTEOZiU0z+z3KfETCw23XpWCmPRPnyY6nJxitL4UpuPBUQGj aLj+Xojq2jiSC7/mgmxO/WSRf0h/tQxcDnEa3C2CKcn4DIP6z8aF1fyo+njJDHsu o1djBBUk1kk188glJp3b =lVHI -----END PGP SIGNATURE----- --Apple-Mail=_D5E517D9-231F-4316-98E0-B939EF01E241--