From patchwork Thu Dec 22 21:09:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yann E. MORIN" X-Patchwork-Id: 708343 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3tl40V6Mwfz9sCM for ; Fri, 23 Dec 2016 08:09:46 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="f1Renwvh"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3tl40V5GwfzDwMv for ; Fri, 23 Dec 2016 08:09:46 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="f1Renwvh"; dkim-atps=neutral X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Received: from mail-wj0-x243.google.com (mail-wj0-x243.google.com [IPv6:2a00:1450:400c:c01::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3tl40Q2jcYzDrBt for ; Fri, 23 Dec 2016 08:09:42 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="f1Renwvh"; dkim-atps=neutral Received: by mail-wj0-x243.google.com with SMTP id qs7so144511wjc.1 for ; Thu, 22 Dec 2016 13:09:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id; bh=ehpfTSxcAMGTR68z+ShbX+BKUK4y8g9EsEr6VQy37zs=; b=f1RenwvhBcqK+A0AYeweDodRmH3BhgTG6JK6wJBww5ENJZN/c8ijUrhjeIyg9qkeqq SVIKr1dPDGMXC5rUURXNgtfs4ljrOzYNEiAHdXsyzXCoxgh0ywxlnWd7JNU8vzVNmSV2 hHmh8KmRyJ/Wy7h/qVr/1rTAuqNOwC5ayJuy/bMn63i14t7xVKKtpsVphT/2suhelc2o xokc643GmA2duxHQnTUK+FE0OXZ3aEhedYL25LIHMFSbIthiKZ/LD3xJqxt/vfXMZ6Fo NEwDCEio/nvWgz82182W4NEL+JAmLxI9fQn4etj/pgj7nNdS+WsdYKVmGfcglLxXed2/ AyGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=ehpfTSxcAMGTR68z+ShbX+BKUK4y8g9EsEr6VQy37zs=; b=k8/li2fROUrEPE0k7pD0NAQ0UTor3heQvftuDr6ZYOB0QofD5D2NYeffsBpXjrcxH6 rr9qdEKftbKKXNnhOmPnpVic2FBOe17TLqIybBAImpLaCw4Ovxc3OZqpHf3FpTcmGq2Z add4/v1Hta4YF1cx5fu0YWbmSRyYk8iCwWObcnRInyXhpL4yCdN3RwhFxMvtklJYFOO8 KPoJDL2N8G1FJ+6WwYL66fzpSXHoJCs68qtz07OhGHESRZXN8UlG8TNlFkXDzeI5ynIE yIvgwd0DQ4FMGrALXIdxWL8Goch3t/Yq+NP0YXhNlEfApWb4/dv7NuvmAuSBt1L/Ay2+ 2EBg== X-Gm-Message-State: AIkVDXJVKde3PtalWEevKw/s2/Ya1ny74sfusVnFQ/wf/BBwOM6SL4EscF+m7GDJDxY3ig== X-Received: by 10.194.200.228 with SMTP id jv4mr8589736wjc.217.1482440977964; Thu, 22 Dec 2016 13:09:37 -0800 (PST) Received: from gourin.bzh.lan (ns304657.ip-46-105-103.eu. [46.105.103.66]) by smtp.gmail.com with ESMTPSA id o132sm33929320wmo.17.2016.12.22.13.09.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 22 Dec 2016 13:09:36 -0800 (PST) From: "Yann E. MORIN" To: patchwork@lists.ozlabs.org Subject: [PATCH] bin/pwclient: accept alternate http_proxy forms Date: Thu, 22 Dec 2016 22:09:32 +0100 Message-Id: <1482440972-28388-1-git-send-email-yann.morin.1998@free.fr> X-Mailer: git-send-email 2.7.4 X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Yann E. MORIN" MIME-Version: 1.0 Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" The forms for http_proxy (and the likes) is not very well defined nor documented in any authoritaive place. However, there are two common forms: http://host:port or http://host:port/ Currently, the code chokes on the latter (e.g. with http_proxy=http://127.0.0.1:8080/ ): [...] File "/usr/lib/python2.7/httplib.py", line 792, in _get_hostport raise InvalidURL("nonnumeric port: '%s'" % host[i+1:]) httplib.InvalidURL: nonnumeric port: '8080/' Chop off any slash character in the port definition to accept the second form. If there is no '/' in there, it still works. Signed-off-by: "Yann E. MORIN" Cc: Stephen Finucane --- patchwork/bin/pwclient | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patchwork/bin/pwclient b/patchwork/bin/pwclient index cee8e2c..cef5536 100755 --- a/patchwork/bin/pwclient +++ b/patchwork/bin/pwclient @@ -128,7 +128,7 @@ class Transport(xmlrpclib.SafeTransport): def make_connection(self, host): self.host = host if self.proxy: - host = self.proxy.split('://', 1)[-1] + host = self.proxy.split('://', 1)[-1].split('/')[0] if self.credentials: host = '@'.join([self.credentials, host]) if self.https: