public inbox for cygwin-apps-cvs@sourceware.org
help / color / mirror / Atom feed
* [setup - the official Cygwin setup program used to install Cygwin and keep it up to date] branch master, updated. release_2.874-27-g5c55c7a
@ 2016-09-01 13:58 corinna
0 siblings, 0 replies; only message in thread
From: corinna @ 2016-09-01 13:58 UTC (permalink / raw)
To: cygwin-apps-cvs
https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=5c55c7a68870777d8775ff0b3c0bf3d482534824
commit 5c55c7a68870777d8775ff0b3c0bf3d482534824
Author: Corinna Vinschen <corinna@vinschen.de>
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 <corinna@vinschen.de>
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;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-09-01 13:58 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-01 13:58 [setup - the official Cygwin setup program used to install Cygwin and keep it up to date] branch master, updated. release_2.874-27-g5c55c7a corinna
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).