From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 116125 invoked by alias); 1 Sep 2016 13:58:52 -0000 Mailing-List: contact cygwin-apps-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: cygwin-apps-cvs-owner@sourceware.org Received: (qmail 116107 invoked by uid 9078); 1 Sep 2016 13:58:52 -0000 Date: Thu, 01 Sep 2016 13:58:00 -0000 Message-ID: <20160901135852.116081.qmail@sourceware.org> From: corinna@sourceware.org To: cygwin-apps-cvs@sourceware.org Subject: [setup - the official Cygwin setup program used to install Cygwin and keep it up to date] branch master, updated. release_2.874-27-g5c55c7a X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: f2a16aff20f2fe58ab9cad651e2b94916a0a773b X-Git-Newrev: 5c55c7a68870777d8775ff0b3c0bf3d482534824 X-SW-Source: 2016-q3/txt/msg00021.txt.bz2 https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=5c55c7a68870777d8775ff0b3c0bf3d482534824 commit 5c55c7a68870777d8775ff0b3c0bf3d482534824 Author: Corinna Vinschen Date: Thu Sep 1 15:58:46 2016 +0200 Fix scope problem in NetIO_HTTP::NetIO_HTTP Also reformat slightly for better readability Signed-off-by: Corinna Vinschen Diff: --- nio-http.cc | 39 ++++++++++++++++----------------------- 1 files changed, 16 insertions(+), 23 deletions(-) diff --git a/nio-http.cc b/nio-http.cc index 259dc0f..269d69d 100644 --- a/nio-http.cc +++ b/nio-http.cc @@ -92,6 +92,7 @@ base64_encode (char *username, char *password) NetIO_HTTP::NetIO_HTTP (char const *Purl):NetIO (Purl) { + std::string url (Purl); retry_get: if (port == 0) port = 80; @@ -103,14 +104,13 @@ retry_get: if (!s->ok ()) { - delete - s; + delete s; s = NULL; return; } if (net_method == IDC_NET_PROXY) - s->printf ("GET %s HTTP/1.0\r\n", Purl); + s->printf ("GET %s HTTP/1.0\r\n", url.c_str ()); else s->printf ("GET %s HTTP/1.0\r\n", path); @@ -132,10 +132,8 @@ retry_get: s->printf ("\r\n"); - char * - l = s->gets (); - int - code; + char * l = s->gets (); + int code; if (!l) return; sscanf (l, "%*s %d", &code); @@ -145,13 +143,11 @@ retry_get: { if (_strnicmp (l, "Location:", 9) == 0) { - char * - u = l + 9; + char * u = l + 9; while (*u == ' ' || *u == '\t') u++; set_url (u); - delete - s; + delete s; goto retry_get; } } @@ -159,35 +155,32 @@ retry_get: if (code == 401) /* authorization required */ { get_auth (NULL); - delete - s; + delete s; goto retry_get; } if (code == 407) /* proxy authorization required */ { get_proxy_auth (NULL); - delete - s; + delete s; goto retry_get; } if (code == 500 /* ftp authentication through proxy required */ - && net_method == IDC_NET_PROXY && !strncmp (Purl, "ftp://", 6)) + && net_method == IDC_NET_PROXY + && !url.compare (0, std::string::npos, "ftp://", 6)) { get_ftp_auth (NULL); if (net_ftp_user && net_ftp_passwd) { - delete - s; - Purl = (std::string("ftp://") + net_ftp_user + - ":" + net_ftp_passwd + "@" + (Purl + 6)).c_str(); + delete s; + url = std::string("ftp://") + net_ftp_user + ":" + + net_ftp_passwd + "@" + url.substr (6); goto retry_get; } } if (code >= 300) { - delete - s; - s = 0; + delete s; + s = NULL; return; }