summaryrefslogtreecommitdiff
path: root/lib/url.c
diff options
context:
space:
mode:
authorjbj <devnull@localhost>1999-07-06 12:50:45 +0000
committerjbj <devnull@localhost>1999-07-06 12:50:45 +0000
commit6782ac4fa4e03a835cbc56217c44a49501826397 (patch)
treeb7595f25cab4e664d93c537d1d175208fe1228e9 /lib/url.c
parent8e1bdb7ebd20ab61953270b6f5ba78f48fe0d21d (diff)
downloadlibrpm-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.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/lib/url.c b/lib/url.c
index 42f074d20..67b829e4a 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -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);
}