diff options
author | jbj <devnull@localhost> | 1999-07-06 12:50:45 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 1999-07-06 12:50:45 +0000 |
commit | 6782ac4fa4e03a835cbc56217c44a49501826397 (patch) | |
tree | b7595f25cab4e664d93c537d1d175208fe1228e9 /lib/url.c | |
parent | 8e1bdb7ebd20ab61953270b6f5ba78f48fe0d21d (diff) | |
download | librpm-tizen-6782ac4fa4e03a835cbc56217c44a49501826397.tar.gz librpm-tizen-6782ac4fa4e03a835cbc56217c44a49501826397.tar.bz2 librpm-tizen-6782ac4fa4e03a835cbc56217c44a49501826397.zip |
Check that url contained service field.
Return strerror if ftpStrerror is not enough.
CVS patchset: 3127
CVS date: 1999/07/06 12:50:45
Diffstat (limited to 'lib/url.c')
-rw-r--r-- | lib/url.c | 20 |
1 files changed, 14 insertions, 6 deletions
@@ -126,7 +126,7 @@ static void findUrlinfo(urlinfo **uret, int mustAsk) FREE(u->proxyh); /* Perform one-time FTP initialization */ - if (!strcmp(u->service, "ftp")) { + if (u->service && !strcmp(u->service, "ftp")) { if (mustAsk || (u->user != NULL && u->password == NULL)) { char * prompt; @@ -167,7 +167,7 @@ static void findUrlinfo(urlinfo **uret, int mustAsk) } /* Perform one-time HTTP initialization */ - if (!strcmp(u->service, "http")) { + if (u->service && !strcmp(u->service, "http")) { if (u->proxyh == NULL) { const char *proxy = rpmExpand("%{_httpproxy}", NULL); @@ -467,11 +467,19 @@ int urlGetFile(const char * url, const char * dest) { return rc; } -/* XXX This only works for httpOpen/ftpOpen/ftpGetFileDesc failures */ const char *urlStrerror(const char *url) { urlinfo *u; - if (urlSplit(url, &u)) - return "Malformed URL"; - return ftpStrerror(u->openError); + switch (urlIsURL(url)) { + case URL_IS_FTP: + case URL_IS_HTTP: + if (urlSplit(url, &u)) + return "Malformed URL"; +/* XXX This only works for httpOpen/ftpOpen/ftpGetFileDesc failures */ + return ftpStrerror(u->openError); + break; + default: + break; + } + return strerror(errno); } |